Issue Details (XML | Word | Printable)

Key: CORE-3296
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dmitry Yemanov
Reporter: Karol Bieniaszewski
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Error "context already in use" for the simple case function with a sub-select operand

Created: 28/Dec/10 01:24 PM   Updated: 24/May/11 08:28 AM
Component/s: Engine
Affects Version/s: 2.1.3, 2.1.4
Fix Version/s: 2.1.5

Time Tracking:
Not Specified

Issue Links:
Relate
 

Planning Status: Unspecified


 Description  « Hide
CREATE TABLE VAT_ZAK
(
  ID Integer NOT NULL,
  SYS_NR Integer,
  CONSTRAINT PK_VAT_ZAK__ID PRIMARY KEY (ID)
);

CREATE TABLE ELEMENTY
(
   ID Integer NOT NULL,
  ID_VAT_SPRZ Integer,
CONSTRAINT PK_ELEMENTY__ID PRIMARY KEY (ID)
);



UPDATE
ELEMENTY E
SET
E.ID_VAT_SPRZ=
CASE
(SELECT V.SYS_NR FROM VAT_ZAK V WHERE V.ID=E.ID_VAT_SPRZ)
WHEN 1 THEN (SELECT V.ID FROM VAT_ZAK V WHERE V.SYS_NR=7)
WHEN 2 THEN (SELECT V.ID FROM VAT_ZAK V WHERE V.SYS_NR=8)
WHEN 3 THEN (SELECT V.ID FROM VAT_ZAK V WHERE V.SYS_NR=9)
ELSE E.ID_VAT_SPRZ END


Engine Code : 335544343
Engine Message :
invalid request BLR at offset 95
context already in use (BLR error)



but this form of case statement work

UPDATE
ELEMENTY E
SET
E.ID_VAT=
CASE
 
WHEN (SELECT V.SYS_NR FROM VAT_ZAK V WHERE V.ID=E.ID_VAT) = 1 THEN (SELECT V.ID FROM VAT_ZAK V WHERE V.SYS_NR=7)
WHEN (SELECT V.SYS_NR FROM VAT_ZAK V WHERE V.ID=E.ID_VAT) = 2 THEN (SELECT V.ID FROM VAT_ZAK V WHERE V.SYS_NR=8)
WHEN (SELECT V.SYS_NR FROM VAT_ZAK V WHERE V.ID=E.ID_VAT) = 3 THEN (SELECT V.ID FROM VAT_ZAK V WHERE V.SYS_NR=9)
ELSE E.ID_VAT END


 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dmitry Yemanov added a comment - 02/Feb/11 12:54 PM
Fixed for v2.1.5. More recent FB versions (2.5 and 3.0) already have this issue fixed.