Re: need help with plpgsql execute insert

From: Richard Huxton <dev(at)archonet(dot)com>
To: developer(at)wexwarez(dot)com
Cc: Russell Smith <mr-russ(at)pws(dot)com(dot)au>, pgsql-general(at)postgresql(dot)org
Subject: Re: need help with plpgsql execute insert
Date: 2006-12-21 08:10:08
Message-ID: 458A4160.7070109@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

developer(at)wexwarez(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gurjeet Singh 2006-12-21 11:49:50 Broken link on website...
Previous Message Richard Huxton 2006-12-21 08:05:29 Re: Need help on "org.postgresql.util.PSQLException: FATAL: