Icon View Incident Report

Minor Minor
Reported By: Suzanne Nuss
Reported On: 12/2/2012
For: Version 2.11 Build 2
# 3685 Interval and Integer Comparisons in Join Conditions Can Cause Value Conversion Error if Join Flipped

If I use parameters in a simple query, it works fine.
If I put values into the query (instead of parameters), the query runs fine both in ElevateDB Manager and within the application.

If I try to use the parameter structure in the app, the query fails with with the error:

ElevateDB Error #1011 An error occurred with the value -6 (A conversion error occurred)

This error appears with any parameter (ie. I ran through the combinations of having each of the variables as the sole parameters & filling the others in.

Select EVSMaster.*
From EVSMaster
Join Client
On (EVSMaster.Client_ID = Client.Client_ID)
Join ClientProgram
On (EVSMaster.Client_ID = ClientProgram.Client_ID)
Left Outer Join ProgramType
On (ClientProgram.ProgramType_Key = ProgramType.ProgramType_Key)
Left Outer Join ProgramLocation
On (ClientProgram.Location_Key = ProgramLocation.Location_Key)
Where EVSMaster_ID in
(Select X.EVSMaster_ID From
(Select EVSDetail.EVSMaster_ID,EVSDetail.Change, EVSDetail.TypeOfCoverage,
        Count(TypeOfCoverage) As RecordCount
  From EVSDetail
  where (EVSDetail.EVSMaster_ID In
   (Select  EVSDetail.EVSMaster_ID
    From EVSDates
    Join EVSMaster
    On  (EVSMaster.Batch_ID = EVSDates.Batch_ID)
    Join EVSDetail
    On  (EVSMaster.EVSMaster_ID = EVSDetail.EVSMaster_ID)
    and (EVSDetail.Change ='Loss')
    and (EVSDetail.TypeOfCoverage = 'MC')
    Join Client
    On  (EVSMaster.Client_ID = Client.Client_ID)
    Join ClientProgram
    On (Client.Client_ID = ClientProgram.Client_ID)
    and ((EVSDates.ServiceDateEnd - ClientProgram.AdmissionDate) DAY > 1)
    and ((ClientProgram.DischargeDate IS Null)
    or  ((ClientProgram.DischargeDate > EVSDates.ServiceDateStart)
    and ((EVSDates.ServiceDateEnd-ClientProgram.DischargeDate) MONTH between 0 and 1) ) )
    Where ((EVSDates.ServiceDateStart = :ServiceDateStart)
    and   (EVSDates.Current=True)
    and   (ClientProgram.ProgramType_Key = :ProgramType_Key)
    and   (ClientProgram.Location_Key = :Location_Key) )))
    and   (EVSDetail.TypeOfCoverage = 'MC')
    Group By EVSMaster_ID
    Order By EVSMaster_ID) X
Where (X.RecordCount = 1)
and   (X.Change = 'Loss')
Group By X.EVSMaster_ID
Order By X.EVSMaster_ID)
Group By EVSMaster.EVSMaster_ID, ClientProgram.ProgramType_Key,Client_ID



Comments Comments and Workarounds
The issue was this join condition:

and ((EVSDates.ServiceDateEnd - ClientProgram.AdmissionDate) DAY > 1)

when the joins were optimized and the join condition was flipped, the resulting comparison wasn't being handled correctly by EDB.

The workaround was to use an explicit interval comparison:

and ((EVSDates.ServiceDateEnd - ClientProgram.AdmissionDate) DAY > INTERVAL '1' DAY)


Resolution Resolution
Fixed Problem on 12/3/2012 in version 2.11 build 3


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB LCL Standard with Source
ElevateDB PHP Standard
ElevateDB PHP Standard with Source
ElevateDB PHP Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image