Skip site navigation (1) Skip section navigation (2)

A question about PL/pgSQL

From: Warren Vanichuk <pyber(at)street-light(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: A question about PL/pgSQL
Date: 2000-10-27 21:32:28
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general

I am writting up a function in PL/pgSQL to automate a couple of multi-table
updates, and I have a question.

I need to check to see if the data is already in the database, and if it is,
perform and update, or if it's not, perform an insert.  The lookup is
against a primary key, so I only have to worry about 1 or 0 rows being
returned from the select statement.

I attempted something like

IF SELECT id FROM overview WHERE id = 100 ...

but I get an 'error near SELECT' returned from the database.

Any help would be apprieciated..  :)

Sincerely, Warren


pgsql-general by date

Next:From: The Hermit HackerDate: 2000-10-27 21:47:51
Subject: Re: What is the listserver at doing?
Previous:From: Dmitriy AgafonovDate: 2000-10-27 21:27:02
Subject: 7.1 release date ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group