声明r_doc 为和表c_doc中一行相同的类型,类似于c 的结构体

解决方案 »

  1.   

    %rowtype返回一个基于表定义的类型
    c_doc可以是个表,那么r_doc就是一个记录,该纪录中的每个字段将与c_doc表中的字段相对应
      

  2.   

    create or replace procedure test
    as
      cursor v_cursor is select id,name from test where id=1;
      v_crowtype v_cursor%rowtype;
      v_trowtype  test%rowtype;
    begin
      select * into v_trowtype from test where id=2;
      dbms_output.put_line('cursor rowtype name:' || v_crowtype.name || ';');
      dbms_output.put_line('table rowtype name:' || v_trowtype.name || ';');end;