Home » Developer & Programmer » Reports & Discoverer » Using if condition to generate reports (Oracle 10g)
Using if condition to generate reports [message #483208] Fri, 19 November 2010 03:57 Go to next message
sowjanyam
Messages: 2
Registered: November 2010
Junior Member
hi,
I need to generate reports in oracle.I want to use if condition in the query.but I'm unable to use if condition in query.how can i use if condition?is there any other method to do this?can any one help me?
Re: Using if condition to generate reports [message #483212 is a reply to message #483208] Fri, 19 November 2010 04:05 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It is kind of difficult to answer because information you provided is ... well, poor. Until you come up with a better explanation, all I can think of is use of DECODE and/or CASE.
Re: Using if condition to generate reports [message #483217 is a reply to message #483212] Fri, 19 November 2010 04:15 Go to previous messageGo to next message
sowjanyam
Messages: 2
Registered: November 2010
Junior Member
hi Littlefoot,
thanks for your rply.Actually in my query i need to check one condition and based on that I need to use "where" condition.
Re: Using if condition to generate reports [message #483218 is a reply to message #483217] Fri, 19 November 2010 04:21 Go to previous messageGo to next message
ramoradba
Messages: 2456
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
"It is kind of difficult to answer because information you provided is ... well, poor. "
L.foot already given you the clue DECODE/CASE
So please come back here once you find any difficulty with that
Re: Using if condition to generate reports [message #483220 is a reply to message #483217] Fri, 19 November 2010 04:33 Go to previous message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
sowjanyam wrote on Fri, 19 November 2010 11:15
in my query i need to check one condition and based on that I need to use "where" condition.

That sounds as if you could benefit from using a lexical parameter. It makes it possible to create a "dynamic" WHERE condition. Query looks like this:
select col1, col2
from some_table
where col3 = :par_some_value
  &lex_parameter

Lexical parameter can be set in, for example, After Parameter Form trigger. As it is PL/SQL code, there you can really use IF:
begin
  if :par_deptno = 10 then
     :lex_parameter := ' and sal < 3000';
  else
     :lex_parameter := ' and sal >= 3000';
  end if;
end;

Read more about lexical parameters in Reports Online Help System; you'll find out whether they satisfy your needs or not.

Do come back if you have further questions - we'll try to answer.
Previous Topic: 10g reports
Next Topic: Moving fields in oracle reports
Goto Forum:
  


Current Time: Sat Apr 20 11:11:47 CDT 2024