bigapple2008 发表于 2006-05-17 13:08

嵌入SQL的错误,SQL0302N

SQL0302NThe value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use.SQLSTATE=22003
是这个错误代码,在运行的时候发生的.大概意思是插入数据库的字段和数据库里定义的不符合,我找到了详细的错误解释:
bash-3.00$ db2 ? SQL0302N


SQL0302N The value of a host variable in the EXECUTE or OPEN
          statement is too large for its corresponding use.

Explanation:

The value of an input host variable was found to be too large for
its use in the SELECT, VALUES, or prepared statement.One of the
following occurred:

o   The corresponding host variable or parameter marker used in
    the SQL statement is defined as string, but the input host
    variable contains a string that is too long.

o   The corresponding host variable or parameter marker used in
    the SQL statement is defined as numeric, but the input host
    variable contains a numeric value that is too large.

o   The terminating NUL character is missing from the C language
    NUL-terminated character string host variable.

o   Federated system users: in a pass-through session, a data
    source-specific restriction might have been violated.



This error occurs as a result of specifying either an incorrect
host variable or an incorrect SQLLEN value in an SQLDA on an
EXECUTE or OPEN statement.

The statement cannot be processed.

User Response:

Ensure that the input host variable value is the correct type and
length.If the input host variables supply values to parameter
markers, match values with the implied data type and length of
the parameter marker.

Federated system users: for a pass-through session, determine
what data source is causing the error (see the problem
determination guide for procedures to follow to identify the
failing data source).Examine the SQL dialect for that data
source to determine which specific restriction has been violated,
and adjust the failing statement as needed.

sqlcode :-302

sqlstate :22001, 22003

但我仔细检查过那些字段了,应该是没有上述情况的啊.
有没有人碰到过这个问题,还有什么其他的情况会导致这样啊.我把set语句后面的字段一个一个排查过来,就是每次就set一个字段还是不行.

天龙帮主 发表于 2006-05-19 10:54

在 EXECUTE 或 OPEN 语句中的主机变量值对于其相应的使用来说过大。
说明:
发现输入主机变量的值对于其在 SELECT、VALUES 或准备语句中的使用来说太大。发生下列其中一种情况:

SQL 语句中使用的相应主机变量或参数标识符被定义为字符串,但是输入主机变量包含的字符串太长。
SQL 语句中使用的相应主机变量或参数标识符被定义为数字,但是输入主机变量包含的数值太大。
C 语言以 NUL 终止的字符串主机变量中丢失终止字符 NUL。
联合系统用户:在传递(Pass-Through)会话中,可能已违反特定于数据源的限制。
由于在 EXECUTE 或 OPEN 语句上的 SQLDA 中指定了不正确的主机变量或不正确的 SQLLEN 值,所以发生此错误。

不能处理该语句。

用户响应:
确保输入主机变量值的类型和长度是正确的。如果输入主机变量向参数标识符提供值,则使这些值与参数标识符的隐含数据类型和长度相匹配。

联合系统用户:对于传递(Pass-Through)会话,确定哪一个数据源导致该错误(请参阅 Problem determination guide 以了解标识失败数据源所要遵循的过程)。检查该数据源的 SQL 对话以确定违反了哪个特定限制,并根据需要来调整限制。

希望对你有帮助吧

lichengx 发表于 2013-04-15 17:33

去打补丁吧
页: [1]
查看完整版本: 嵌入SQL的错误,SQL0302N