PREPARE statement

From: Atif Jung <atifjung(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: PREPARE statement
Date: 2010-05-07 15:11:54
Message-ID: o2kd1c6b9c51005070811xc200cc28nf014d368a87295d1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

When using EXEC SQL PREPARE, is it necessary to save the SQL in a buffer
first or can you write:

EXEC SQL PREPARE statement FROM "SELECT name FROM address WHERE code = ?";

or must it be

EXEC SQL BEGIN DECLARE STATEMENT;

char h_sqlBuffer[256];

EXEC SQL END DECLARE STATEMENT;

strcpy(h_sqlBuffer,"SELECT name FROM address WHERE code = ?";

EXEC SQL PREPARE statement FROM :h_sqlBuffer;

Thanks

Atif

Browse pgsql-novice by date

  From Date Subject
Next Message Kevin Grittner 2010-05-07 15:21:46 Re: ERROR: XX001 (Critical and Urgent)
Previous Message Siddharth Shah 2010-05-07 15:09:44 Re: ERROR: XX001 (Critical and Urgent)