This is because SQLPlus does the substitution before executing the block, and thus the entered value is inserted into the code as a literal, not as a bind variable.
eg, accept x prompt 'Enter x:' begin if &&x = 2 then do_something; end if; end; If the user enters 100, then the block becomes: begin if 100 = 2 then do_something; end if; end; However, if the user doesn't enter anything, x is replaced with nothing, leaving the block as: begin if = 2 then do_something; end if; end; which produces an execution error. One way around this is to ensure there's always a correct argument in that position, eg: begin if '&&x' = '2' then do_something; end if; end; For null entry, this would give: begin if '' = '2' then do_something; end if; end; which works. HTH -a >>> [EMAIL PROTECTED] 14/3/2002 1:43:24 >>> This message has been scanned by MAILSweeper. ************************************************************ 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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). ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Arn Klammer INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).