PKG中游标写法及PL/SQL测试输出

declare
      type rescur is ref cursor;--定义游标
      rowcur rescur;--实列化游标
      type restype is record(--定义记录
        Contractid        varchar2(32),--记录中的对应属性
        Contractno        varchar2(32),
        applicationno     varchar2(32),
        Contractstatus    varchar2(32),
        Branchname        varchar2(256),
        Acceptuser        varchar2(32),
        Showdate          varchar2(32),
        Ascriptionmode    varchar2(32),
        Providername      varchar2(32),
        Customername      varchar2(32),
        Agentname         varchar2(32),
        totalmodalpremium number(15, 2),
        Agencyfee         number(15, 2),
        Fyb               number(15, 2),
        Valueprem         number(15, 2));
      rowtype restype;--实列化记录
     
    begin
      open rowcur for vSQL || vCondition;  --为执行语句打开游标(vSQL是共同语句,vCondition为不同条件) 
      loop
        fetch rowcur
          into rowtype;--循环一条条注入到游标记录当中
        exit when rowcur%notfound;--当没找到后就退出
     
        P_NT_SFA_THISMONTHBUSINESS.EXTEND; --P_NT_SALECHECKON扩展
        P_NT_SFA_THISMONTHBUSINESS(I) := new OB_SFA_THISMONTHBUSINESS(); --实例化OB
     
        P_NT_SFA_THISMONTHBUSINESS(I).contractid := rowtype.Contractid; --获取对应的值



=====================pl/sql测试输出================
dbms_output.put_line(vSQL);
dbms_output.put_line(vCondition);

你可能感兴趣的:(pl/sql)