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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general