zoukankan      html  css  js  c++  java
  • oracle 存储过程和函数学习笔记

    1、创建过程的语法:     

    Code

    简单的例子:

    Code

     

    删除过程语法:

    drop procedure procedure_name;

    2、创建函数的语法:

    Code

    简单函数的例子:

     create function ClassInfo(
          p_Department classes.department
    %type,
          p_Course     classes.course
    %type)
          
    return varchar is 
          v_CurrentStudents 
    number;
          v_MaxStudents     
    number;
          v_PercentFull     
    number;
          
    begin
              
    select current_students,max_students 
              
    into v_CurrentStudents,v_MaxStudents
              
    from classes
              
    where department=P_Department and course=P_Course;
              
              
    --计算百分比
              v_PercentFull:=v_CurrentStudents/V_MaxStudent*100;
              
              
    if v_PercentFull=100 then
              
    return 'Full';
              elseif v_PercentFull
    >80 then 
              
    return 'Some Room';
              elseif v_PercentFull
    >60 then 
              
    return 'More Room';
              elseif v_PercentFull
    >0 then 
              
    return 'Lots of Room';
              
    else
              
    return 'Empty';
              
    end if 
              
          
    end ClassInfo;
              

    删除函数语法:

    drop function function_name;
  • 相关阅读:
    泛型-----------C#
    wpf风格的数据绑定------WPF
    wpf引用外部样式及外部样式的复杂写法--------WPF
    线程的最简易写法-------------android
    Fragment的用法(类似于.net的用户控件,重用性好)。。。。---------------android
    写一个事件(不仅仅是为控件添加事件)------------C#
    页面跳转(带返回参数的)---------android
    构造函数(构造器)的正确重载方式------类
    利用 CSS3 判断手机是横屏还是竖屏
    AngularJS Or jQuery 省份城市二级联动下拉功能
  • 原文地址:https://www.cnblogs.com/abcdwxc/p/1315722.html
Copyright © 2011-2022 走看看