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: Rookie question

Re: Rookie question

From: Jonathan Gennick <gennick_at_worldnet.att.net>
Date: 1997/10/18
Message-ID: <3448eb31.1381386@netnews.worldnet.att.net>#1/1

On Thu, 16 Oct 1997 19:59:45 -0500, rsenn <rsenn_at_capaccess.org> wrote:

>Can anybody tell me why these statements are generating errors?
> Thanks.
>
>SQL> create or replace procedure test
> 2 is
> 3 begin
> 4 select * from emp_hist ;
> 5 end test ;
> 6 /
>
>Warning: Procedure created with compilation errors.

Probably the error is becaues you are selecting data without a destination. Within pl/sql you can't just select data, you need to specify a place to put it. One option is to do a singleton select like this one:

	create or replace procedure test
	is 
	v_emp_name	varchar2(30);
	begin
		select emp_name into v_emp_name from emp_hist
		where emp_id=1;
	end;
	/

The other option, if you need to deal with a number of rows, is to use a cursor.

regards,

Jonathan Gennick



gennick_at_worldnet.att.net
http://home.att.net/~gennick Received on Sat Oct 18 1997 - 00:00:00 CDT

Original text of this message

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