0
CREATE OR REPLACE FUNCTION Test_Param_Insert_Data(p_schema_table text, p_dblinkcon text) RETURNS void AS $$
declare 
    rec p_schema_table;
BEGIN
....

How to use function parameter p_schema_table as composite_type_name e.g. rec public.customer.

I tested create function, but error return

ERROR: type "p_schema_table" does not exist

Why plpgsql language don't understand p_schema_table is passing function parameter, It's should treat to table name e.g public.customer

1 Answer 1

0

You can't declare variable, which type is passed as parameter. In such case you should declare it using RECORD type.

Sign up to request clarification or add additional context in comments.

1 Comment

I already try to use RECORD type, but it does't work for me. I want to wildcard (*) all elements of rec e.g. INSERT INTO public.customer_test SELECT rec.*;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.