Results 1 to 4 of 4

Thread: pl sql issue

  1. #1
    Join Date
    Jan 2010
    Posts
    64

    Unanswered: pl sql issue

    Hi,

    Please find the code fragment :-


    BEGIN
    accept f1
    accept f2

    select 'Y' from dual
    where upper('&f2') not like upper('%&f1%');
    END

    It is throwing error which i am not able to understand. I havent used declare section as the accept creates a char variable by default.

    please advise !!
    Last edited by subhotech; 11-26-10 at 05:37. Reason: typo

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    And the error is?

  3. #3
    Join Date
    Jan 2010
    Posts
    64
    Bind variable not declared

  4. #4
    Join Date
    Mar 2007
    Posts
    623
    Hi,

    whenever you are using any command, please check, whether it is valid for the language of current code. It is stated in Oracle documentation book, available e.g. online on http://tahiti.oracle.com/

    ACCEPT is sqlplus (client tool) command
    BEGIN END; is part of PL/SQL language, it cannot interpret sqlplus commands. The main (logical) reason is, that it runs on database side and does not care from where it is called. Can you imagine, how should that ACCEPT behave if called e.g. from JDBC?

    By the way, LIKE is valid operator in PL/SQL too - you do not need to call SQL query for this. On the other hand, SELECT cannot be called like this in PL/SQL - it requires INTO clause. What are you trying to achieve?

    [Edit: finished the incomplete sentence in second paragraph]
    Last edited by flyboy; 11-26-10 at 06:03.

Posting Permissions

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