You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/*
1. EXECUTE STATEMENT bug :
when the EXEC STAT retuns value(s)
and the INTO variable(s) is/are input parameter(s) of the STORED PROC
then the variable(s) do not get the expecterd value(s), but NULL
if the initial value(s) (value(s) before EXEC STAT) of the INTO variable(s) is/are NULL
tested on FB 1\.5\.4\., 1\.5\.5 : both version got the bug
tested on FB 2\.0\.3 : works fine, no bug
*/
CREATE OR ALTER PROCEDURE EXEC_STAT_TEST(
IN_TABLE_NAME CHAR(31),
IN_FIELD_NAME CHAR(31))
RETURNS (
OUT_TABLE_NAME CHAR(31),
OUT_FIELD_NAME CHAR(31))
AS
DECLARE VARIABLE tmp_table_name CHAR(31);
DECLARE VARIABLE tmp_field_name CHAR(31);
DECLARE VARIABLE sql VARCHAR(1000);
BEGIN
sql=
'SELECT FIRST 3 f.rdb$relation_name, f.rdb$field_name '||
'FROM rdb$relation_fields f '||
'WHERE UPPER(f.rdb$relation_name) STARTING WITH ''RDB$'' '||
'ORDER BY 1, 2';
FOR EXECUTE STATEMENT sql
INTO :in_table_name, :in_field_name
DO BEGIN
out_table_name=in_table_name;
out_field_name=in_field_name;
SUSPEND;
END
FOR EXECUTE STATEMENT sql
INTO :tmp_table_name, :tmp_field_name
DO BEGIN
out_table_name=tmp_table_name;
out_field_name=tmp_field_name;
SUSPEND;
END
FOR EXECUTE STATEMENT sql
INTO :out_table_name, :out_field_name
DO BEGIN
SUSPEND;
END
END
SELECT * FROM exec_stat_test(NULL,NULL);--1. EXEC STAT bug
SELECT * FROM exec_stat_test(NULL,'aaa');--1. EXEC STAT bug
SELECT * FROM exec_stat_test('aaa',NULL);--1. EXEC STAT bug
SELECT * FROM exec_stat_test('aaa','aaa');--only this time get the expected result
The text was updated successfully, but these errors were encountered:
Submitted by: Attila Molnár (e_pluribus_unum)
/*
1. EXECUTE STATEMENT bug :
when the EXEC STAT retuns value(s)
and the INTO variable(s) is/are input parameter(s) of the STORED PROC
then the variable(s) do not get the expecterd value(s), but NULL
if the initial value(s) (value(s) before EXEC STAT) of the INTO variable(s) is/are NULL
*/
CREATE OR ALTER PROCEDURE EXEC_STAT_TEST(
IN_TABLE_NAME CHAR(31),
IN_FIELD_NAME CHAR(31))
RETURNS (
OUT_TABLE_NAME CHAR(31),
OUT_FIELD_NAME CHAR(31))
AS
DECLARE VARIABLE tmp_table_name CHAR(31);
DECLARE VARIABLE tmp_field_name CHAR(31);
DECLARE VARIABLE sql VARCHAR(1000);
BEGIN
sql=
'SELECT FIRST 3 f.rdb$relation_name, f.rdb$field_name '||
'FROM rdb$relation_fields f '||
'WHERE UPPER(f.rdb$relation_name) STARTING WITH ''RDB$'' '||
'ORDER BY 1, 2';
FOR EXECUTE STATEMENT sql
INTO :in_table_name, :in_field_name
DO BEGIN
out_table_name=in_table_name;
out_field_name=in_field_name;
SUSPEND;
END
FOR EXECUTE STATEMENT sql
INTO :tmp_table_name, :tmp_field_name
DO BEGIN
out_table_name=tmp_table_name;
out_field_name=tmp_field_name;
SUSPEND;
END
FOR EXECUTE STATEMENT sql
INTO :out_table_name, :out_field_name
DO BEGIN
SUSPEND;
END
END
SELECT * FROM exec_stat_test(NULL,NULL);--1. EXEC STAT bug
SELECT * FROM exec_stat_test(NULL,'aaa');--1. EXEC STAT bug
SELECT * FROM exec_stat_test('aaa',NULL);--1. EXEC STAT bug
SELECT * FROM exec_stat_test('aaa','aaa');--only this time get the expected result
The text was updated successfully, but these errors were encountered: