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

Home -> Community -> Usenet -> c.d.o.server -> Re: syntax - query's scalar results to a varible?

Re: syntax - query's scalar results to a varible?

From: <matt_at_mailinator.com>
Date: 5 Jul 2006 08:25:10 -0700
Message-ID: <1152113110.784774.234160@b68g2000cwa.googlegroups.com>


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

Original text of this message

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