EXECUTE IMMEDIATE
You are viewing an old version of this article. View
the current version here.
MariaDB starting with 10.2.3
EXECUTE IMMEDIATE was introduced in MariaDB 10.2.3
Syntax
EXECUTE IMMEDIATE statement
Description
MariaDB supports the Oracle-style EXECUTE IMMEDIATE
. This immediately executes a dynamic SQL statement created on the fly, which can reduce performance overhead.
For example:
EXECUTE IMMEDIATE 'SELECT 1'
which is shorthand for:
prepare stmt from "select 1"; execute stmt; deallocate prepare stmt;
Another example:
DECLARE plsql_block VARCHAR2(500); new_deptid NUMBER(4); new_dname VARCHAR2(30) := 'Advertising'; new_mgrid NUMBER(6) := 200; new_locid NUMBER(4) := 1700; BEGIN -- Dynamic PL/SQL block invokes subprogram: plsql_block := 'BEGIN create_dept(:a, :b, :c, :d); END;'; /* Specify bind arguments in USING clause. Specify mode for first parameter. Modes of other parameters are correct by default. */ EXECUTE IMMEDIATE plsql_block USING IN OUT new_deptid, new_dname, new_mgrid, new_locid; END; /
Comments
Comments loading...
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.