Home > database >  PostgreSQL Input Parameter as Type of Column and Array?
PostgreSQL Input Parameter as Type of Column and Array?

Time:02-02

I'm attempting to use a postgres stored procedure akin to:

CREATE OR REPLACE PROCEDURE public.sp_get_transaction_recurrences(
    p_transactions IN "transaction".id%TYPE
)
    LANGUAGE plpgsql
AS $procedure$
    BEGIN

    END;
$procedure$
;

with the p_transactions parameter as an ARRAY of the TYPE identified from a table column type. Is this possible or would it have to be instantiated with something like BIGINT[] instead of "transaction".id%TYPE? If it is possible, what is the correct syntax for this?

CodePudding user response:

CREATE OR REPLACE PROCEDURE public.sp_get_transaction_recurrences(bigINT[])
    LANGUAGE plpgsql
AS $procedure$
    BEGIN
    END;
$procedure$;

call it by:

call  public.sp_get_transaction_recurrences('{1,2,3,4}');

CodePudding user response:

It looks so this feature is not supported. You cannot to make an array type from type of referenced object.

  •  Tags:  
  • Related