Subject | Re: REPLACE command URL |
---|---|
Author | A6-CMO Philippe Makowski |
Post date | 2003-09-04T15:38:13Z |
>but you can use a procedure
>>But I think that would be a very helpful feature, isn't it? Are there any
>
> plans to integrate that? Is there a way to post that idea?
>
> Plans for this? Not that I know off.
>
> Useful? I don't know - I've never had a situation where I would like to use
> a REPLACE - then again, I haven't heard of it before.
>>>Have a look at
>>>http://www.mysql.de/doc/en/REPLACE.html
>>>
>>>I mean such a function. Is that avaible?
>>
>>No.
>
CREATE PROCEDURE MYTABLE_REPLACE (
FIELD1 Integer,
FIELD2 Char(4) ) AS
BEGIN
INSERT INTO MYTABLE (
FIELD1,
FIELD2)
VALUES (
:FIELD1,
:FIELD2);
WHEN SQLCODE -803 DO
UPDATE MYTABLE SET
FIELD2 = :FIELD2
WHERE
FIELD1 = :FIELD1;
END
--
Philippe Makowski
Firebird serveur SQL open-source en français
http://firebird-fr.eu.org
PGP : http://makowski.eu.org/pgpkey.html