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 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 toolReceived on Mon Jul 03 2006 - 16:27:45 CDT
![]() |
![]() |