DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003

    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 !

  2. #2
    Join Date
    Jan 2002
    Up s**t creek
    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' 
      DEFAULT '&curdate' 
      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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.