Hey guys I seem to have a mental block here. I have two sql statements. I would like the second to run only if the first sql statement is null.I know i can potentially use PLsql but would really like to see if i can do this with straight up sql. Your responses are very very appreciated.
here is the first sql
Select ft.fund_code,
ft.orgn_code,
ft.acct_code,
ft.amount,
fb.owner_pidm,
ft.prog_code
from ftrbremb fb , ftcractg ft
where fb.doc_code = 'TR000038'
and fb.ftpbport_id = ft.ftpbport_id
second sql statement
Select ft.fund_code,
ft.orgn_code,
ft.acct_code,
ft.amount,
fb.owner_pidm,
ft.prog_code
from ftrbremb fb , ftcractg ft, ftprexps fx
where fb.doc_code = 'TR000038'
--and fb.ftpbport_id = ft.ftpbport_id
and fx.ftrbremb_id = fb.id
and ft.ftprexps_id = fx.id;
How can i combine these two statements together so that when the first one is null the second one runs. As a bonus i like to get just the first row as well.
Any help would greatly appreciated. I tried to accomplish with case statement but it just dosent seem to be working for me.
Thanks