<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Including Files</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 8.0.11 Documentation" HREF="index.html"><LINK REL="UP" TITLE="ECPG - Embedded SQL in C" HREF="ecpg.html"><LINK REL="PREVIOUS" TITLE="Error Handling" HREF="ecpg-errors.html"><LINK REL="NEXT" TITLE="Processing Embedded SQL Programs" HREF="ecpg-process.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2007-02-02T03:57:22"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" >PostgreSQL 8.0.11 Documentation</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="ecpg-errors.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="ecpg.html" >Fast Backward</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Chapter 29. <SPAN CLASS="APPLICATION" >ECPG</SPAN > - Embedded <ACRONYM CLASS="ACRONYM" >SQL</ACRONYM > in C</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="top" ><A HREF="ecpg.html" >Fast Forward</A ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="top" ><A HREF="ecpg-process.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="ECPG-INCLUDE" >29.10. Including Files</A ></H1 ><P > To include an external file into your embedded SQL program, use: </P><PRE CLASS="PROGRAMLISTING" >EXEC SQL INCLUDE <TT CLASS="REPLACEABLE" ><I >filename</I ></TT >;</PRE ><P> The embedded SQL preprocessor will look for a file named <TT CLASS="LITERAL" ><TT CLASS="REPLACEABLE" ><I >filename</I ></TT >.h</TT >, preprocess it, and include it in the resulting C output. Thus, embedded SQL statements in the included file are handled correctly. </P ><P > Note that this is <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >not</I ></SPAN > the same as </P><PRE CLASS="PROGRAMLISTING" >#include <<TT CLASS="REPLACEABLE" ><I >filename</I ></TT >.h></PRE ><P> because this file would not be subject to SQL command preprocessing. Naturally, you can continue to use the C <TT CLASS="LITERAL" >#include</TT > directive to include other header files. </P ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B > The include file name is case-sensitive, even though the rest of the <TT CLASS="LITERAL" >EXEC SQL INCLUDE</TT > command follows the normal SQL case-sensitivity rules. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="ecpg-errors.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="ecpg-process.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Error Handling</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ecpg.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Processing Embedded SQL Programs</TD ></TR ></TABLE ></DIV ></BODY ></HTML >