IF condition on PLSQL [message #341304] |
Mon, 18 August 2008 04:55  |
kmkumar24
Messages: 69 Registered: January 2007 Location: Singapore
|
Member |
|
|
Hello,
I am trying to write IF condition inside the cursor, but it is giving error. Can any one provide the exact statement for this?
IF l_USER_ID=(Select * from OS_AGENCY_USER where USER_ID = FOS.USER_ID) then
insert into PV_USERPREF (USERID,NAME,VALUE)
values ((Select USERID from PV_USER where USERNAME = OS_AGENCY_USER.USER_ID),'USER_TYPE','PUBLIC');
ELSE
insert into PV_USERPREF (USERID,NAME,VALUE)
values ((Select USERID from PV_USER where USERNAME = OS_AGENCY_USER.USER_ID),'USER_TYPE','ORGANISATION');
END IF;
ERROR is:
IF l_USER_ID=(Select * from OS_AGENCY_USER where USER_ID = FOS.USER_ID) then
*
ERROR at line 55:
ORA-06550: line 55, column 14:
PLS-00405: subquery not allowed in this context
ORA-06550: line 55, column 1:
PL/SQL: Statement ignored
Thanks in Advance
Kumar
|
|
|
|
Re: IF condition on PLSQL [message #341459 is a reply to message #341305] |
Mon, 18 August 2008 22:00   |
kmkumar24
Messages: 69 Registered: January 2007 Location: Singapore
|
Member |
|
|
As I am new to plsql could you let me know how to assign it to the variable. This is my querry
select * from os_agency_user,os_user where os_agency_user.user_id=os_user.user_id;
Thanks
Kumar
|
|
|
|
Re: IF condition on PLSQL [message #341464 is a reply to message #341304] |
Mon, 18 August 2008 23:15   |
flyboy
Messages: 1903 Registered: November 2006
|
Senior Member |
|
|
> As I am new to plsql could you let me know how to assign it to the variable.
As you are new to PL/SQL, you shall learn it from a senior colleague, attend an Oracle PL/SQL course, or, if nothing available, search and study the documentation, found e.g.online on http://tahiti.oracle.com/.
PL/SQL User's Guide and Reference
Chapter 6 Performing SQL Operations from PL/SQL
Querying Data with PL/SQL
Selecting At Most One Row: SELECT INTO Statement
|
|
|
Re: IF condition on PLSQL [message #341471 is a reply to message #341464] |
Mon, 18 August 2008 23:55  |
 |
Michel Cadot
Messages: 68767 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Some are quite reluctant from reading documentation; from his previous post:
Michel Cadot wrote on Wed, 30 July 2008 12:21 | As for your previous topic:
|
|
|
|