oracle sys_refcursor

oracle sys_refcursor
-- Create table
create table ABING1
(
  ID         INTEGER not null,
  CREATETIME DATE default sysdate not null,
  FIRSTNAME  NVARCHAR2(100) not null,
  LASTNAME   CLOB not null,
  MIDDLENAME NCLOB not null
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table ABING1
  add constraint PK_ABING primary key (ID)
  using index
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );




create or replace procedure abin55(abing in varchar2,abin out sys_refcursor)
as
begin
declare
createtime date:=to_date(abing,'yyyy:MM:dd HH24:MI:SS');
cursor mycur is select * from abing1 t where t.createtime=createtime;
abin mycur%rowtype;
begin
open mycur;
loop
     fetch mycur into abin;
     exit when mycur%NOTFOUND;
end loop;
close mycur;
end;
end;

你可能感兴趣的:(oracle sys_refcursor)