1 2 Previous Next 18 Replies Latest reply: May 22, 2012 2:33 AM by redologger RSS

    =  operator on varchar , comparison

    redologger
      hi guys, having problem using the = operator.
      SET SERVEROUTPUT ON;
      WHENEVER SQLERROR EXIT SQL.SQLCODE
      
      DECLARE
      -- Define DB name to execute on
      
      DB_Name V$instance.instance_name%type;
      
      EXECUTION_NAME varchar2(20) := 'Production';
      
      BEGIN
      select instance_Name into DB_NAME from v$instance;
      
        IF (upper(DB_NAME) = upper(EXECUTION_NAME)) THEN
        
          RAISE_APPLICATION_ERROR(-20001,'Check DB NAME');
        ELSE
        DBMS_OUTPUT.PUT_LINE('Proceeding with execution');
      
        END IF;
      END;
      /
      WHENEVER SQLERROR CONTINUE
      i have log into let say db name UAT, but the = operator doesn't seem to take into effect. Is a varchar() value so not sure is there a way to use = correctly.
        1 2 Previous Next