Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL how-to procedure

Re: PL/SQL how-to procedure

From: mjc <cavett_at_globalnet.co.uk>
Date: 1997/03/30
Message-ID: <01bc3d32$8e7c4820$a9567ec2@cavett.globalnet.co.uk>#1/1

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
	*/

END;
/

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US