Quelle sp-cursor-dynamic-debug.result
Sprache: Lisp
#
# MDEV-33830 Support for cursors on prepared statements
#
#
# Without USING clause
#
# SQL Standard style: DECLARE c FOR stmt; OPEN c;
CREATE PROCEDURE p1()
BEGIN
DECLARE c0 CURSOR FOR stmt0;
PREPARE stmt0 FROM 'SELECT 1,2,3';
OPEN c0;
CLOSE c0;
END;
$$
SHOW PROCEDURE CODE p1;
Pos Instruction 0 cpush c0@0 for stmt0 1 stmt 96"PREPARE stmt0 FROM 'SELECT 1,2,3'" 2 copen c0@0 3 cclose c0@0 4 cpop 1
CALL p1;
DROP PROCEDURE p1;
# Oracle style #1: OPEN c FOR dynamic_string
CREATE PROCEDURE p1()
BEGIN
DECLARE c0 SYS_REFCURSOR;
OPEN c0 FOR 'SELECT 1,2,3';
CLOSE c0;
END;
$$
SHOW PROCEDURE CODE p1;
Pos Instruction 0set c0@0 NULL 1 copen STMT.cursor[c0@0] 2 cclose STMT.cursor[c0@0] 3 destruct sys_refcursor c0@0
CALL p1;
DROP PROCEDURE p1;
# Oracle style #2: OPEN c FOR select_statement
CREATE PROCEDURE p1()
BEGIN
DECLARE c0 SYS_REFCURSOR;
OPEN c0 FOR SELECT 1,2,3;
CLOSE c0;
END;
$$
SHOW PROCEDURE CODE p1;
Pos Instruction 0set c0@0 NULL 1 copen STMT.cursor[c0@0] 2 cclose STMT.cursor[c0@0] 3 destruct sys_refcursor c0@0
CALL p1;
DROP PROCEDURE p1;
#
# With USING clause
#
# SQL Standard style: DECLARE c FOR stmt; OPEN c USING..;
CREATE PROCEDURE p1()
BEGIN
DECLARE c0 CURSOR FOR stmt0;
PREPARE stmt0 FROM 'SELECT 1,2,3 FROM DUAL WHERE ?+?+?>0';
OPEN c0 USING 1,2,3;
CLOSE c0;
DEALLOCATE PREPARE stmt0;
END;
$$
SHOW PROCEDURE CODE p1;
Pos Instruction 0 cpush c0@0 for stmt0 1 stmt 96"PREPARE stmt0 FROM 'SELECT 1,2,3 FROM..." 2set c0@0.using[0] 1 3set c0@0.using[1] 2 4set c0@0.using[2] 3 5 copen c0@0 6 cclose c0@0 7 stmt 98"DEALLOCATE PREPARE stmt0" 8 cpop 1
CALL p1;
DROP PROCEDURE p1;
# Oracle style #1: OPEN c FOR dynamic_string USING..;
CREATE PROCEDURE p1()
BEGIN
DECLARE c0 SYS_REFCURSOR;
OPEN c0 FOR 'SELECT 1,2,3 FROM DUAL WHERE ?+?+?>0' USING 1,2,3;
CLOSE c0;
END;
$$
SHOW PROCEDURE CODE p1;
Pos Instruction 0set c0@0 NULL 1set STMT.cursor[c0@0].using[0] 1 2set STMT.cursor[c0@0].using[1] 2 3set STMT.cursor[c0@0].using[2] 3 4 copen STMT.cursor[c0@0] 5 cclose STMT.cursor[c0@0] 6 destruct sys_refcursor c0@0
CALL p1;
DROP PROCEDURE p1;
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.