Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Location
    Toronto
    Posts
    21

    Unanswered: nvl2 in 8.1.7.3.0

    Hello everyone,

    Could you explain the following?

    There is no problem here:
    SQL> select nvl2(null,1,2) from dual;

    NVL2(NULL,1,2)
    --------------
    2

    And I get this here:

    SQL> begin
    2 dbms_output.put_line(nvl2(null,1,2));
    3 end;
    4 /
    dbms_output.put_line(nvl2(null,1,2));
    *
    ERROR at line 2:
    ORA-06550: line 2, column 23:
    PLS-00201: identifier 'NVL2' must be declared
    ORA-06550: line 2, column 2:
    PL/SQL: Statement ignored

    Thanks in advance.
    Edward

  2. #2
    Join Date
    Jul 2001
    Location
    Germany
    Posts
    189
    Hello,

    I am not sure, but could it be, that you have to use the schema name before the function name ?

    something like dbms_output.put_line(TO_CHAR(user.nvl2(null, 1, 2));

    Hope this helps ?

    Greetings

    Manfred Peter
    (Alligator Company)
    http://www.alligatorsql.com

  3. #3
    Join Date
    Sep 2001
    Posts
    1
    Until 9i, PL/SQL does not support all of the SQL functions and syntax (including features such as analytic functions, CAST, and others).

    But, you can use NVL2 in PL/SQL by executing it as dynamic SQL:

    Code:
    declare
      x  integer;
    begin
      execute immediate 'select nvl2(null, 1, 2) from dual' into x;
      dbms_output.put_line( x );
    end;

Posting Permissions

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