Re: Insert only if not found

From: "Shavonne Marietta Wijesinghe" <shavonne(dot)marietta(at)studioform(dot)it>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Insert only if not found
Date: 2007-04-05 09:24:07
Message-ID: 007601c77764$2b2a0ec0$1102a8c0@dream
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

wow thanks. i managed to paste it to fit my code..
yeahhhh ^____^

Shavonne Wijesinghe
www.studioform.it

----- Original Message -----
From: "A. Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Sent: Thursday, April 05, 2007 10:53 AM
Subject: Re: [SQL] Insert only if not found

> am Thu, dem 05.04.2007, um 10:38:21 +0200 mailte Shavonne Marietta
> Wijesinghe folgendes:
>> Hello everyone..
>>
>> Here is the result of my Insert. and also the insert works ok.
>>
>> INSERT INTO MOD48_02 (ID, TE_INDI, TE_COGNOME, TE_NOME, TE_SESSO,
>> TE_ATTNASC,
>> TE_LUONASC, TE_DTNASC, TE_PROVSTATO, TE_PROV, TE_PATERNITA, TE_RICHIESTA,
>> USERNAME, DATE_INSERTED, TIME_INSERTED) VALUES ('127001200745101033',
>> 'england', 'bloom', 'orlando', 'M', 'ww', 'florida', '05/06/1984',
>> 'america',
>> 'UK', 'xx', 'no', 'demo', '05/04/2007', '10.10.33');
>> But before i insert this record i want to check if the it hasn't been
>> inserted
>> before. I want to use the following fields as the riefferent. TE_COGNOME,
>> TE_NOME, TE_SESSO, TE_DTNASC
>>
>> And if there is no record to match those 4 fields i want to insert it
>> else just
>> a message saying that the record has been inserted b4.
>>
>> any idea to start with?
>
> Yes, read this:
> http://ads.wars-nicht.de/blog/archives/11-Avoid-Unique-Key-violation.html
>
>
> I think, you can change this for your request.
> (but without the message, if you really need this message, you should use
> a function and RAISE a NOTICE as the message)
>
>
> Andreas
> --
> Andreas Kretschmer
> Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
> GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Shavonne Marietta Wijesinghe 2007-04-05 09:47:35 Re: Insert only if not found
Previous Message A. Kretschmer 2007-04-05 08:53:43 Re: Insert only if not found