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?
On 5 Jul 2006 08:25:10 -0700, matt_at_mailinator.com wrote:
>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?
Yes, it's a basic PL/SQL construct that's been the same for many versions.
>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?
Look up DBMS_OUTPUT.
-- Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis toolReceived on Wed Jul 05 2006 - 13:22:36 CDT
![]() |
![]() |