The last sentence in the following paragraph is missing from the second paragraph under section "Writing OLE automation Stored Procedures:
After you code an OLE automation object, you must register the methods of the object as stored procedures using the CREATE PROCEDURE statement. To register an OLE automation stored procedure, issue a CREATE PROCEDURE statement with the LANGUAGE OLE clause. The external name consists of the OLE progID identifying the OLE automation object and the method name separated by ! (exclamation mark). The OLE automation object needs to be implemented as an in-process server (.DLL).
The DECIMAL SQL data type is not supported in Java stored procedures, user-defined functions, or methods on the Linux platform.
The following rule applies to embedded static SQL statements: To insert an attribute of a user-defined structured type into a column that is of the same type as the attribute, enclose the host variable that represents the instance of the type in parentheses, and append the double-dot operator and attribute name to the closing parenthesis. For example, consider the following situation:
- PERSON_T is a structured type that includes the attribute NAME of type VARCHAR(30). - T1 is a table that includes a column C1 of type VARCHAR(30). - personhv is the host variable declared for type PERSON_T in the programming language.
The proper syntax for inserting the NAME attribute into column C1 is:
EXEC SQL INSERT INTO T1 (C1) VALUES ((:personhv)..NAME)
The following table supplements the information included in chapter 7, "Stored Procedures", chapter 15, "Writing User-Defined Functions and Methods", and chapter 20, "Programming in C and C++. The table lists the supported mappings between SQL data types and C data types for stored procedures, UDFs, and methods.
Table 2. SQL Data Types Mapped to C/C++ Declarations
SQL Column Type | C/C++ Data Type | SQL Column Type Description | ||
---|---|---|---|---|
SMALLINT (500 or 501) | sqlint16 | 16-bit signed integer | ||
INTEGER (496 or 497) | sqlint32 | 32-bit signed integer | ||
BIGINT (492 or 493) | sqlint64 | 64-bit signed integer | ||
REAL (480 or 481) | float | Single-precision floating point | ||
DOUBLE (480 or 481) | double | Double-precision floating point | ||
DECIMAL(p,s) (484 or 485) | Not supported. |
To pass a decimal value, define the parameter to be of a data type castable
from DECIMAL (for example CHAR or DOUBLE) and explicitly cast the argument to
this type.
| ||
CHAR(n) (452 or 453) | char[n+1] where n is large enough to hold the
data
1<=n<=254 | Fixed-length, null-terminated character string | ||
CHAR(n) FOR BIT DATA (452 or 453) | char[n+1] where n is large enough to hold the
data
1<=n<=254 | Fixed-length character string | ||
VARCHAR(n) (448 or 449) (460 or 461) | char[n+1] where n is large enough to hold the
data
1<=n<=32 672 | Null-terminated varying length string | ||
VARCHAR(n) FOR BIT DATA (448 or 449) |
struct { sqluint16 length; char[n] } 1<=n<=32 672 | Not null-terminated varying length character string | ||
LONG VARCHAR (456 or 457) |
struct { sqluint16 length; char[n] } 32 673<=n<=32 700 | Not null-terminated varying length character string | ||
CLOB(n) (408 or 409) |
struct { sqluint32 length; char data[n]; } 1<=n<=2 147 483 647 | Non null-terminated varying length character string with 4-byte string length indicator | ||
BLOB(n) (404 or 405) |
struct { sqluint32 length; char data[n]; } 1<=n<=2 147 483 647 | Non null-terminated varying binary string with 4-byte string length indicator | ||
DATE (384 or 385) | char[11] | null-terminated character form | ||
TIME (388 or 389) | char[9] | null-terminated character form | ||
TIMESTAMP (392 or 393) | char[27] | null-terminated character form | ||
| ||||
GRAPHIC(n) (468 or 469) | sqldbchar[n+1] where n is large enough to hold
the data
1<=n<=127 | Fixed-length, null-terminated double-byte character string | ||
VARGRAPHIC(n) (400 or 401) | sqldbchar[n+1] where n is large enough to hold
the data
1<=n<=16 336 | Not null-terminated, variable-length double-byte character string | ||
LONG VARGRAPHIC (472 or 473) |
struct { sqluint16 length; sqldbchar[n] } 16 337<=n<=16 350 | Not null-terminated, variable-length double-byte character string | ||
DBCLOB(n) (412 or 413) |
struct { sqluint32 length; sqldbchar data[n]; } 1<=n<=1 073 741 823 | Non null-terminated varying length character string with 4-byte string length indicator |
The following should be added to the "Object Linking and Embedding Samples" section:
salarycltvc A Visual C++ DB2 CLI sample that calls the Visual Basic stored procedure, salarysrv. SALSVADO A sample OLE automation stored procedure (SALSVADO) and a SALCLADO client (SALCLADO), implemented in 32-bit Visual Basic and ADO, that calculates the median salary in table staff2.
Before running the db2vccmd command (step 1), please ensure that you have started and stopped Visual C++ at least once with your current login ID. The first time you run Visual C++, a profile is created for your user ID, and that is what gets updated by the db2vccmd command. If you have not started it once, and you try to run db2vccmd, you may see errors like the following:
"Registering DB2 Project add-in ...Failed! (rc = 2)"