Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Statements
 

Understanding bind variable types

Bind variables can be of type IN, OUT, or IN OUT. By default, all parameters are of type IN. Using an OUT Parameter SQL> declare   2     a NUMBER;   3     b NUMBER:=1;   4     c NUMBER:=2;   5     v_plsql_tx VARCHAR2(2000);   6  begin   7      v_plsql_tx := 'begin ' || ':1:=:2 -:3; ' || 'end;';   8      execute immediate v_plsql_tx using out a, b, c;   9      DBMS_OUTPUT.put_line('a='||a);  10  end;  11  / a=-1 PL/SQL procedure successfully completed. SQL>