-
Using sysdate as default in PROMPT and ACCEPT
Hi I am running the following SQL script in sqlPlus
ACCEPT g_TXN_Date date format 'dd/mm/yyyy' PROMPT 'Enter Start Date (leave blank FOR today): ' default sysdate
select TO_CHAR(TO_DATE('&g_TXN_Date'), 'DD/MM/YYYY') from dual
/
The idea is the user can only specify a date but if they don't specify anything then the current date is selected.
I get errors
Enter value for g_txn_date:
old 1: select TO_CHAR(TO_DATE(&g_TXN_Date), 'DD/MM/YYYY') from dual
new 1: select TO_CHAR(TO_DATE(), 'DD/MM/YYYY') from dual
select TO_CHAR(TO_DATE(), 'DD/MM/YYYY') from dual
*
ERROR at line 1:
ORA-00938: not enough arguments for function
Any help would be great !
-
You'll need to do something similar to the following:
Code:
COLUMN date1 new_value curdate NOPRINT
SELECT sysdate date1 FROM dual;
ACCEPT g_TXN_Date DATE FORMAT 'dd/mm/yyyy'
DEFAULT '&curdate'
PROMPT 'Enter the date (DD/MM/YYYY): '
Regards
Last edited by jovery; 02-24-2003 at 11:21 AM.
Jim
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|