Subject | Re: [firebird-support] REPLACE command |
---|---|
Author | Milan Babuskov |
Post date | 2003-09-04T11:59:56Z |
Martijn Tonies wrote:
AS
IF EXISTS (SELECT * FROM TABLE WHERE PK = NEW_PKVALUE) THEN
DELETE FROM TABLE WHERE PK = NEW_PKVALUE;
And that's all. I know the syntax isn't 100% correct, but you get the
point. Of course, if you don't want it to work that way all the time,
you can write also simple stored procedure to do it.
--
Milan Babuskov
http://fbexport.sourceforge.net
>>>Is there a REPLACE command avaible at Firebird? With the same functionCREATE TRIGGER ... BEFORE INSERT ...
>
> Like in mySQL:
>
>>No but you can write a simple BEFORE INSERT trigger to do the same
>>thing, and it would be a much standard way.
>
> I'm not sure if I understand how a BEFORE INSERT trigger comes into the
> picture?
AS
IF EXISTS (SELECT * FROM TABLE WHERE PK = NEW_PKVALUE) THEN
DELETE FROM TABLE WHERE PK = NEW_PKVALUE;
And that's all. I know the syntax isn't 100% correct, but you get the
point. Of course, if you don't want it to work that way all the time,
you can write also simple stored procedure to do it.
--
Milan Babuskov
http://fbexport.sourceforge.net