Re: need help with plpgsql execute insert - Mailing list pgsql-general

From developer@wexwarez.com
Subject Re: need help with plpgsql execute insert
Date
Msg-id 3019.192.168.1.235.1166723652.squirrel@mail.wexwarez.com
Whole thread Raw
In response to Re: need help with plpgsql execute insert  (Richard Huxton <dev@archonet.com>)
List pgsql-general
> developer@wexwarez.com wrote:
>>> I believe you are wrong.  the EXECUTE is being given 11 columns, it
>>> expects 1.  I think you need to form your execute query like;
>>>
>>> EXECUTE 'INSERT INTO payment (
>>> id,amount,accepted_date,  company_id ,  date ,
>>> patient_responsible_party_id   patient_contact_responsible_party_id ,
>>> insurer_network_responsible_party_id,  type,   status)
>>> values (' || quote_ident(paymentId) || ',' || ...
>>>
>>> Something of that fashion.
>
>> Thanks for replying.  So the '%' symbol can not be used with an EXECUTE
>> 'INSERT statement.  I thought this was exactly what it was for?
>
> No - the RAISE statement takes that format, nothing else.
>
> However, you only need the EXECUTE for statements that you need planned
> every time they are called, e.g. can have their table-name changed. You
> should just be able to write:
>    INSERT INTO ... VALUES (paymentId, 0.0, data.create_date ...)
>
> P.S. - you can remove much of a message when you reply, that way people
> can quickly follow the new parts of a message-thread.
>
> --
>    Richard Huxton
>    Archonet Ltd
>


Thanks Richard that worked for me.


pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Autovacuum Improvements
Next
From: Teodor Sigaev
Date:
Subject: Re: TSearch2 Changeset 25387