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

Conditional SQL query

From: Indraneel Majumdar <indraneel(at)www(dot)cdfd(dot)org(dot)in>
To: pgsql-sql(at)postgresql(dot)org
Subject: Conditional SQL query
Date: 2000-11-05 19:03:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql

how can I insert a record after checking whether one of the fields has a
certain value or not? eg:

if table(col1)='value' insert into table values (x,x,x)

I am using perl interface. Is there any way to define a function to take
table name as an argument? (eg: select * from $table) I tried but this
gave an error (so I'm using perl to pass the real tablename for each

Any help will be great,

# Indraneel Majumdar                  ¡  E-mail: indraneel(at)123india(dot)com  #
# Bioinformatics Unit (EMBNET node),  ¡  URL:  #
# Centre for DNA Fingerprinting and Diagnostics,                         #
# Hyderabad, India - 500076                                              #

In response to

pgsql-sql by date

Next:From: Cristóvão B. B. Dalla CostaDate: 2000-11-05 21:46:07
Subject: Re: Conditional SQL query
Previous:From: Jean-Christophe BoggioDate: 2000-11-05 18:03:28
Subject: Help with GROUP BY

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