Can I use something like this in Postgres? This is an example from PL / SQL, what I want to do:
PROCEDURE CREATE_PAYMENT(P_AMOUNT IN NUMBER, P_INVOICE_LIST IN SIMPLEARRAYTYPE, P_AMOUNT_LIST IN NUMBER_TABLE -- pass list of amounts . . .) s_chk_amnt NUMBER; invoice_list SIMPLEARRAYTYPE; amount_list NUMBER_TABLE; BEGIN -- check if amount list is null or contains zeros IF p_amount_list IS NOT NULL AND p_amount_list.COUNT <> 0 THEN FOR r IN p_amount_list.FIRST..p_amount_list.LAST LOOP s_chk_amnt := s_chk_amnt + p_amount_list(r); END LOOP; END IF;
Is it possible to declare a list of characters and a list of numbers as input parameters to a function?
I found some examples with the FOREACH element , but I do not know how to grab a specific element from a list of numbers, for example, in Oracle using p_amount_list(r) .
arraylist for-loop plpgsql postgresql control-structure
Maki Dec 30 '15 at 15:35 2014-12-30 15:35
source share