Re: Simple PL/SQL Query

From: Kjartan R Gudmundsson <kjartang_at_ejs.is>
Date: 1996/01/26
Message-ID: <4eb02q$8rd_at_njala.saga.is>#1/1


ccev38_at_leonis.nus.sg (Computer Centre Visitor) wrote:

>Hi everybody
 

>Here is a simple PL/SQL problem
 

>How do I select rowid and all the columns from a table in PL/SQL block. The
>declaration "%ROWTYPE" will not hold any rowid data type so the following
>code will be incorrect.

<lines deleted>
>I tried another method by introducing one more declaration for rowid.
 

>declare
>pl_tmp_rowid rowid;
>x emp%rowtype;
>begin
> select rowid, emp.* into pl_tmp_rowid, x from emp where empno=1003;
> dbms_output.put_line(pl_tmp_rowid || ' '||to_char(x.empno));
>end;
>/
 

>Even now the declaration is not correct. Is there any way I can achieve
>this. I am not interested in specifying all the column names in select
>statement as well as in into clause.
 

>Thanks in advance

begin

   for x in (

     select rowid, emp.* from emp where empno=1003) loop
     dbms_output.put_line(x.rowid || '   '||to_char(x.empno));
   end loop;
end;

This works.
krg.
>Ramesha H.G.
>Consultant
>Hewlette Packard Singapore (Sales) Pte. Ltd.
>E-mail : ccev38_at_cce.nusstf.nus.sg
>Ph : 7722527
>Fax: 7722595
 

>PS: We are working for a University Project
Received on Fri Jan 26 1996 - 00:00:00 CET

Original text of this message