Has anyone tried using a clob field inside of SQL?
I'm moving the data from the YAJL copyBufStr function into a clob variable.
Once I try to use the clob variable inside the SQL statement I get the error below.
Length in varying-length, LOB, or XML host variable not valid.
Cause . . . . . : Host variable JSONDATA was specified. The value in the
length portion of the variable length, LOB, or XML host variable is either
negative or greater than the declared length. If the host variable is
graphic the length should be the number of DBCS characters. The host
variable number is 2. The specified length is -1065379967. The variable is
declared to have length 100000.
Recovery . . . : Change the length portion of the varying-length, LOB, or
XML host variable to a valid positive number or zero. Try the request again.
dcl-s jsonData SQLTYPE(CLOB:100000) inz;
jsonData = yajl_copyBufStr();
EXEC SQL
SELECT RESPONSE_MESSAGE, RESPONSE_HTTP_HEADER
INTO :rspData, :rspHdr
FROM TABLE(QSYS2.HTTP_POST_VERBOSE(
CAST(trim(:myUrl) AS VARCHAR(500)),
CAST(trim(:jsonData) AS CLOB(100000)),
CAST(trim(:myHdr) AS VARCHAR(2000))));
I'm moving the data from the YAJL copyBufStr function into a clob variable.
Once I try to use the clob variable inside the SQL statement I get the error below.
Length in varying-length, LOB, or XML host variable not valid.
Cause . . . . . : Host variable JSONDATA was specified. The value in the
length portion of the variable length, LOB, or XML host variable is either
negative or greater than the declared length. If the host variable is
graphic the length should be the number of DBCS characters. The host
variable number is 2. The specified length is -1065379967. The variable is
declared to have length 100000.
Recovery . . . : Change the length portion of the varying-length, LOB, or
XML host variable to a valid positive number or zero. Try the request again.
dcl-s jsonData SQLTYPE(CLOB:100000) inz;
jsonData = yajl_copyBufStr();
EXEC SQL
SELECT RESPONSE_MESSAGE, RESPONSE_HTTP_HEADER
INTO :rspData, :rspHdr
FROM TABLE(QSYS2.HTTP_POST_VERBOSE(
CAST(trim(:myUrl) AS VARCHAR(500)),
CAST(trim(:jsonData) AS CLOB(100000)),
CAST(trim(:myHdr) AS VARCHAR(2000))));
Comment