Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: syntax - query's scalar results to a varible?
Andy Hassall wrote:
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/fundamentals.htm#sthref457
thats a "10g Release 2" doc, but the syntax is the same for 9?
so it looks like the syntax would be:
--define variable
DECLARE v_roleID INTEGER;
--assign value to variable (based on input parameter's roleName)
BEGIN
SELECT f.RoleID INTO v_roleID FROM Foo f WHERE f.RoleName =
p_roleName;
END; ...i say "looks like", because while it does execute w/o errors in my sql edit window (im in Toad), im not sure how to print it back as a result (for testing). in MS SQL, one would add this:
SELECT v_roleID;
but oracle doesnt like that (PLS-00101: Encounted the symbol "SELECT"). is there a simple print statement?
thanks,
matt
http://www.sushi-review.com Received on Wed Jul 05 2006 - 10:25:10 CDT
![]() |
![]() |