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: Andy Hassall <andy_at_andyh.co.uk>
Date: Mon, 03 Jul 2006 22:27:45 +0100
Message-ID: <ut2ja2pgtie1i6bonsu8m62e1h477157s8@4ax.com>


On 3 Jul 2006 14:21:14 -0700, matt_at_mailinator.com wrote:

>im an application developer w/ a background in MS SQL Server, but i'm
>learning oracle pl/sql for a project. im learning quite a bit, but this
>one still gives me grief.
>
>in MS, when i needed to refer to a sub-query's result, i would often do
>something like this:
>
> --ms sql server syntax
> DECLARE @roleID INT
> SET @roleID = SELECT RoleID FROM Foo f WHERE f.RoleName = p_roleName
>
>how is this done in pl/sql? i would have guessed:
>
> DECLARE v_roleID INTEGER := SELECT RoleID FROM Foo f WHERE f.RoleName
>= p_roleName
>
>...but that was happy for me. im on oracle 9. have i got my syntax
>wrong, or is this not how its done?

http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/fundamentals.htm#sthref457

-- 
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Received on Mon Jul 03 2006 - 16:27:45 CDT

Original text of this message

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