-
select in a view that returns constant value
I'm trying to create a view that just selects from columns and also returns a constant value based on the data in a column. I can't get it though. Something like this:
create or replace force view lead_stats (
accession, value, insurance)
as
select a.accession, a.value, ('T' if b.code = 'C' OR 'F' if b.code <> 'C')
from tableone a, table2 b
where a.acct = b.acct
I can't figure out how to get the view to return a T if the b.code field has a C and to return an F if the b.code field contains anything but a C.
Any ideas are greatly appreciated.
Thanks.
-
decode(b.code,'C','T','F')
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
Thanks very much, that works perfectly!
-
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|