Subject | Re: [firebird-support] IN using a string from another table field |
---|---|
Author | Mark Rotteveel |
Post date | 2012-04-12T07:46:11Z |
On Thu, 12 Apr 2012 07:15:22 -0000, "venussoftop" <venussoftop@...>
wrote:
attempts to convert that string value to INTEGER for comparison with iID,
this fails. You can only use IN list with explicit values list, not a
'list' in a string.
Mark
wrote:
> Hi allcharacter
>
> I have tried the following query
> SELECT tSaleInvoice.*
> FROM tSaleInvoice
> WHERE tSaleInvoice.iID IN
> (SELECT tSaleInvoiceCvrLtr.cSaleInvIDs
> FROM tSaleInvoiceCvrLtr
> WHERE tSaleInvoiceCvrLtr.iID = 993)
>
> The idea is to pull out records from tSaleInvoice on it's PK iID. The
> reference list of iIDs are stored as a comma separated list in a
> field tSaleInvoiceCvrLtr.cSaleInvID in this case - "24315,24371returned
> "
>
> I get the following error when I run the query and no results are
> ---------------------------No you can't. Now you have an IN list with a single value, and Firebird
> An IBPP error occurred.
> ---------------------------
> *** IBPP::SQLException ***
> Context: Statement::Fetch
> Message: isc_dsql_fetch failed.
>
> SQL Message : -413
> Overflow occurred during data type conversion.
>
> Engine Code : 335544334
> Engine Message :
> conversion error from string "24315,24371
> "
>
> I have tried to (SELECT TRIM(tSaleInvoiceCvrLtr.cSaleInvIDs)... but no
> change
attempts to convert that string value to INTEGER for comparison with iID,
this fails. You can only use IN list with explicit values list, not a
'list' in a string.
Mark