If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > nvl2 in 8.1.7.3.0

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-22-02, 16:05
EdwardP EdwardP is offline
Registered User
 
Join Date: Jan 2002
Location: Toronto
Posts: 21
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
Reply With Quote
  #2 (permalink)  
Old 03-23-02, 05:14
alligatorsql.com alligatorsql.com is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 04-01-02, 18:58
Todd Barry Todd Barry is offline
Registered User
 
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;
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On