Re: How to display multiple records of SQL table in PL/SQL procedure

From: Jason Pepper <jpepper_at_uk.oracle.com>
Date: Thu, 6 Apr 2000 08:52:42 +0100
Message-ID: <8cibt8$o6v$1_at_inet16.us.oracle.com>


 Declare

--
cursor c_employees is
select FirstName
       , LastName
       , Salary
 from employee;
--
Begin

-- Turn on DBMS_OUTPUT
dbms_output.enable(20000);

-- Create a record identifier, open the cursor, and loop round outputting
each record
for rec_identifier in c_employees
loop
 dbms_output.put_line(rec_identifier.LastName || ' ' ||
rec_identifier.FirstName || ' ' || rec_identifier.Salary);
end loop;

-- Handle any errors
exception
   when others then
      dbms_output.put_line('The following error occurred'||sqlerrm)
--
 End;

--
Regards

Jason

____________________________________________________________________________
__

  Jason Pepper - Enterprise Internet Tools Product Management
____________________________________________________________________________
__

[Quoted] Opinions are mine and do not necessarily reflect those of Oracle Corporation

"a new programmer" <JadhavR_at_automationc.com> wrote in message
news:UlMG4.144$k5.65515_at_news.abs.net...

> 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
>
>
Received on Thu Apr 06 2000 - 09:52:42 CEST

Original text of this message