Using if condition to generate reports [message #483208] |
Fri, 19 November 2010 03:57 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 #483220 is a reply to message #483217] |
Fri, 19 November 2010 04:33 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
sowjanyam wrote on Fri, 19 November 2010 11:15in 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.
|
|
|