Re: How to display multiple records of SQL table in PL/SQL procedure
Date: Wed, 05 Apr 2000 21:15:59 GMT
Message-ID: <j2OG4.103$Za1.2321_at_newsc.telia.net>
a new programmer skrev i meddelandet ...
>I am a new Oracle user. I want to display the SQL table records in PL/SQL
>procedure. For which I'm using following
>
>Declare
>v_FirstName varchar2(15);
>v_LastName varchar2(15);
>v_Salary number;
>
>Begin
>--Employee is table name & FirstName, LastName, Salary are the fields of
the
>table
>
>select FirstName, LastName, Salary into v_FirstName, v_LastName, v_Salary
>from employee;
>
>dbms_output.put_line(v_LastName || ' ' || v_FirstName || ' ' || v_Salary);
>
>End;
>/
>
>I have multiple records in the employee table. When I run the program I get
>error multiple records found.
>If anybody knows, Please let me know.
>
>Thanking in advance.
>
>Rajashri Jadhav
You have to use a cursor in this case. Look for the word cursor in some
on-line documentation and you see how it is done. In short you declare your
select statement as a cursor, then fetch one row each time and display it.
Then leave the loop.
Lars Received on Wed Apr 05 2000 - 23:15:59 CEST