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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Decode NOT NULL

Status
Not open for further replies.

nareval

Programmer
Jul 12, 2000
1
0
0
US
Is it possible to use NOT NULL in a nested decode?<br>This is what I'm trying to do:<br>decode(field,NOT NULL, field value,decode(next field, NOT NULL, next field value, 'No Value Found'))<br><br>If not, how can I rewrite this to work?
 
If you use NOT NULL, it gets flagged as ORA-396: Missing Expression.<br>In order to accomplish what you want, you have to invert the test:<br><br>decode(field,NULL,decode(next_field,NULL,'No Value Found',next_field),field)<br><br>Rather cumbersome, but it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top