错误为:
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存储过程出现错误相关推荐

  1. linux脚本调用db2存储过程,LINUX定时执行含有DB2存储过程的SHELL脚本

    <LINUX定时执行含有DB2存储过程的SHELL脚本>由会员分享,可在线阅读,更多相关<LINUX定时执行含有DB2存储过程的SHELL脚本(6页珍藏版)>请在人人文库网上搜 ...

  2. 关于调用Oracle存储过程时发生“BCD Overflow”错误的处理

    笔者最近在使用TSQLStoredProc调用Oracle存储过程时发现,即使存储过程体为空时,都会发生 BCD Overflow 错误,该表部分定义如下: PLANE_ALL_PARAMETER表: ...

  3. 服务器无法继续该事务 3400000006 错误原因--JAVA调用SQLSERVER存储过程时过程发生异常内部事务未

    通过JAVA调用SQLSERVER存储过程时,存储过程内部发生了类型转换异常,在类型转换异常发生之前已经将事务打开了,并且在类型转换那一行没有采用像如下错误处理: if @@error<> ...

  4. db2存储过程手动执行没有问题_轻松解决DB2创建存储过程时遇到的错误

    来源: 互联网 作者: 若水 2008-03-19/13:59 问:在 Unix 操作系统下,有时会发生当 DB2 用户使用如: db2 -td@ -vf 创建存储过程失败的情况,而查看 db2dia ...

  5. java c3p0 存储过程_JAVA Spring 连接池 调用 Oracle 存储过程的问题?

    求助,JAVA Spring 连接池 调用 Oracle 存储过程的问题?在Spring中配置了c3P0的连接池,在调用Oracle的存储过程时,报错[code]java.lang.ClassCast ...

  6. (转)创新性应用-使用脚本加速DB2存储过程的开发-常红平

    在进行DB2存储过程开发时,我们可以利用很多DB2自带的工具,例如开发中心,控制中心等.但有时使用脚本能带给开发人员更大的灵活性和更高的工作效率. 在开始开发一个新的或修改一个已存在的存储过程时,我们 ...

  7. 创新性应用-使用脚本加速DB2存储过程的开发-常红平

    创新性应用:使用脚本加速DB2存储过程的开发 在进行DB2存储过程开发时,我们可以利用很多DB2自带的工具,例如开发中心,控制中心等.但有时使用脚本能带给开发人员更大的灵活性和更高的工作效率. 在开始 ...

  8. C#调用Oracle存储过程分页

    直接调用Oracle中的存储过程完成对表的分页,对代码封闭程度高,执行高效.以下为C#分页类代码,包括Oracle数据库 端存储过程PLSQL代码. //    程序调用示例: // int tota ...

  9. mysql存储过程 php_PHP调用MYSQL存储过程实例

    说一下 在PHP页面中调用MYSQL存储过程的方法 以下是几个例子 仅供参考 实例一:无参的存储过程 $conn = mysql_connect('localhost','root','root') ...

  10. c++调用mysql存储过程_C++中ADO调用MySQL存储过程失败,诡异的语法异常,求解中,附源码...

    C++中ADO调用mysql存储过程失败,诡异的语法错误,求解中,附源码 不管怎么调整,死活都出现下面的错误 C++ADO代码我实在找不到什么错误了,难道是MySQL有什么问题,或者有其他需要注意的地 ...

最新文章

  1. css标签显示特性(块级元素、行内元素、行内块元素、标签显示模式转换display、简单文字居中、简单导航栏案例)
  2. Turn over a new leaf
  3. python中参数的位置传递和名称传递各有什么优缺点_Python开发TCP和UDP的区别是什么?优缺点对比总结...
  4. etal斜体吗 参考文献_参考文献类有关论文范例,与日语文提纲2016年,日语文提纲科目相关本科毕业论文范文...
  5. 在绘制USB2.O设备接口差分线时,应注意以下几点要求:
  6. 代码生成器1.0正式发布
  7. Day11多态部分-6 【1.5 多态的好处和弊端】
  8. HikariCP连接池配置
  9. 机器学习--Lasso回归(LassoRegression)
  10. 机器学习实战(七)线性回归(Linear Regression)
  11. php fastdfs扩展,php如何安装fastdfs扩展
  12. 强烈推荐 16 款 IDEA 插件,让你的开发速度飞起来!
  13. Make a Crystal UVA - 11014 (容斥定理)
  14. TextBox内容垂直居中
  15. Modbus通讯协议详解与RTU通信实例演示
  16. 【NHOI2019】初中组区赛解题思路
  17. LogicFlow 来绘制兼容 BPMN2.0 规范的流程 (React hooks版)
  18. 美团点评2017校园招聘编程题--取红包
  19. 新书推荐:iOS Swift 游戏开发指南
  20. 双十一狂欢之后,来看程序员粉丝的真情告白

热门文章

  1. PLUTO SDR入门系列之九:强大的开源软件“gnu radio”
  2. 基于单片机的电子秤系统设计(电路+流程)
  3. uc如何HTML编辑,电脑端UC浏览器如何对书签进行编辑
  4. 参考文献空格怎么空_参考文献中的标点符号后要不要加空格
  5. 【有利可图网】字体设计:英文字体的气质和选用详解(二)
  6. 使用C语言编写一个算数的除法运算(保留n位小数)
  7. 使用Liquid实现简单的数据交换
  8. 一个OpenMP的学习程序
  9. 十大品牌去除甲醛净化器 哪个品牌好
  10. dmx512 java_DMX512控制协议及其实现