Re: SQL question

From: Chuck Hamilton <chuckh_at_dvol.com>
Date: 1996/08/27
Message-ID: <3222ec1e.1067906_at_n5.gbso.net>#1/1


kshave_at_MBnet.MB.CA (Keith Shave) wrote:

> I want to insert a record into a regular database table. I simply want
>to check if an integer value is already inserted, and if not, insert the record.Is there a simple way to do this. I am building web pages, and when I try
>a 'select into', and the value isn't actually in the table, I get an error
>loading the page. I thought a non-existent table value would return a
>SQLCODE=100. I tried using this, but the page still will not load. The page
>only loads when a valid integer is selected from the table.
>
> Any ideas?
>--
>kshave_at_mbnet.mb.ca -------

You could put a unique constraint on the column and just insert the value anyway. If it already exists you'll get an error and the insert will be ignored. If it doesn't exist, it'll be inserted.

--
Chuck Hamilton
chuckh_at_dvol.com

Never share a foxhole with anyone braver than yourself!
Received on Tue Aug 27 1996 - 00:00:00 CEST

Original text of this message