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

0

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

  • 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.*; – autthapone Apr 20 '16 at 6:55
  • This's my code pastebin.com/SqQsEUZ4 – autthapone Apr 20 '16 at 7:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.