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

From Richard Huxton
Subject Re: need help with plpgsql execute insert
Date
Msg-id 458A4160.7070109@archonet.com
Whole thread Raw
In response to Re: need help with plpgsql execute insert  (developer@wexwarez.com)
Responses Re: need help with plpgsql execute insert  (developer@wexwarez.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

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Need help on "org.postgresql.util.PSQLException: FATAL:
Next
From: "Gurjeet Singh"
Date:
Subject: Broken link on website...