Home » SQL & PL/SQL » SQL & PL/SQL » select statement in NVL or decode?
select statement in NVL or decode? [message #185862] Thu, 03 August 2006 21:00 Go to next message
cong
Messages: 25
Registered: June 2006
Junior Member
can i include a select statement in NVL or decode statement?

for ex.

SELECT col1
FROM table1
WHERE cond1....
AND DECODE(val1,NULL,(SELECT MIN(x)
FROM table2
WHERE cond2...),val1);

i'm getting ora-00936 missing expression error. thanks!
Re: select statement in NVL or decode? [message #185867 is a reply to message #185862] Thu, 03 August 2006 22:07 Go to previous messageGo to next message
ruyue
Messages: 9
Registered: July 2006
Junior Member
It's no problem to include a subquery in the nvl or decode function,but the statement you wrote is not complete.

DECODE(val1,NULL,(SELECT MIN(x)
FROM table2
WHERE cond2...),val1)


return a value. It's not a complete condition.

[Updated on: Thu, 03 August 2006 22:08]

Report message to a moderator

Re: select statement in NVL or decode? [message #186016 is a reply to message #185862] Fri, 04 August 2006 14:23 Go to previous message
Bill B
Messages: 1484
Registered: December 2004
Senior Member
The easiest way to find out your problem is to pull out the internal select and run it directly. You have an error in your expression and without you showing us the entire decode statement, there is no way that we can determine your error.
Previous Topic: Import coma seperated text file in to a table ORACLE 10g
Next Topic: Trigger
Goto Forum:
  


Current Time: Fri Dec 09 15:37:30 CST 2016

Total time taken to generate the page: 0.13853 seconds