0 Replies Latest reply: Dec 4, 2012 3:26 AM by berx RSS

    Variable not replaced with value in special condition

    berx
      I found a little difference between the behavior of sqldeveloper (3.2.20.09.87) and sqlplus.
      Please use this script:
      -- sn.sql
      -- run @sn.sql 1
      
      define   snapper_sleep="&1"
      set serveroutput on
       
      select &snapper_sleep from dual; 
       
      exec dbms_output.put_line( &snapper_sleep ); 
      exec dbms_output.put_line('-- &snapper_sleep --'); 
      exec dbms_output.put_line('-'||'- &snapper_sleep --'); 
      
      undefine  snapper_sleep
      in sqlplus the output is
      SQL> @sn.sql 1
      old   1: select &snapper_sleep from dual
      new   1: select 1 from dual
      
            1
      ----------
            1
      
      1
      
      PL/SQL procedure successfully completed.
      
      -- 1 --
      
      PL/SQL procedure successfully completed.
      
      -- 1 --
      
      PL/SQL procedure successfully completed.
      in sqldeveloper it is
               1
      ----------
               1 
      
      anonymous block completed
      1
      
      anonymous block completed
      -- &snapper_sleep --
      
      anonymous block completed
      -- 1 --
      Can someone please confirm the differences?
      I'd say sqldeveloper is sometimes confused by the '-- which is NO comment in my testcase.