显示使用游标(并定义返回记录类型)
DECLARE
TYPE detail_record IS RECORD
( ENCOUNTERID PRPA.ENCOUNTER.ENCOUNTERID%type,
SICKBEDID PRPA.ENCOUNTER.SICKBEDID%type,
DISPLAYNAME PRPA.ENCOUNTER.DISPLAYNAME%type,
BIRTHTIME PRPA.ENCOUNTER.BIRTHTIME%type,
SEQNOTEXT PRPA.ENCOUNTER.SEQNOTEXT%type);
TYPE detail_cursor IS REF CURSOR RETURN detail_record;
v_prodcur detail_cursor ;
v_prodrec detail_record;
BEGIN
OPEN v_prodcur FOR SELECT ENCOUNTERID, SICKBEDID, DISPLAYNAME, BIRTHTIME, SEQNOTEXT FROM PRPA.ENCOUNTER
WHERE ISDELETED=0 AND ENCOUNTERKINDCODEID=1 AND RESPONSIBLEDEPARTMENTID=4;
LOOP
FETCH v_prodcur INTO v_prodrec ;
EXIT WHEN v_prodcur%notfound;
dbms_output.put_line ('ENCOUNTERID:' || CAST(v_prodrec.ENCOUNTERID AS VARCHAR));
dbms_output.put_line ('SEQNOTEXT:' || v_prodrec.SEQNOTEXT);
END LOOP;
CLOSE v_prodcur;
END;
标签:PRPA,SEQNOTEXT,ENCOUNTERID,detail,游标,使用,ORACLE,type,ENCOUNTER From: https://www.cnblogs.com/chriskwok/p/17526100.html