我本来想用select 列1 into aaa,列2 into bbb,列3 into ccc from 表但是报错现在只能
select 列1 into aaa from 表;
select 列2 into bbb from 表;
.
.
.
这么分开付值,这样不是要付多少个值就要查询几变么有什么方法可以快捷一点的挖?

解决方案 »

  1.   

    select 列1,列2,列3 into 变量1,变量2,变量3 from table 
      

  2.   


    set serveroutput on;
    declare dnamet varchar(20):='ACCOUNTING';
     loc varchar(20):='ACCOUNTING';
     idtag number:=0;
    begin
        
         dbms_output.put_line('dnamet:'||dnamet);
         select DEPTNO,deptno into loc,idtag  from dept where dname=dnamet;
         dbms_output.put_line('loc:'||loc);
          dbms_output.put_line(''||idtag);
    end;
    /
      

  3.   

    Connected to Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 
    Connected as scottSQL> dnamet:ACCOUNTING
    loc:10
    10PL/SQL procedure successfully completedSQL> dnamet:ACCOUNTING
    loc:10
    10PL/SQL procedure successfully completedSQL>