Updating an emty table?
От | Bjorn T Johansen |
---|---|
Тема | Updating an emty table? |
Дата | |
Msg-id | 46175.193.212.14.12.1056530416.squirrel@www.havleik.no обсуждение исходный текст |
Ответы |
Re: Updating an emty table?
Re: Updating an emty table? |
Список | pgsql-general |
Hi.. I have a small "problem" and I was wondering if you guys could give me a recommendation. I have a table that initially is empty but the table is always updated, so there is no insert first then update.. The table can hold 10-20 records for each order, and I was wondering how to implement this update. There are two alternatives as far as I can see..: 1. I can delete every row for the order on every update and do an insert instead. 2. or I can write a function (stored proc) that first tries to update and if update fails, it then does an insert. The first one I know how to do (don't know how much penalty this would cause?) and the second one is perhaps the best way to do it, but since I have never written any stored proc for PostgreSQL yet, I need some pointers on how to implement this... Regards, BTJ ----------------------------------------------------------------------------------------------- Bjørn T Johansen (BSc,MNIF) Executive Manager btj@havleik.no Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no ----------------------------------------------------------------------------------------------- "The stickers on the side of the box said "Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better", so clearly Linux was a supported platform." -----------------------------------------------------------------------------------------------
В списке pgsql-general по дате отправления: