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:
COLUMN date1 new_value curdate NOPRINT
SELECT sysdate date1 FROM dual;
ACCEPT g_TXN_Date DATE FORMAT 'dd/mm/yyyy'
PROMPT 'Enter the date (DD/MM/YYYY): '
Last edited by jovery; 02-24-2003 at 10:21 AM.
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!
Click Here to Expand Forum to Full Width