Subject | Re: [firebird-support] Why won't this work in Firebird? |
---|---|
Author | Helen Borrie |
Post date | 2005-02-22T07:30:59Z |
At 11:42 PM 21/02/2005 -0700, you wrote:
it's inserting to - it's inserting new data, so a search clause simply
isn't logical for an insert.
Instead, protect the CUST_TYPE_DESC column with a unique constraint. Then,
if someone tries to insert a second row with 'General' in CUST_TYPE_DESC,
you can pick it up as an exception and tell the user "Customer type General
already exists".
./heLen
>INSERT INTO CUSTOMER_TYPE (CUST_TYPE_COMPANY_ID, CUST_TYPE_DESC) valuesIt's not valid syntax? :-)) An insert doesn't know what's in the table
>(1,'General') where not exists(SELECT CUST_TYPE_DESC from CUSTOMER_TYPE
>where CUST_TYPE_DESC = 'General');
>
>Any ideas?
it's inserting to - it's inserting new data, so a search clause simply
isn't logical for an insert.
Instead, protect the CUST_TYPE_DESC column with a unique constraint. Then,
if someone tries to insert a second row with 'General' in CUST_TYPE_DESC,
you can pick it up as an exception and tell the user "Customer type General
already exists".
./heLen