If the additional table is joined on your query, you can use NVL2.
Otherwise you may want to try a correlated subquery.
NVL2(input_expr, not_null_substitution_expr, null_substitution_expr)
Correlated subqueries can be costly depending on the indexing available
to you.
I am sure there are other options available, but I thought of these
first.
Thanks,
-James Clark
-----Original Message-----
From: Samuel Quantz
[mailto:oracledba-ezmlmshield-x21638366.[Email address protected]
Sent: Tuesday, January 08, 2008 11:37 AM
To: LazyDBA Discussion
Subject: SQL syntax help
Hello,
I am in the process of creating a view and for some reason I am having a
mental block.
For one of the fields I need it to present a 'Y' or 'N' for each
pupil_number(individual record).
If the pupil number exists in a separate table then I want the value to
be 'N', otherwise it should be 'Y'.
I have looked at the decode function, but from the documentation it
doesn't seem to be exactly what I want.
Any help would be appreciated
Sam Quantz
DBA
Information Systems
Salt Lake City School District
(801)578-8329
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a
dba job: http://jobs.lazydba.com To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
Oracle LazyDBA home page