Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004

    Unanswered: How to initialize a variable in the sql*plus prompt ?

    I am writing this mail after a long disappointment .I tried to declare and initialize a variable in the sql> prompt in this way -
    SQL> variable empno number

    Then I tried to initialize it with 500 .But I couldn't .I could do it with 'accept' but it's not getting displayed in the print
    SQL> print empno

    Accept actually making it char instead of number;

    Can you please help me out - I have searched for a long time in the whole internet - but couldn't find it out !!!

    So in summary I want to declare and initialize a variable and then want to get it printed by 'print' .

    Thanks in advance ....
    Nirmalya Sinha

  2. #2
    Join Date
    May 2004
    Dominican Republic
    The reason is not working to you is becase using the ACCEPT commands you can only reference this values within SQL*Plus scripts, with the amp (&).

    You should try something like:
    SQL> exec :empno := 2323;
    So you can use print to print its value.

Posting Permissions

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