呼叫DB2儲存過程出現錯誤
錯誤為:
[email protected]:/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預設結束符為分號(;),所以在儲存的結束後加@,然後在呼叫時:
[email protected]:/irp/etl>db2 -tvf fb.sql [email protected]
相關推薦
呼叫DB2儲存過程出現錯誤
錯誤為: [email protected]:/irp/etl>db2 -tvf fb.sql CREATE PROCEDURE “DB2”.”FENBIAO” () language sql begin declare v
java jdbc 呼叫db2儲存過程 第一節
呼叫無參儲存過程 建立儲存過程語句如下 建立無參儲存過程 CREATE PROCEDURE "PCCCMALL"."testOne" () SPECIFIC "SQL110512004935601" LANGUAGE SQL NOT DET
Mybatis呼叫儲存過程出現NullPointerException錯誤
今天在寫程式碼,用MyBatis呼叫Oracle儲存過程,總是丟擲下面的異常。 Caused by: java.lang.NullPointerException at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.ja
java中呼叫Oracle儲存過程時,出現異常:java.sql.SQLException: ORA-00928: 缺失 SELECT 關鍵字(已解決)
在java中呼叫Oracle儲存過程時,出現異常:java.sql.SQLException: ORA-00928: 缺失 SELECT 關鍵字 //java程式碼 @Test public void testProcedure(){
DB2 儲存過程複製表結構、重命名錶、刪除表實現,及Mybatis如何呼叫
----Mybaits呼叫db2儲存過程 <update id="changeTableName" parameterType="java.util.Map" statementType="CALLABLE"> call
最近在ArcGIS Engine開發中關於呼叫gp工具過程出現COM 元件的呼叫返回了錯誤 HRESULT E_FAIL 錯誤的解決方法 和 學習oracle中遇到的一些問題總結
首先說下AE開發中關於gp這一塊的東西,gp是一個很方便的工具,利用gp可以在程式碼中實現ArcMap工具箱中的大部分內容,關於gp工具的使用我就不說了,這些大部分都可以在網上找到,我要說的是gp使用過程中遇到的問題: 一般gp的報錯為 對 COM 元件的呼叫返回了錯誤 H
"伺服器無法繼續該事務 3400000006"錯誤原因--JAVA呼叫SQLSERVER儲存過程時過程發生異常內部事務未提交
通過JAVA呼叫SQLSERVER儲存過程時,儲存過程內部發生了型別轉換異常,在型別轉換異常發生之前已經將事務打開了,並且在型別轉換那一行沒有采用像如下錯誤處理: if @@error<>0 then goto err e
VC6.0通過ADO呼叫SQL Server 2000的儲存過程出現引數過多的問題
今天在做畢業設計的時候遇到一個很奇怪的問題,我以前通過傳遞三個引數的儲存過程呼叫都還是很成功的,為什麼今天就不行了呢?程式碼如下: HRESULT hr; if (m_pCmd == NULL) { hr = m_pCmd.Creat
spring data jpa 如何呼叫mysql儲存過程?
A:首先定義儲存過程依賴的jpa表: @Entity @Table(name="evenmngt_childthingtree_tmp")//資料庫中的表名 @Name
C#呼叫ORACLE儲存過程返回結果集
Oracle中scott使用者下建立儲存過程: (注:從9i開始有了sys_refcursor這種型別,在以前的Oracle版本中需要使用REF CURSOR,並且還需放在一個程式包中) create or replace procedure sp_getdept (result
jdbc呼叫mysql儲存過程
public static void updateMtBeginTimeIsSix() { Connection connection = null; CallableStatement cs = null; try { connection = DataSource.getI
ireport5呼叫sqlserver2005儲存過程方法
1、儲存過程準備 ALTER PROCEDURE [dbo].[portofolio_definition_get] @flag INT AS BEGIN
mybaties呼叫mysql儲存過程。儲存過程返回多個select結果集。
先看需求,直接上圖 從圖中看出,需要12條普通的SELECT語句,所以就放到儲存過程中 儲存過程如下: DROP PROCEDURE IF EXISTS proc_report; DELIMITER $ CREATE PROCEDURE proc_report( OUT d_norma
mybatis 呼叫sqlserver 儲存過程
<select id="testStoredProcedure" statementType="CALLABLE" resultMap="TestMap"> <![CDATA[ {call AllNewcourse(${shopid},${cours
DB2儲存過程例項(如果用慣了ORACLE會發現很不習慣)
CREATE OR REPLACE PROCEDURE LOY.TEST1 ( ) ---此處忽略就行了,這個是db2自動為我們生成的 SPECIFIC SQL180919100638350 LANGUAGE SQL NOT DETERMINIS
ABAP使用AMDP呼叫HANA儲存過程
更多內容關注公眾號:SAP Technical 歡迎關注微信公眾號:SAP Technical 資料建模在SAP HANA檢視中完成,需要讀取檢視的輸出並將其保留在HANA表中。編寫儲存過程以從HANA檢視讀取資料並將資料插入HANA表。 儲存庫儲存過程'DATA_PERSIS
python呼叫oracle儲存過程
# -*- coding: utf-8 -*- import cx_Oracle conn = cx_Oracle.connect('user','pwd','tns') cursor = conn.cursor() #宣告變數 #呼叫儲存過程 sql = ''' declare result
【mybatis】mybatis呼叫sqlserver儲存過程和表值函式
儲存過程和表值函式的區別 最簡單的區別是儲存過程是pr開頭的,而儲存過程是fn開頭的,表值函式返回的是一個表結構的結果。如果mybatis用呼叫儲存過程的方式去呼叫表值函式,就會丟擲以下的異常: exc
使用JDBC呼叫mysql儲存過程
多敲幾次java連線mysql,多操作一些簡單的例項,多看大神們的部落格很快就能掌握好java對資料庫的操作了。 程式碼: public static void procedure() throws ClassNotFoundException, SQLException{
【MYSQL】折騰了半天的儲存過程異常錯誤
昨天碰到了一個儲存過程出錯,但是mysqlapi的QUERY並不返回錯誤的問題。後來才知道,呼叫儲存過程,會返回一個呼叫情況的結果集,也就是最後一個結果集。如果前面有別的結果集,query會返回成功,當next_result返回>0的值時,就表示呼叫情況結果集出現錯誤,這時用errno和erro