Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009
    Posts
    12

    Unanswered: Can't prompt for letters, only numbers

    I can use PLSQL command Prompt to get user input, but only numbers. If I type in text at the prompt, I get an error. But I need text, and there does not seem to be a way to tell Prompt to accept it. Any ideas?

    This is the start of the program:

    ACCEPT p_txt VARCHAR2(100) PROMPT 'Please enter the text:';
    ACCEPT p_pat VARCHAR2(100) PROMPT 'Please enter the pattern:';

    declare
    v_txt VARCHAR2(100) := &p_txt;
    v_pat VARCHAR2(100) := &p_pat;

    begin
    DBMS_OUTPUT.PUT_LINE(v_txt || v_pat);
    end;

    And this is the error I get when I enter letters at the prompt. I suspect it's how I am assigning to the variables. But I can't find an example:

    Error starting at line 5 in command:
    declare
    v_txt VARCHAR2(100) := &p_txt;
    v_pat VARCHAR2(100) := &p_pat;

    begin
    DBMS_OUTPUT.PUT_LINE(v_txt || v_pat);
    end;

    Error report:
    ORA-06550: line 2, column 24:
    PLS-00201: identifier 'EEE' must be declared
    ORA-06550: line 2, column 7:
    PL/SQL: Item ignored
    ORA-06550: line 3, column 24:
    PLS-00201: identifier 'ERT' must be declared
    ORA-06550: line 3, column 7:
    PL/SQL: Item ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause: Usually a PL/SQL compilation error.
    *Action:

  2. #2
    Join Date
    Dec 2007
    Posts
    253
    Text goes in apostrophes: '&p_txt'

  3. #3
    Join Date
    Sep 2009
    Posts
    12
    Yes, that works. Thank you

Posting Permissions

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