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;
  • 相关阅读:
    win10企业版激活密钥
    百科知识 手机QQ的视频如何保存
    华为荣耀7手机如何开启开发者模式,开启调试模式
    C#如何设置控件水平对齐,垂直对齐
    C#如何实现挂机锁
    JAVA_MyEclipse常见配置NETGEAR路由器如何设置
    JAVA_MyEclipse如何加载Tomcat
    VC++_错误 无法打开包括文件“glglut.h” No such file or directory 怎么办
    生活娱乐 达尔优的键盘鼠标如何打开和关闭呼吸灯
    新版的豌豆荚如何连接电脑
  • 原文地址:https://www.cnblogs.com/abcdwxc/p/1315722.html
Copyright © 2011-2022 走看看