Automatic Value Passing to WHERE Clause... [message #387077] |
Tue, 17 February 2009 19:48 |
aimy
Messages: 225 Registered: June 2006
|
Senior Member |
|
|
How could I extend this sql statement in such a way that it will automatically pass the current date to the where clause if the prompt value was set to NULL?
SELECT
START_TIME , END_TIME , PROCEDURE_NAME , TABLE_NAME , ROWS_INSERTED "INSERTED" , ROWS_UPDATED "UPDATED" ,
ROWS_DELETED "DELETED" , ROWS_INSERTED_OF_DELETION "INS_OF_DEL" , ROWS_INSERTED_AFTER_DELETION "INS_AFT_DEL" ,
ROWS_REJECTED "REJECTED" , ELAPSE_TIME , -- REMARKS ,
case when SUBJECT_AREA = 'SERVICE PROFILE, SERVICE PROFILE CHARGES' then 'SRV PRO'||' & '||'CHG'
else SUBJECT_AREA end SUBJECT_AREA
FROM PROCEDURE_TRACKING_LOG
where
to_char(START_TIME, 'DD/MM/YY') = '&date'
ORDER BY START_TIME;
Thank you very much.
|
|
|
|
|
|
|
Re: Automatic Value Passing to WHERE Clause... [message #387084 is a reply to message #387081] |
Tue, 17 February 2009 20:40 |
aimy
Messages: 225 Registered: June 2006
|
Senior Member |
|
|
BlackSwan wrote on Wed, 18 February 2009 10:11 | You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you
What Operating System (OS) name & version?
What Oracle version to 4 decimal places.
>if the prompt value was set to NULL?
You question implies you are using sqlplus as the application user interface. BAD idea!
If the user inputs 03/04/05, what date did the USER mean?
2003-Apr-05
2005-Mar-04
2005-Apr-03
Keep in mind you can NOT control what the user enters!
When you intend to compare DATE you should be using TO_DATE!
>such a way that it will automatically pass the current date
You'll need to do this at the OS level.
|
Anyway, at least you've got some points there which I've been overlooked all this while.
Thank you.
|
|
|