Can I use shorthand $ rather than EXEC SQL in DB2 ESQL? 
Author Message
 Can I use shorthand $ rather than EXEC SQL in DB2 ESQL?

In Informix ESQL/C there is a shorthand way of designating lines
that should get the attention of the ESQL preprocessor - rather
than using EXEC SQL, you can just use a simple $ (dollar sign).

Can I do this in DB2 ESQL?

For example, I want to make the following DB2 ESQL code:
------------------------------------------
EXEC SQL INCLUDE SQLCA;
int main(int argc, char *argv[]) {
   EXEC SQL BEGIN DECLARE SECTION;
      char   pname[10];
      short  dept;
   EXEC SQL END DECLARE SECTION;
   if (argc == 1) {
      EXEC SQL CONNECT TO sample;        
   }
---------------------------------------------
look like this:
-----------------------------------------------
$INCLUDE SQLCA;
int main(int argc, char *argv[]) {
      $char   pname[10];
      $short  dept;
   if (argc == 1) {
      $CONNECT TO sample;        
   }

How can I do this in DB2 ESQL?  Is this an ESQL standard?

thanks
Allen



Tue, 17 Aug 2004 04:47:07 GMT
 Can I use shorthand $ rather than EXEC SQL in DB2 ESQL?

Allen,

No, you can't do it in DB2, and no, it isn't an ESQL standard.

Quote:

> In Informix ESQL/C there is a shorthand way of designating lines
> that should get the attention of the ESQL preprocessor - rather
> than using EXEC SQL, you can just use a simple $ (dollar sign).

> Can I do this in DB2 ESQL?

> For example, I want to make the following DB2 ESQL code:
> ------------------------------------------
> EXEC SQL INCLUDE SQLCA;
> int main(int argc, char *argv[]) {
>    EXEC SQL BEGIN DECLARE SECTION;
>       char   pname[10];
>       short  dept;
>    EXEC SQL END DECLARE SECTION;
>    if (argc == 1) {
>       EXEC SQL CONNECT TO sample;
>    }
> ---------------------------------------------
> look like this:
> -----------------------------------------------
> $INCLUDE SQLCA;
> int main(int argc, char *argv[]) {
>       $char   pname[10];
>       $short  dept;
>    if (argc == 1) {
>       $CONNECT TO sample;
>    }

> How can I do this in DB2 ESQL?  Is this an ESQL standard?

> thanks
> Allen

--
====================================
To reply, delete the 'x' from my email

Jerry Stuckle
JDS Computer Training Corp.

====================================



Tue, 17 Aug 2004 06:55:20 GMT
 Can I use shorthand $ rather than EXEC SQL in DB2 ESQL?
Hi Allen,

I have never seen this before (which makes it likely an ESQL special).
What you could try is to include
a
#define $ EXEC SQL
At the beginning of the file (might need some quotes?).
Then you pass the SQC file to the C pre-processor before calling PREP.

Cheers
Serge
--
Serge Rielau
DB2 UDB SQL Compiler Development
IBM Software Lab, Canada



Tue, 17 Aug 2004 06:58:53 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Accessing SQL 7.0 through ASP using SQL authentication rather than NT authentication

2. Use Variable as Table name in EXEC SQL statements (ESQL/C)

3. advantages of using sybase rather than oracle and MS sql server

4. EXEC SQL INQUIRE_SQL - DB2 conversion from Ingres

5. Exec sql stored proc using sql oledb provider

6. How do you move data using DTS rather than copy

7. Using Pivot table control/.cub filtering rather than cell security

8. Using ODBC call rather than TSQL execute to call a stored procedure

9. Using one database rather than many

10. Using Dimension Key rather than Name in MDX

11. Using sysobjects rather tahn information_schema.tables ?

12. SQL Exec /Cmd Exec Fails


 
Powered by phpBB® Forum Software