Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Passing in NULL via SQL ACCEPT

RE: Passing in NULL via SQL ACCEPT

From: Magaliff, Bill <Bill.Magaliff_at_lendware.com>
Date: Thu, 14 Mar 2002 06:13:30 -0800
Message-ID: <F001.00429130.20020314061330@fatcity.com>


thanks

can you explain a bit more about the use of new_value? Exactly where and when it can be used? I know it's used for TTITLE but why do I need it here? Can't I just reference &&c_myvar in the PL/SQL block?

-----Original Message-----
Sent: Wed, March 13, 2002 1:16 PM
To: ORACLE-L_at_fatcity.com
Cc: Bill.Magaliff_at_lendware.com

Don't use ACCEPT

e.g.

col c_myvar noprint new_value u_myvar

prompt Please enter value for myvar:
set term off feed off
select '&&1' c_myvar from dual;
set term on feed on

begin

   if '&&u_myvar' is null then

      dbms_output.put_line('myvar is null');    else

      dbms_output.put_line('myvar is &&u_myvar');    end if;

end;
/

undef 1

Jared

"Magaliff, Bill" <Bill.Magaliff_at_lendware.com> Sent by: root_at_fatcity.com
03/13/02 06:43 AM
Please respond to ORACLE-L  

        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
        cc: 
        Subject:        Passing in NULL via SQL ACCEPT


I'm writing an anonymous PL/SQL block that accepts various input from SQL*Plus via ACCEPT commands. I then take the SQL input and use it in the block, usually by assigning it to a PL/SQL variable.

If no value is specified on the ACCEPT line, it appears that nothing is passed into PL/SQL, not even NULL. I tried using NVL(&&variable,0) to reassign the supposed NULL to a 0, but the program returns an error that nothing exists in place of &&variable.

Any ideas how to catch this null, which I want to be a viable option (e.g.,
if the &&varible is NULL then perform certain operations).

Thanks much
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Magaliff, Bill
  INET: Bill.Magaliff_at_lendware.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Magaliff, Bill
  INET: Bill.Magaliff_at_lendware.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Mar 14 2002 - 08:13:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US