"no current record for fetch operation" when table inner join procedure inner 
join table 
-----------------------------------------------------------------------------------------

                 Key: CORE-4344
                 URL: http://tracker.firebirdsql.org/browse/CORE-4344
             Project: Firebird Core
          Issue Type: Bug
    Affects Versions: 3.0 Alpha 2
         Environment: isql
            Reporter: Simonov Denis


SET SQL DIALECT 3;

SET NAMES WIN1251;

CREATE DATABASE 'localhost:d:\fb\fb30\data\test.fdb'
USER 'SYSDBA' PASSWORD 'masterkey'
PAGE_SIZE 16384
DEFAULT CHARACTER SET WIN1251;


CREATE TABLE T (
    ID  INTEGER NOT NULL,
    A   INTEGER,
    B   INTEGER
);


INSERT INTO T (ID, A, B) VALUES (1, 2, 3);
INSERT INTO T (ID, A, B) VALUES (2, 1, 3);
INSERT INTO T (ID, A, B) VALUES (3, 3, 2);

COMMIT WORK;


ALTER TABLE T ADD PRIMARY KEY (ID);


SET TERM ^ ;

CREATE PROCEDURE MYPROC (
    A INTEGER,
    C INTEGER)
RETURNS (
    B INTEGER)
AS
begin
  b = a + c;
  suspend;
end^

SET TERM ; ^

SQL> select t3.*
CON> from t t1
CON> join t t2 on t1.id = t2.a
CON> left join myproc(t1.a, t2.a) p on 1=1
CON> join t t3 on p.b = t3.b;

          ID            A            B
============ ============ ============
           1            2            3
           1            2            3
           2            1            3
           2            1            3

SQL> select t3.*
CON> from t t1
CON> join t t2 on t1.id = t2.a
CON> join myproc(t1.a, t2.a) p on 1=1
CON> join t t3 on p.b = t3.b;

          ID            A            B
============ ============ ============
Statement failed, SQLSTATE = 22000
no current record for fetch operation                                <-- Why?
SQL> select p.*
CON> from t t1
CON> join t t2 on t1.id = t2.a
CON> join myproc(t1.a, t2.a) p on 1=1;

           B
============
           3
           3
           6

-- 
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

        

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to