1.
select servid into aa from tablea a where a.id='111';
aa查出来是'222'select * from tableb b where b.id=aa; --执行报错,是哪里出了错
select * from tableb b where b.id=‘222’;--执行成功2.若存储过程最后返回的是个结果集,该如何实现
select a.id,a.name from tablea where a.id=''
id,name结果是多条记录

解决方案 »

  1.   

    select * from tableb b where b.id=aa; --执行报错,是哪里出了错存储过程里面不让这样直接查询。你可以insert into  select...
      

  2.   

    那该如何调用,aa的值必须是前一个查询得出的结果值,insert into  select 怎么用,能提供个完整的语句吗
      

  3.   

    .若存储过程最后返回的是个结果集,该如何实现用游标,然后  dbms_output.put_line打印出来
    declare
           --类型定义
           cursor c_job
           is
           select empno,ename,job,sal
           from emp
           where job='MANAGER';
           --定义一个游标变量v_cinfo c_emp%ROWTYPE ,该类型为游标c_emp中的一行数据类型
           c_row c_job%rowtype;
    begin
           for c_row in c_job loop
             dbms_output.put_line(c_row.empno||'-'||c_row.ename||'-'||c_row.job||'-'||c_row.sal);
           end loop;
    end;