pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedusing EXECUTE on Selects
6+ messages / 4 participants
[nested] [flat]
* using EXECUTE on Selects
@ 2007-07-11 16:41 Radhika Sambamurti <radhika@88thstreet.com>
2007-07-11 16:49 ` Re: using EXECUTE on Selects Rodrigo De León <rdeleonp@gmail.com>
2007-07-11 16:52 ` Re: using EXECUTE on Selects Andrew Sullivan <ajs@crankycanuck.ca>
2007-07-11 17:08 ` Re: using EXECUTE on Selects A. Kretschmer <andreas.kretschmer@schollglas.com>
0 siblings, 3 replies; 6+ messages in thread
From: Radhika Sambamurti @ 2007-07-11 16:41 UTC (permalink / raw)
To: pgsql-sql
Hi,
Here is my need:
I have to select data by building up the where clause:
example: WHERE firm = 'nnn'
WHERE firm = 'nnn' AND symbol = 'bbb'
WHERE date BETWEEN 'startdate' AND 'enddate' AND symbol = 'bbb'
And so on.
I was hoping to write a function where I can build up my where clause
(dynamic sql) and use the EXECUTE command with it. But I just read that
the SELECT INTO has not been implemented for use with EXECUTE.
Is there a way to select data using EXECUTE?
Thanks.
Radhika
--
It is all a matter of perspective. You choose your view by choosing where
to stand.
Larry Wall
---
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: using EXECUTE on Selects
2007-07-11 16:41 using EXECUTE on Selects Radhika Sambamurti <radhika@88thstreet.com>
@ 2007-07-11 16:49 ` Rodrigo De León <rdeleonp@gmail.com>
2 siblings, 0 replies; 6+ messages in thread
From: Rodrigo De León @ 2007-07-11 16:49 UTC (permalink / raw)
To: radhika@88thstreet.com; +Cc: pgsql-sql
On 7/11/07, Radhika Sambamurti <radhika@88thstreet.com> wrote:
> Is there a way to select data using EXECUTE?
FOR-IN-EXECUTE.
See:
http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPGSQL-RECORDS-ITERATING
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: using EXECUTE on Selects
2007-07-11 16:41 using EXECUTE on Selects Radhika Sambamurti <radhika@88thstreet.com>
@ 2007-07-11 16:52 ` Andrew Sullivan <ajs@crankycanuck.ca>
2 siblings, 0 replies; 6+ messages in thread
From: Andrew Sullivan @ 2007-07-11 16:52 UTC (permalink / raw)
To: pgsql-sql
On Wed, Jul 11, 2007 at 12:41:21PM -0400, Radhika Sambamurti wrote:
> I was hoping to write a function where I can build up my where clause
> (dynamic sql) and use the EXECUTE command with it. But I just read that
> the SELECT INTO has not been implemented for use with EXECUTE.
>
> Is there a way to select data using EXECUTE?
You missed the opening sentence of the previous paragraph:
The INTO clause specifies where the results of a SELECT
command should be assigned.
A
--
Andrew Sullivan | ajs@crankycanuck.ca
The whole tendency of modern prose is away from concreteness.
--George Orwell
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: using EXECUTE on Selects
2007-07-11 16:41 using EXECUTE on Selects Radhika Sambamurti <radhika@88thstreet.com>
@ 2007-07-11 17:08 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2007-07-11 17:35 ` Re: using EXECUTE on Selects Radhika Sambamurti <radhika@88thstreet.com>
2 siblings, 1 reply; 6+ messages in thread
From: A. Kretschmer @ 2007-07-11 17:08 UTC (permalink / raw)
To: pgsql-sql
am Wed, dem 11.07.2007, um 12:41:21 -0400 mailte Radhika Sambamurti folgendes:
> Hi,
>
> Here is my need:
>
> I have to select data by building up the where clause:
> example: WHERE firm = 'nnn'
> WHERE firm = 'nnn' AND symbol = 'bbb'
> WHERE date BETWEEN 'startdate' AND 'enddate' AND symbol = 'bbb'
>
> And so on.
>
> I was hoping to write a function where I can build up my where clause
> (dynamic sql) and use the EXECUTE command with it. But I just read that
> the SELECT INTO has not been implemented for use with EXECUTE.
You can use "execute sql into foo;" with sql your dynamic sql and foo
your variable to store the result.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: using EXECUTE on Selects
2007-07-11 16:41 using EXECUTE on Selects Radhika Sambamurti <radhika@88thstreet.com>
2007-07-11 17:08 ` Re: using EXECUTE on Selects A. Kretschmer <andreas.kretschmer@schollglas.com>
@ 2007-07-11 17:35 ` Radhika Sambamurti <radhika@88thstreet.com>
0 siblings, 0 replies; 6+ messages in thread
From: Radhika Sambamurti @ 2007-07-11 17:35 UTC (permalink / raw)
To: pgsql-sql
Thanks! That worked. I really could'nt make sense of the documentation,
the way it was worded. I tested it out and it works.
Thanks again!
Radhika
> am Wed, dem 11.07.2007, um 12:41:21 -0400 mailte Radhika Sambamurti
> folgendes:
>> Hi,
>>
>> Here is my need:
>>
>> I have to select data by building up the where clause:
>> example: WHERE firm = 'nnn'
>> WHERE firm = 'nnn' AND symbol = 'bbb'
>> WHERE date BETWEEN 'startdate' AND 'enddate' AND symbol = 'bbb'
>>
>> And so on.
>>
>> I was hoping to write a function where I can build up my where clause
>> (dynamic sql) and use the EXECUTE command with it. But I just read that
>> the SELECT INTO has not been implemented for use with EXECUTE.
>
> You can use "execute sql into foo;" with sql your dynamic sql and foo
> your variable to store the result.
>
>
> Andreas
> --
> Andreas Kretschmer
> Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
> GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
--
It is all a matter of perspective. You choose your view by choosing where
to stand.
Larry Wall
---
^ permalink raw reply [nested|flat] 6+ messages in thread
* using EXECUTE on Selects
@ 2007-07-11 16:44 Radhika Sambamurti <radhika@88thstreet.com>
0 siblings, 0 replies; 6+ messages in thread
From: Radhika Sambamurti @ 2007-07-11 16:44 UTC (permalink / raw)
To: pgsql-sql
Hi,
Here is my need:
I have to select data by building up the where clause:
example: WHERE firm = 'nnn'
WHERE firm = 'nnn' AND symbol = 'bbb'
WHERE date BETWEEN 'startdate' AND 'enddate' AND symbol = 'bbb'
And so on.
I was hoping to write a function where I can build up my where clause
(dynamic sql) and use the EXECUTE command with it. But I just read that
the SELECT INTO has not been implemented for use with EXECUTE.
Is there a way to select data using EXECUTE?
Thanks.
Radhika
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2007-07-11 17:35 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-11 16:41 using EXECUTE on Selects Radhika Sambamurti <radhika@88thstreet.com>
2007-07-11 16:49 ` Rodrigo De León <rdeleonp@gmail.com>
2007-07-11 16:52 ` Andrew Sullivan <ajs@crankycanuck.ca>
2007-07-11 17:08 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2007-07-11 17:35 ` Radhika Sambamurti <radhika@88thstreet.com>
2007-07-11 16:44 using EXECUTE on Selects Radhika Sambamurti <radhika@88thstreet.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox