Run query based on parameter [message #396737] |
Tue, 07 April 2009 22:19 |
smittal17
Messages: 7 Registered: March 2009
|
Junior Member |
|
|
Hi,
I have to run query in which select parameters are same but only one condition differs which is based on parameter.If the parameter is "ALL" then I have to run query for all values but if it's a particular "Name" then run query based on that.
So is there any way of identifying parameter in query,Something like case can help achieving this ?Plz help.
My Schema log is
ID NUMBER(2),
NAME VARCHAR2(60),
ALARMRAISED DATE,
ALARMCLEARED DATE
SO,I have to run query,if it is "ALL"
select * from log ;
if it is some name then
selct * from log where name='abc';
How should I achieve this in one ?
Shilpa
|
|
|
|
Re: Run query based on parameter [message #396744 is a reply to message #396737] |
Tue, 07 April 2009 22:57 |
smittal17
Messages: 7 Registered: March 2009
|
Junior Member |
|
|
The value of parameter is selected by USER ,it can be "All" or any name .The query is any simple query only the search criteria is different.The point is that both of the things can be done through one query?
|
|
|
|
|
|
|
|
Re: Run query based on parameter [message #402462 is a reply to message #402412] |
Sun, 10 May 2009 19:59 |
|
Kevin Meade
Messages: 2103 Registered: December 1999 Location: Connecticut USA
|
Senior Member |
|
|
Thanks for clarifying. I just took it for granted that there would not be a department_name of ALL.
Also, I admit to using the term MANUALLY PARTITIONED a bit loosely here. The key from a performance perspective is that the queries of the view have WHERE clauses that offer Oracle some way to prune parts of the query away before doing its actual execution. This pruning does not have to be symmetrical or exclusive.
Kevin
[Updated on: Sun, 10 May 2009 20:02] Report message to a moderator
|
|
|