Re: How to store multiple rows in array .

From: brahmesr <brahmam1234(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to store multiple rows in array .
Date: 2017-11-20 02:12:18
Message-ID: 1511143938357-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I already defined the composite type as
"validate_crtr_line_items$inv_lines_rt" with the selected
columns(COL1,COL2,COl3)

DeCLARE Block :

INV_LINES_T validate_crtr_line_items$inv_lines_rt ARRAY;
L_INV_LINES INV_LINES_T%TYPE;
L_INV_LINES$temporary_record ap.validate_crtr_line_items$inv_lines_rt;

Collecting the records into L_INV_LINES

SELECT ARRAY (SELECT ROW (COL1,COL2, COUNT(*) *AS txn_cnt* )::
ap.validate_crtr_line_items$inv_lines_rt FROM Distinct_Records GROUP BY
COL1, COL2 HAVING COUNT(*) > 1) INTO L_INV_LINES;

ERROR: syntax error at or near "AS"
LINE 73: COL1,COL2, COUNT(*) AS txn_cnt...

Why "AS" is throwing an error ?

--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-11-20 03:48:04 Re: How to store multiple rows in array .
Previous Message Chris Mair 2017-11-19 20:38:00 Re: parallel query in 9.6.6 + oracle_fdw -> ERROR: invalid cache ID: 41