Subject | Re: Check constraint error |
---|---|
Author | Adam |
Post date | 2005-01-24T23:03:44Z |
Can you use the exists keyword in your check as per page 29/30 of the
LangRef.pdf, and rework that sql to do the sign check for you. IB_UDF
contains the sign function.
Otherwise, just use First 1 to calm firebirds nerves about the
singleton thing.
--- In firebird-support@yahoogroups.com, "Rick DeBay" <rdebay@r...>
wrote:
LangRef.pdf, and rework that sql to do the sign check for you. IB_UDF
contains the sign function.
Otherwise, just use First 1 to calm firebirds nerves about the
singleton thing.
--- In firebird-support@yahoogroups.com, "Rick DeBay" <rdebay@r...>
wrote:
> I get the error 'multiple rows in singleton select' when I insert arow
> into a table with the following check constraint. It isn'tpossible to
> get back more than one row, as the three items in the where clauseare
> the primary key of the table.C_CLAIMINVOICEITEM_DECQTY
>
> /* make sure sign of QTY_CLAIM matches sign of DECIMALQTY */
> ALTER TABLE CLAIM_INVOICEITEM ADD CONSTRAINT
> CHECK (
>
> (SELECT
> DECIMALQTY
> FROM
> CLAIMSPAIDREVERSED cpr
> WHERE cpr.RXCLAIMNBR=RXCLAIMNBR AND cpr.CLMSEQNBR=CLMSEQNBR AND
> cpr.CLAIMSTS=CLAIMSTS
> ) * QTY_CLAIM > 0
>
> );
>
> Rick DeBay
> Senior Software Developer
> RxStrategies.net