Error reuse reference cursor if one of the query field is computed using a 
subquery
-----------------------------------------------------------------------------------

                 Key: CORE-5373
                 URL: http://tracker.firebirdsql.org/browse/CORE-5373
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 3.0.1
            Reporter: Simonov Denis


SET SQL DIALECT 3;


SET TERM ^ ;

CREATE PROCEDURE SP_TESP
RETURNS (
    RESULT SMALLINT)
AS
BEGIN
  SUSPEND;
END^

SET TERM ; ^


CREATE TABLE TEST (
    ID  SMALLINT
);


SET TERM ^ ;

ALTER PROCEDURE SP_TESP
RETURNS (
    RESULT SMALLINT)
AS
begin
  result = 0;
  for select t.id,(select t.id+1 from rdb$database) as id_1
        from test t
  as cursor c
  do begin
    if (c.id_1 between 0 and 1) then result=1;
--    if (c.id_1 between 2 and 3) then result=2; -- If uncommented error occurs.
  end

  suspend;

end^


SET TERM ; ^

COMMIT WORK;

If you uncomment the line indicated, the error occurs when compiling procedure: 
Unsuccessful execution caused by system error that does not preclude successful 
of subsequent statements. Error while parsing procedure SP_TEST`s BLR. invalid 
request BLR at offset 181. context already in use (BLR error).

The reason to use a subquery (select t.id + 1 from rdb$database), if you remove 
it or replace the function of error disappears.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to