[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
EmbeddedSql

(SQL) Embedded SQL

SQL called from another programming language.

IBM

Syntax
EXEC SQL [your SQL statement] ;


C example
long age = 0; //'int' is not supported
EXEC SQL select age into :age from database;


You might need an  ?ODBC API.

Embedded SQL statements

EXEC SQL INCLUDE SQLCA;


SQLCA is short for 'SQL Communications Area'. You need to include/add this file to your program to enable communication and error handling.

SQLCODE values

Summarized:
 0 Okay
>0 Warning
<0 Error
More codes at http://www.caliberdt.com/tips/sqlcode.htm

SQLSTATE values

Translated from the Dutch site http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/conn/t0004769.htm

00 Unqualified successful execution 
01 Warning
02 No data
21 Cardinality violation
22 Data exception
23 Violation of condition
24 Incorrect cursor position
26 Incorrect SQL-instruction-ID
40 ROLLBACK of transaction
42 Violation of access rights
51 Invalid execution status
55 The object does not have the required status
56 SQL- or product error
57 Resource unavailable or intervenience of user
58 System error


External links



last edited (December 6, 2006) by bilderbikkel, Number of views: 3607, Current Rev: 13 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.