| From: | Jan Wieck <janwieck(at)yahoo(dot)com> |
|---|---|
| To: | "Wade D(dot) Oberpriller" <oberpwd(at)anubis(dot)network(dot)com> |
| Cc: | general-help postgresql <pgsql-general(at)postgreSQL(dot)org> |
| Subject: | Re: Arrays in PL/PGSQL |
| Date: | 2000-10-23 15:21:41 |
| Message-ID: | 200010231521.KAA01518@jupiter.jw.home |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Wade D. Oberpriller wrote:
> Hello,
>
> Does PL/PGSQL support arrays? Or is their a mechanism to select a set of
> records from a table and iterate over all of them.
>
> For example:
>
> DECLARE recs AS RECORDS; //??
> BEGIN
> SELECT INTO recs * FROM mytable WHERE myfield = 'myvalue';
> for i in 1 .. NumRecs loop
> ...
> end loop;
>
> Is there a way to do something like this??
Do it with one record as:
DECLARE rec record;
BEGIN
FOR rec IN SELECT * FROM mytable WHERE myfield = 'myvalue' LOOP
...
END LOOP;
And BTW, this syntax is documented in the user manual :-)
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Diehl, Jeffrey | 2000-10-23 17:18:38 | RE: MySQL -> pgsql |
| Previous Message | Dmitry Sorokin | 2000-10-23 15:05:21 | add constraints? |