zoukankan      html  css  js  c++  java
  • Oracle之包头和包体的创建

    其实包头就相当于java的类,里面定义了多个方法,包体就是实现方法里具体的逻辑

    在out参数中引用光标,解决如果返回值过多的情况.

    下面这个示例就是包头和包体的示例

    执行的时候先执行包头,再执行包体

    1.  
      --2、查询某个部门中的所有员工信息 ----> 返回的是集合
    2.  
      --包头
    3.  
      create or replace package mypackage is
    4.  
      type empcursor is ref cursor;--这句话是自定义一个变量类型为光标类型其实就是光标,不定义也可以.
    5.  
      --下面这句就是包头里有个存储过程,定义一个存储过程,可以定义多个.
    6.  
      procedure queryEmpList(dno in number,empList out empcursor);
    7.  
      end mypackage;
    8.  
      --包体,用来实现包头里的具体的存储过程或者存储函数
    9.  
      create or replace package body mypackage is
    10.  
      procedure queryEmpList(dno in number,empList out empcursor)
    11.  
      as
    12.  
      begin
    13.  
      open empList for select * from emp where deptno=dno;
    14.  
      end;
    15.  
      end mypackage;
    16.  
       

     

    转发:https://blog.csdn.net/kxj19980524/article/details/86737316

    Oracle之包头和包体的创建

  • 相关阅读:
    QT中文报错问题
    自动获取UILabel高度
    vi编辑器的使用
    命令例子
    WPF中textBlock 变色功能
    php 删除目录及子文件
    jquery autocomplete插件
    js日历选择控件
    centeros bash: ifconfig: command not found
    php 文件日志类
  • 原文地址:https://www.cnblogs.com/xyyou/p/14388885.html
Copyright © 2011-2022 走看看