Re: [GENERAL] How can I do an UPDATE OR CREATE ?

From: "Stephen Boyle" <yd80(at)dial(dot)pipex(dot)com>
To: "Guy Fraser" <guy(at)incentre(dot)net>, <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] How can I do an UPDATE OR CREATE ?
Date: 1999-07-22 17:45:21
Message-ID: 008c01bed46a$da3bb300$010aa8c0@m0n7y
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Guy,

I would think a plpgsql (or other) procedural language function would be the
easiest way to do this. Look at procedural languages and triggers in the
documentation.

Regards

Steve Boyle
-----Original Message-----
From: Guy Fraser <guy(at)incentre(dot)net>
To: pgsql-general(at)postgreSQL(dot)org <pgsql-general(at)postgreSQL(dot)org>
Date: 21 July 1999 10:29
Subject: [GENERAL] How can I do an UPDATE OR CREATE ?

>Hi
>
>I am trying to figure out how I can create an entry if one does not
>exist when attempting an update.
>
>This kind of what I want to do :
>
>if (select "User-Name","Realm" from details;) {
> update details set "Time-Used" = old."Time-Used" +
>new."Time-Used";
>} else {
> insert into details "User-Name","Realm","Time-Used";
>}
>
>I have not seen any documentation specifying what pragmatic operators
>are available if any.
>
>Thank You In Advance
>
>Guy Fraser
>mailto:guy(at)incentre(dot)net
>

Browse pgsql-general by date

  From Date Subject
Next Message Hub.Org News Admin 1999-07-22 21:19:24
Previous Message Jeff MacDonald 1999-07-22 13:43:40 Sites