EXECUTE…USING statement in PL/pgSQL doesn't work with record type?

后端 未结 2 351
借酒劲吻你
借酒劲吻你 2020-12-11 04:42

I\'m trying to write a function in PL/PgSQL that have to work with a table it receives as a parameter.

I use EXECUTE..INTO..USING statements within the function def

相关标签:
2条回答
  • 2020-12-11 04:49

    $1 should be inside the || ,like || $1 || and give spaces properly then it will work.

    BEGIN
    
    EXECUTE ' delete from  ' ||  quote_ident($1)  || ' where condition ';
    
    END;
    
    0 讨论(0)
  • 2020-12-11 05:12

    It's true. You cannot to use type record outside PL/pgSQL space.

    RECORD value is valid only in plpgsql.

    you can do

    EXECUTE 'SELECT $1.descr' INTO d USING r::text::xx;
    
    0 讨论(0)
提交回复
热议问题