调用DB2存储过程出现错误
错误为:
irp@P570R:/irp/etl>db2 -tvf fb.sql
CREATE PROCEDURE “DB2”.”FENBIAO” ()
language sql
begin
declare v_xbm varchar(50)
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “v_xbm
varchar(50)”. Expected tokens may include: “”. LINE
NUMBER=4. SQLSTATE=42601
declare v_jbm varchar(50)
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “declare v_jbm varchar” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “”. LINE
NUMBER=1. SQLSTATE=42601
declare v_a1 integer default 0
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “0” was found following “1 integer default”.
Expected tokens may include: “END-OF-STATEMENT”. LINE NUMBER=1.
SQLSTATE=42601
declare v_b1 integer default 0
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “0” was found following “1 integer default”.
Expected tokens may include: “END-OF-STATEMENT”. LINE NUMBER=1.
SQLSTATE=42601
declare v_bmhz varchar(20) default ‘2016’
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “declare v_bmhz varchar” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “”. LINE
NUMBER=1. SQLSTATE=42601
declare v_sql varchar(1000)
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “declare v_sql varchar” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “”. LINE
NUMBER=1. SQLSTATE=42601
declare exit handler for sqlexception begin rollback
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “” was found following “EXIT”. Expected
tokens may include: “handler”. LINE NUMBER=1. SQLSTATE=42601
end
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “end”.
Expected tokens may include: “JOIN ”. SQLSTATE=42601
a1:begin declare s_cur cursor with hold for select a. tabname from syscat.tables a,syscat.columns b where a.tabname = b.tabname and b.colname = ‘BATCHDATE’ and type = ‘T’ and card > ‘1000000’
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “a1:begin” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “”.
SQLSTATE=42601
declare continue handler for not found set v_a1 = 1
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “” was found following “CONTINUE”.
Expected tokens may include: “handler”. LINE NUMBER=1. SQLSTATE=42601
declare global temporary table session.tmp( name varchar(50) ) on commit preserve rows with replace not logged
DB20000I The SQL command completed successfully.
open s_cur
DB21028E The cursor “S_CUR” has not been declared.
fetch_loop1:loop fetch s_cur into v_jbm
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “fetch_loop1” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “”.
SQLSTATE=42601
if v_a1 = 0 then set v_sql = ‘insert into session.tmp select ”’||v_jbm||”’ from ‘||v_jbm||’ where substr(trim(batchdate),1,4) = ‘||v_bmhz||’ having count(*) > 1000’
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “if” was found following “BEGIN-OF-STATEMENT”.
Expected tokens may include: “”. SQLSTATE=42601
prepare cre from v_sql
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “prepare” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “SELECT”. SQLSTATE=42601
execute cre
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “execute
cre”. Expected tokens may include: “JOIN ”. SQLSTATE=42601
commit
DB20000I The SQL command completed successfully.
set v_a1 = 0
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0206N “V_A1” is not valid in the context where it is used. SQLSTATE=42703
else leave fetch_loop1
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “leave” was found following “else “. Expected
tokens may include: “JOIN ”. SQLSTATE=42601
end if
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “end if”.
Expected tokens may include: “JOIN ”. SQLSTATE=42601
end loop fetch_loop1
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “loop” was found following “end “. Expected
tokens may include: “JOIN ”. SQLSTATE=42601
close s_cur
DB21028E The cursor “S_CUR” has not been declared.
commit
DB20000I The SQL command completed successfully.
b1:begin declare c_cur cursor with hold for select name from session.tmp
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “b1:begin” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “”.
SQLSTATE=42601
declare continue handler for not found set v_b1 = 1
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “” was found following “CONTINUE”.
Expected tokens may include: “handler”. LINE NUMBER=1. SQLSTATE=42601
open c_cur
DB21028E The cursor “C_CUR” has not been declared.
fetch_loop2:loop fetch c_cur into v_jbm
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “fetch_loop2” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “”.
SQLSTATE=42601
if v_b1 = 0 then set v_xbm = v_jbm||’_’||v_bmhz
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “if” was found following “BEGIN-OF-STATEMENT”.
Expected tokens may include: “”. SQLSTATE=42601
set v_sql = ‘create table ‘||v_xbm||’ as (select * from ‘||v_jbm||’) definition only’
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0206N “V_SQL” is not valid in the context where it is used.
SQLSTATE=42703
prepare cre from v_sql
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “prepare” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “SELECT”. SQLSTATE=42601
execute cre
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “execute
cre”. Expected tokens may include: “JOIN ”. SQLSTATE=42601
set v_sql = ‘insert into ‘||v_xbm||’ select * from ‘||v_jbm||’ where substr(trim(batchdate),1,4) = ‘||v_bmhz
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0206N “V_SQL” is not valid in the context where it is used.
SQLSTATE=42703
prepare cre from v_sql
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “prepare” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “SELECT”. SQLSTATE=42601
execute cre
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “execute
cre”. Expected tokens may include: “JOIN ”. SQLSTATE=42601
set v_sql = ‘delete from ‘||v_jbm||’ where substr(trim(batchdate),1,4) = ‘||v_bmhz
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0206N “V_SQL” is not valid in the context where it is used.
SQLSTATE=42703
prepare cre from v_sql
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “prepare” was found following
“BEGIN-OF-STATEMENT”. Expected tokens may include: “SELECT”. SQLSTATE=42601
execute cre
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “execute
cre”. Expected tokens may include: “JOIN ”. SQLSTATE=42601
commit
DB20000I The SQL command completed successfully.
else leave fetch_loop2
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “leave” was found following “else “. Expected
tokens may include: “JOIN ”. SQLSTATE=42601
end if
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “end if”.
Expected tokens may include: “JOIN ”. SQLSTATE=42601
end loop fetch_loop2
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “loop” was found following “end “. Expected
tokens may include: “JOIN ”. SQLSTATE=42601
close c_cur
DB21028E The cursor “C_CUR” has not been declared.
end b1
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “end b1”.
Expected tokens may include: “JOIN ”. SQLSTATE=42601
end a1
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token “END-OF-STATEMENT” was found following “end a1”.
Expected tokens may include: “JOIN ”. SQLSTATE=42601
DB21007E End of file reached while reading the command.
原因:
用xshell调用存储过程时,由于shell默认结束符为分号(;),所以在存储的结束后加@,然后在调用时:
irp@P570R:/irp/etl>db2 -tvf fb.sql -td@
调用DB2存储过程出现错误相关推荐
- linux脚本调用db2存储过程,LINUX定时执行含有DB2存储过程的SHELL脚本
<LINUX定时执行含有DB2存储过程的SHELL脚本>由会员分享,可在线阅读,更多相关<LINUX定时执行含有DB2存储过程的SHELL脚本(6页珍藏版)>请在人人文库网上搜 ...
- 关于调用Oracle存储过程时发生“BCD Overflow”错误的处理
笔者最近在使用TSQLStoredProc调用Oracle存储过程时发现,即使存储过程体为空时,都会发生 BCD Overflow 错误,该表部分定义如下: PLANE_ALL_PARAMETER表: ...
- 服务器无法继续该事务 3400000006 错误原因--JAVA调用SQLSERVER存储过程时过程发生异常内部事务未
通过JAVA调用SQLSERVER存储过程时,存储过程内部发生了类型转换异常,在类型转换异常发生之前已经将事务打开了,并且在类型转换那一行没有采用像如下错误处理: if @@error<> ...
- db2存储过程手动执行没有问题_轻松解决DB2创建存储过程时遇到的错误
来源: 互联网 作者: 若水 2008-03-19/13:59 问:在 Unix 操作系统下,有时会发生当 DB2 用户使用如: db2 -td@ -vf 创建存储过程失败的情况,而查看 db2dia ...
- java c3p0 存储过程_JAVA Spring 连接池 调用 Oracle 存储过程的问题?
求助,JAVA Spring 连接池 调用 Oracle 存储过程的问题?在Spring中配置了c3P0的连接池,在调用Oracle的存储过程时,报错[code]java.lang.ClassCast ...
- (转)创新性应用-使用脚本加速DB2存储过程的开发-常红平
在进行DB2存储过程开发时,我们可以利用很多DB2自带的工具,例如开发中心,控制中心等.但有时使用脚本能带给开发人员更大的灵活性和更高的工作效率. 在开始开发一个新的或修改一个已存在的存储过程时,我们 ...
- 创新性应用-使用脚本加速DB2存储过程的开发-常红平
创新性应用:使用脚本加速DB2存储过程的开发 在进行DB2存储过程开发时,我们可以利用很多DB2自带的工具,例如开发中心,控制中心等.但有时使用脚本能带给开发人员更大的灵活性和更高的工作效率. 在开始 ...
- C#调用Oracle存储过程分页
直接调用Oracle中的存储过程完成对表的分页,对代码封闭程度高,执行高效.以下为C#分页类代码,包括Oracle数据库 端存储过程PLSQL代码. // 程序调用示例: // int tota ...
- mysql存储过程 php_PHP调用MYSQL存储过程实例
说一下 在PHP页面中调用MYSQL存储过程的方法 以下是几个例子 仅供参考 实例一:无参的存储过程 $conn = mysql_connect('localhost','root','root') ...
- c++调用mysql存储过程_C++中ADO调用MySQL存储过程失败,诡异的语法异常,求解中,附源码...
C++中ADO调用mysql存储过程失败,诡异的语法错误,求解中,附源码 不管怎么调整,死活都出现下面的错误 C++ADO代码我实在找不到什么错误了,难道是MySQL有什么问题,或者有其他需要注意的地 ...
最新文章
- css标签显示特性(块级元素、行内元素、行内块元素、标签显示模式转换display、简单文字居中、简单导航栏案例)
- Turn over a new leaf
- python中参数的位置传递和名称传递各有什么优缺点_Python开发TCP和UDP的区别是什么?优缺点对比总结...
- etal斜体吗 参考文献_参考文献类有关论文范例,与日语文提纲2016年,日语文提纲科目相关本科毕业论文范文...
- 在绘制USB2.O设备接口差分线时,应注意以下几点要求:
- 代码生成器1.0正式发布
- Day11多态部分-6 【1.5 多态的好处和弊端】
- HikariCP连接池配置
- 机器学习--Lasso回归(LassoRegression)
- 机器学习实战(七)线性回归(Linear Regression)
- php fastdfs扩展,php如何安装fastdfs扩展
- 强烈推荐 16 款 IDEA 插件,让你的开发速度飞起来!
- Make a Crystal UVA - 11014 (容斥定理)
- TextBox内容垂直居中
- Modbus通讯协议详解与RTU通信实例演示
- 【NHOI2019】初中组区赛解题思路
- LogicFlow 来绘制兼容 BPMN2.0 规范的流程 (React hooks版)
- 美团点评2017校园招聘编程题--取红包
- 新书推荐:iOS Swift 游戏开发指南
- 双十一狂欢之后,来看程序员粉丝的真情告白