| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL how-to procedure
Hi Chris -
Can you please say what you want your procedure to do, as it's difficult to help out otherwise.
Working 'blind' though: What you can use, is a cursor that effectively selects back rows from your table and you can then use that data as you wish - if you use a CURSOR FOR LOOP this does an implicit fetch and handles opening and closing of cursors which is neat! e.g.
CREATE OR REPLACE PROCEDURE sel_table1
IS
DECLARE
CURSOR c1 IS
SELECT *
FROM table1;
col1_tot NUMBER := NULL;
BEGIN
FOR c1_cur IN c1 LOOP
/*
PL/SQL manipulation here
where you can reference each tables column
using the 'c1_cur' reference. . .
e.g. col1_tot := col1_tot+c1_cur.col1
*/
END LOOP;
EXCEPTION
/*
exception handling
*/
Please email me if you need further assistance and I'll try help out!
Regards
CG <christian.gregory_at_citicorp.com> wrote in article
<333C8093.19A5_at_citicorp.com>...
> ...Can anyone tell me if it is possible to create a procedure
> with a simple 'select' statement ?... ie. select * from table_a;
>
> this select statement will not have an into clause.
>
> the reason I ask is that I can't seem to be able to create a procedure
> unless I have that into clause...
>
> Any help is appreciated .... chris
>
Received on Sun Mar 30 1997 - 00:00:00 CST
![]() |
![]() |