how to pass a NULL value to EXECUTE IMMEDIATE.
SQL>
SQL> CREATE TABLE MyTable (
2 num_col NUMBER,
3 char_col VARCHAR2(60)
4 );
Table created.
SQL>
SQL>
SQL> DECLARE
2 sqlString VARCHAR2(1000);
3 v_NullVar VARCHAR2(10);
4 BEGIN
5 sqlString :=
6 'INSERT INTO MyTable (num_col, char_col) VALUES
7 (:n, :c)';
8
9 EXECUTE IMMEDIATE sqlString USING 1, v_NulLVar;
10 END;
11 /
PL/SQL procedure successfully completed.
SQL>
SQL> drop table MyTable;
Table dropped.
SQL>
SQL>
Related examples in the same category