Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGbZW-0001RV-BU for pgsql-general@arkaria.postgresql.org; Mon, 20 Nov 2017 02:12:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eGbZU-0000td-Ux for pgsql-general@arkaria.postgresql.org; Mon, 20 Nov 2017 02:12:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eGbZU-0000tT-9S for pgsql-general@postgresql.org; Mon, 20 Nov 2017 02:12:28 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eGbZM-0002Kn-VI for pgsql-general@postgresql.org; Mon, 20 Nov 2017 02:12:27 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 5FFF4986FB63 for ; Sun, 19 Nov 2017 19:12:18 -0700 (MST) Date: Sun, 19 Nov 2017 19:12:18 -0700 (MST) From: brahmesr To: pgsql-general@postgresql.org Message-ID: <1511143938357-0.post@n3.nabble.com> In-Reply-To: <11642.1511116381@sss.pgh.pa.us> References: <11642.1511116381@sss.pgh.pa.us> Subject: Re: How to store multiple rows in array . MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org 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@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general