Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PL/SQL

Status
Not open for further replies.

dbomrrsm

Programmer
Feb 20, 2004
1,709
GB
Is this at all possible in pl/sql:

Code:
IF (select 1 from dual) = 1 THEN
-- Do something
ELSE
-- Do Something Else
END IF;

I appreciate that you can populate the calue of the select statement into a variable and use that in the if but just want to know if the above is possible in any version of pl/sql.

Thanks

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Well you do know that your posted pseudo-code is equivalent to just

-- Do something

but I guess you were looking for

declare
x number := 0;
begin

select 1
into x
from dual;

if x = 1 then
-- Do something
else
-- Do something else
end if;

end;


In order to understand recursion, you must first understand recursion.
 
You would need to give more detail than you currently have. Show us what you are actually trying to do rather than over simplifying and thereby opening up all sorts of other non-appropriate possibilites.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top