Re: Conditional SQL query

From: Indraneel Majumdar <indraneel(at)www(dot)cdfd(dot)org(dot)in>
To: marten(at)toppoint(dot)de
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Conditional SQL query
Date: 2000-11-06 09:07:45
Message-ID: Pine.SGI.3.96.1001106010028.1000241C-100000@www.cdfd.org.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, 5 Nov 2000, Marten Feldtmann wrote:

> Indraneel Majumdar schrieb:
> >
> > 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)
> >
>
> insert into table select ... where col1 = 'value'
>

this is working but I am inserting values directly and not by select. eg:

insert into table values(x,x,x)
and not
insert into table select * from table2

the former is not working.

\Indraneel

>
> MF
>

/************************************************************************.
# 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 #
`************************************************************************/

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Grant Finnemore 2000-11-06 09:39:30 Re: Returning Recordsets from Stored-procs
Previous Message Marc Rohloff 2000-11-06 08:15:07 Returning Recordsets from Stored-procs