Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    113

    Unanswered: to_date function

    What does this mean?

    select to_date('&1', 'MM/DD/YYYY') into v_start_date from dual;
    select (to_date('&2', 'MM/DD/YYYY')+1) into v_end_date from dual;

    I am mainly asking about the:

    select to_date('&1',

    What does the '&1' mean?

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    These are SQL Plus "substitution variables". In a SQL Plus script, these take the values passed as parameters after the script name, e.g.:

    SQL> @myscript aaa bbb

    This will set &1 to aaa and &2 to bbb

    These are then simply "searched and replaced" in the script.

  3. #3
    Join Date
    Nov 2003
    Posts
    65

    In addition

    Just to add to Andrew's reply the dual part you see in the sql statement refers to a dummy table in Oracle.
    You can select anything from dual just to test you sql or conversion statements like your exampl shows.

Posting Permissions

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