Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group