EXECUTE v14

The EXECUTE function executes a parsed SQL command or SPL block.

<status> INTEGER EXECUTE(<c> NUMBER)

Parameters

c

Cursor ID of the parsed SQL command or SPL block to execute.

status

Number of rows processed if the SQL command was DELETE, INSERT, or UPDATE. status is meaningless for all other commands.

Examples

The following anonymous block inserts a row into the dept table.

DECLARE
    curid           NUMBER;
    v_sql           VARCHAR2(50);
    v_status        INTEGER;
BEGIN
    curid := DBMS_SQL.OPEN_CURSOR;
    v_sql := 'INSERT INTO dept VALUES (50, ''HR'', ''LOS ANGELES'')';
    DBMS_SQL.PARSE(curid, v_sql, DBMS_SQL.native);
    v_status := DBMS_SQL.EXECUTE(curid);
    DBMS_OUTPUT.PUT_LINE('Number of rows processed: ' || v_status);
    DBMS_SQL.CLOSE_CURSOR(curid);
END;