Home » Developer & Programmer » Reports & Discoverer » How to execute Query 2 if Query 1 doesnt reterive anything (Oracle Reports 6i, XP)
How to execute Query 2 if Query 1 doesnt reterive anything [message #484860] Fri, 03 December 2010 05:44 Go to next message
manirocks
Messages: 65
Registered: October 2007
Member
In oracle report how do we execute query2 if query1 doesnt retrived any records.

-- Manikanth
Re: How to execute Query 2 if Query 1 doesnt reterive anything [message #484862 is a reply to message #484860] Fri, 03 December 2010 05:54 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As far as I can tell:

- if they aren't linked, query 2 will be executed anyway
- if there is a link between those two queries, no way
Re: How to execute Query 2 if Query 1 doesnt reterive anything [message #484863 is a reply to message #484862] Fri, 03 December 2010 05:59 Go to previous messageGo to next message
manirocks
Messages: 65
Registered: October 2007
Member
There is no link between the two queries

my requirement in simple way is

if query 1 count = 0 then
execute query 2
end if

i know it doesnt work like this but to make the requirement understand i wrote like this

So any ideas how to get it

Thanks
Re: How to execute Query 2 if Query 1 doesnt reterive anything [message #484870 is a reply to message #484863] Fri, 03 December 2010 07:16 Go to previous messageGo to next message
chris32680
Messages: 92
Registered: January 2006
Location: Charlotte
Member
maybe for query 2:

select ....
from ...
where ...
  and 0 = (  select count(*)
             <query 1 logic here> )
/

Re: How to execute Query 2 if Query 1 doesnt reterive anything [message #484905 is a reply to message #484863] Fri, 03 December 2010 12:44 Go to previous message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
manikanth wrote on Fri, 03 December 2010 12:59

if query 1 count = 0 then 
   execute query 2
end if


Once again: if queries aren't linked, query 2 will be executed regardless of whether query 1 fetches anything or nothing.

Your IF-THEN-ELSE misses "else": what do you want to do "if query 1 count <> 0"?
Previous Topic: Add new field to an rtf
Next Topic: Exit Adobe report Oracle Application
Goto Forum:
  


Current Time: Fri Apr 19 10:44:48 CDT 2024