I am new to Postgresql. I want to pass an ArrayList
to the postgresql stored function. How can I pass this ArrayList
to the Postgresql function using Java ?
Here is my function
CREATE OR REPLACE FUNCTION si.get_ticket_price(IN txnLookupKey TEXT[])
RETURNS TABLE(
txn_lookup_key TEXT,
amount NUMERIC,
sale_code TEXT,
source_updt_dt_tm TIMESTAMP ) AS
$$
BEGIN
RETURN QUERY
SELECT c.txn_lookup_key,
SUM(c.txn_qty) /
CASE WHEN SUM(c.txn_amount) = 0
THEN 1
ELSE SUM(c.txn_amount)
END,
max(c.sale_code),
CAST( max(c.source_updt_dt_tm) AS TIMESTAMP)
FROM si.cia_paciolan_txn_lookup c
WHERE c.txn_lookup_key = any( txnLookupKey )
and c.active_ind = true
GROUP BY c.txn_lookup_key;
END;
$$
LANGUAGE PLPGSQL;
ArrayList<String>
to an array oftext
, i.e.text[]
, in PostgreSQL?" – Craig Ringer Aug 4 at 12:39