SQC
SQL长度超过32K,预编译失败,报错信息如下:
LINE MESSAGES FOR tbl_datamart_trans_log.sqc
------ --------------------------------------------------------------------
SQL0060W The "C" precompiler is in progress.
33 SQL0314N The host variable "sSql" is incorrectly declared.
SQL0095N No bind file was created because of previous
errors.
SQL0092N No package was created because of previous
errors.
SQL0091W Precompilation or binding was ended with "3"
errors and "0" warnings.
发生错误是因为 DB2 字符串不应该大于 32672 字节。
SQL0314N错误信息说明:
SQL0314N
不正确地声明了主变量名称。
说明
因为下列其中一种原因,未正确地声明主变量
名称:
- 指定的类型不是受支持的类型。
- 长度规范是 0、负数或太大。
- 使用了初始化程序。
- 指定了不正确的语法。
变量仍未定义。
用户响应
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.messages.sql.doc/doc/msql00314n.html
示例代码:
大小超过 32672 的主机变量示例
#include<stdio.h>EXEC SQL INCLUDE SQLCA;int test_ArraySize(void){ EXEC SQL BEGIN declare SECTION; char ResumeData[65533]; EXEC SQL END declare SECTION; EXEC SQL select RESUME INTO :ResumeData FROM EMP_RESUME WHERERESUME_FORMAT = 'ascii'; return SUCCESS;}如果试图像 这样用 db2 prep 预编译器编译此程序,将会返回一个错误。
编译上述程序之后返回的错误:
db2 prep test4.sqc
LINE MESSAGES FOR test4.sqc
--------------------------------------------------------------------------
SQL0060WThe "C" precompiler is in progress.
8 SQL0314NThe host variable "ResumeData" is incorrectly
declared.
SQL0092NNo package was created because of previous
errors.
SQL0091WPrecompilation or binding was ended with "2"
errors and "0" warnings.
发生错误是因为 DB2 字符串不应该大于 32672 字节。任何更长的数据都必须表示为一个 CLOB 数据类型。
处理方法:
要解决这个错误,需要对大于 32672 的主机变量使用以下语法:
用于较大主机变量的语法
EXEC SQL BEGIN declare SECTION;
SQL TYPE IS CLOB (65533)
ResumeData;
EXEC SQL END declare SECTION;
然后可以继续操作:
正确声明主机变量之后程序被成功编译
db2 prep test4.sqc
LINE MESSAGES FOR test4.sqc
--------------------------------------------------------------------------
SQL0060WThe "C" precompiler is in progress.
SQL0091WPrecompilation or binding was ended with "0"
errors and "0" warnings.
警告:现在,尽管 DB2 预编译成功了,但是还会碰到编译问题,因为最初的 char *ResumeData 已经被转换为 struct { int length; char *data; } ResumeData;。 必须管理数据和长度属性,这很可能需要更改代码。
分享到:
相关推荐
If a row is locked, SQL Server will apply intent locks at both the page and the table level. If a page is locked, SQL Server will apply an intent lock at the table level. SIX locks imply that we have...
The only source of any storage location information is the sysindexes table, which keeps track of the address of the root page for every index, and the first IAM page for the index or table....
win10 codeblocks安装mingw-w64时出现the file has been downloaded incorrectly问题解决-附件资源
- The script to which the character belongs is supported by the JRE installation on which SQL Developer is running � for example, appropriate fonts are available � and - The script does not ...
Now it is possible to define is the drawing take place via WMPaint or via the PaintTo direct call (if rcPaint contain non-empty rectangle then WMPaint in progress). - FIX: The TFlexPanel.FPaintCache ...
The default stepping value is 3. - Added ability to disable MONITOR/MWAIT support through .bochsrc CPUID option. The option is available only if compiled with --enable-monitor-mwait configure ...
This is believed to be a bug in the Windows clipboard and a work around hasn't been found yet. * Asynchronous targets appears to be broken in the current release. * When TDropFileTarget....
【故障处理】ORA-12162 TNSnet service name is incorrectly specified.pdf
assistance, help is available from the following sources: 1. Type GO BPROGB on the CompuServe bulletin board system for instant access to the Borland forums with their libraries of technical ...
Until the upgrade is available, you can either install MS-DOS 5.0 on floppy disks or delete Vfeature partitions by repartitioning your hard disk. To install MS-DOS 5.0 on floppy disks, run Setup ...
assistance, help is available from the following sources: 1. Type GO BPROGB on the CompuServe bulletin board system for instant access to the Borland forums with their libraries of technical ...
could be incorrectly generated if the parent ResourceTemplate pathname places the template within a different namespace scope than the current scope. (BZ 7212) Fixed a problem where the compiler ...
functions_date_time_format.asp - the date and time formatting data is now feed into an array to cut down on database calls 4. date_time_configure.asp - updated to support new application level ...
recorded for the origin of the clone, but this incorrectly used a hardcoded name "origin" to name that remote; it has been corrected to honor the "--origin <name>" option. * "git fetch" into a ...
port locks up in the Operating System, the error is still reported. - Corrected a bug, where in rare cases, the result summary could be duplicated in a log file. - Updated license management, in ...
Q490502 - Chart View - Stacked column/bar diagrams incorrectly visualize negative values if the diagram AxisValue.MinMaxValues property is set to mmvAuto Q487902 - Documentation - The ...
Q490502 - Chart View - Stacked column/bar diagrams incorrectly visualize negative values if the diagram AxisValue.MinMaxValues property is set to mmvAuto Q487902 - Documentation - The ...
B238476 - TcxButton is incorrectly painted in applications run via Remote Desktop if the Office11 paint style is applied and Windows themes are disabled Q524948 - TcxButton plays fading animation if ...
B238476 - TcxButton is incorrectly painted in applications run via Remote Desktop if the Office11 paint style is applied and Windows themes are disabled Q524948 - TcxButton plays fading animation if ...