Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: [Q] DECLARE SECTION

Re: [Q] DECLARE SECTION

From: Ron Reidy <rereidy_at_uswest.net>
Date: Wed, 16 Jun 1999 07:34:33 -0600
Message-ID: <3767A7E9.FE7C32D5@uswest.net>


Alex Vinokur wrote:

> Hi,
>
> I'm going to use Pro*C/C++ Precompiler in Oracle.
>
> I work with C/C++/STL, but I didn't work with SQL.
> So I have many questions.
>
> Here is a piece a code.
>
> ------------ Piece#A ------------
>
> <C++ Code : Part#1>
>
> EXEC SQL BEGIN DECLARE SECTION
>
> <C++ Code : Part#2>
>
> EXEC SQL END DECLARE SECTION
>
> <C++ Code : Part#3>
>
> ---------------------------------
>
> 1. What is DECLARE SECTION used for?

It is used to declare "host" variables. Like:

EXEC SQL BEGIN DECLARE SECTION;
  int int_type;
  const char *p = _some_char_pointer;
  VARCHAR x[10];

  etc.

EXEC SQL END DECLARE SECTION; These variables can in turn be used in DML statements embedded in you C/C++ application.

>
> 2. What is the difference between
> Piece#A and Piece#B?

PieceB has no declared host variables.

>
>
> ------------ Piece#B ------------
>
> <C++ Code : Part#1>
>
> <C++ Code : Part#2>
>
> <C++ Code : Part#3>
>
> ---------------------------------
>
> =================================
> Server : Oracle8
> Development Platform : Pro*C/C++
> =================================
>
> Thanks in advance,
> Alex
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

See embedded comments...

--
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C. Received on Wed Jun 16 1999 - 08:34:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US