And, aside from subclass code 000 ("not applicable",) the subclass code denotes a specific exception within that category. Aside from class code 00 ("successful completion",) the class code denotes a category of exceptions. SQLSTATE status codes consist of a 2-character class code immediately followed by a 3-character subclass code. SQLCODE has been removed from all editions of the SQL standard subsequent to SQL-92. SQLCODE was a deprecated feature of SQL-92 that was retained only for compatibility with SQL-89. Thus, SQLSTATE is the preferred status variable. Furthermore, the SQLSTATE reporting mechanism uses a standardized coding scheme. Unlike SQLCODE, which stores only error codes, SQLSTATE stores error and warning codes. To promote interoperability (the ability of systems to exchange information easily), the SQL standard predefines all the common SQL exceptions. The status code indicates whether the SQL statement executed successfully or raised an exception (error or warning condition). The SQL standard specifies a similar status variable named SQLSTATE, which you can use with or without SQLCODE.Īfter executing a SQL statement, the Oracle Server returns a status code to the SQLSTATE variable currently in scope. However, you must declare a separate status variable named SQLCODE. When MODE=ANSI, declaring the SQLCA data structure is optional. The precompiler command line option MODE governs ANSI/ISO compliance. Other components contain warning flags and miscellaneous information about the processing of the SQL statement. The most frequently-used components in the SQLCA are the status variable ( sqlca.sqlcode), and the text associated with the error code ( ). You can use WHENEVER directives, code explicit checks on SQLCA components, or do both. Implicit checking with the WHENEVER directive This can be done in the following two ways: (SQLCA values are unchanged after a declarative statement.) By checking Oracle return codes stored in the SQLCA, your program can determine the outcome of a SQL statement. Oracle updates the SQLCA after every executable SQL statement. The SQLCA is defined in the header file sqlca.h, which you include in your program using either of the following statements: When this guide refers to a specific component in the C struct, the structure name ( sqlca) is used. In this guide, the sqlca structure is commonly referred to using the acronym for SQL Communications Area (SQLCA).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |