Assign a value to a variable of type boolean. Don't use quotes around the value like this : Boolean « Data Type « Oracle PL / SQL






Assign a value to a variable of type boolean. Don't use quotes around the value like this

   
SQL>
SQL> DECLARE
  2     v_boolean BOOLEAN;
  3  BEGIN
  4     v_boolean := 'TRUE';
  5  END;
  6  /
   v_boolean := 'TRUE';
                *
ERROR at line 4:
ORA-04045: errors during recompilation/revalidation of JAVA2S.LOG_ERRORS
ORA-01031: insufficient privileges
ORA-06550: line 4, column 17:
PLS-00382: expression is of wrong type
ORA-06550: line 4, column 4:
PL/SQL: Statement ignored


SQL>
SQL>
SQL> -- Instead, do this
SQL>
SQL> DECLARE
  2     v_boolean BOOLEAN;
  3  BEGIN
  4     v_boolean := TRUE;
  5  END;
  6  /

PL/SQL procedure successfully completed.

   
    
    
  








Related examples in the same category

1.PL/SQL BOOLEAN datatypes accept only TRUE, FALSE, NULL
2.Define and use boolean value
3.Boolean data type with If statement
4.Use the NVL() against a non-initialized BOOLEAN variable:
5.Boolean literals
6.Boolean expressions in where clause