Re: [GENERAL] How to store multiple rows in array .

2017-11-19 Thread Tom Lane
brahmesr writes: > 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... > W

Re: [GENERAL] How to store multiple rows in array .

2017-11-19 Thread brahmesr
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$in

Re: [GENERAL] How to store multiple rows in array .

2017-11-19 Thread Tom Lane
Pavel Stehule writes: > 2017-11-19 18:57 GMT+01:00 Brahmam Eswar : >> How to collect multiple columns into array which is composite data type of >> all select colums > SELECT ARRAY(SELECT ROW(col1, col2, ...) INTO You probably need an explicit cast to the rowtype. That is, declare myar

Re: [GENERAL] How to store multiple rows in array .

2017-11-19 Thread Pavel Stehule
2017-11-19 18:57 GMT+01:00 Brahmam Eswar : > Hi , > > System is migrating from Oracle to Postgre SQL. > Oracle is providing BULK COLLECT INTO function to collect the multiple > records from table . > > Select COL1,COL2 ,COL3 BULK COLLECT INTO LINES from Distinct_Records. > > LINES IS TABLE OF TA

[GENERAL] How to store multiple rows in array .

2017-11-19 Thread Brahmam Eswar
Hi , System is migrating from Oracle to Postgre SQL. Oracle is providing BULK COLLECT INTO function to collect the multiple records from table . Select COL1,COL2 ,COL3 BULK COLLECT INTO LINES from Distinct_Records. LINES IS TABLE OF TABLE1 (Defined lines as IS TABLE OF type). In PotGres: