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 -> Help with procedure syntax

Help with procedure syntax

From: <cpereyra_at_ix.netcom.com>
Date: Tue, 21 Sep 1999 23:14:01 GMT
Message-ID: <7s93fh$4tn$1@nnrp1.deja.com>


Hi:

I am trying to learn the subtleties of programming the Oracle back end. My background is Sybase and MS SQL Server so some of the constructs in Oracle seem strange and the books I have don't offer enough lucid help. Well, here it goes:

This works:

create or replace procedure InsertName(namein in varchar2) as
cursor mycursor is select lastname from res_hold where firstname = namein;
myvar varchar2(30);
begin

	open mycursor;
	loop
		fetch mycursor into myvar;
		insert into names (name) values (myvar);
		exit when mycursor%NOTFOUND;
	end loop;

end;

This, replacing the myvar varchar2(30) with myvar mycursor%ROWTYPE does not.

create or replace procedure InsertName(namein in varchar2) as
cursor mycursor is select lastname from res_hold where firstname = namein;
myvar mycursor%ROWTYPE;
begin

	open mycursor;
	loop
		fetch mycursor into myvar;
		insert into names (name) values (myvar);
		exit when mycursor%NOTFOUND;
	end loop;

end;

The question is why?

Thanks in advance,

Carlos.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Tue Sep 21 1999 - 18:14:01 CDT

Original text of this message

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