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: Pine.SGI.3.96.1001105105556.902905A-100000@www.cdfd.org.in (view raw or flat)
Thread:
Lists: pgsql-sql
Hi,

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
query)

Any help will be great,
Indraneel

/************************************************************************.
# Indraneel Majumdar                  ¡  E-mail: indraneel(at)123india(dot)com  #
# Bioinformatics Unit (EMBNET node),  ¡  URL: http://scorpius.iwarp.com  #
# 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-2014 The PostgreSQL Global Development Group