- 论坛徽章:
- 0
|
找到原因了!是由于文件名称过长了!
考虑到便于代码管理,我将程序都以tipsp打头、后面带4位的业务代码,合计9位。而DB2在进行预编译产生bind文件时自动将package的名称截为8位。下面是DB2帮助里对于package名称的说明:
By default, each package is given a name that is the same as the name of the source module from which the .bnd file originated, but truncated to 8 characters. To explicitly specify a different package name, you must use the PACKAGE USING option on the PREP command.
实际上,只要源程序文件名称长度大于8位,无论是否显示地指定包的名称都不会有什么用处——因为在DB2数据库已限定了内部存储的packege名称最长只能是8位!(见 SQL Limits,Longest unqualified package name)。因此,所有前8位相同的源程序进行预编译后只有最后产生的package文件是有效的,其它的都会在执行的时候产生818错。
DB2的这种实现机制,给源代码命名带来了很大的限制。在开发过程中务必要注意! |
|