关于DB2的存储过程有些问题望大神解答

之前用ORACLE 然后现在很多不习惯,有没有大神指导一下应该怎么修改。
CREATE PROCEDURE ZFZ111(in xgdate date,out num int)
language sql
begin
declare v_nname varchar(90) ;--新表表名
declare v_csql varchar(2000) ;--建表语句
declare v_insql varchar(2000);--插入语句
declare v_oname varchar(2000)default 'hetl_job_log'; --旧表名 需要分表的表名
declare v_date date ;--系统时间
declare v_time date ;--数据的时间
declare v_year date ;--年份
select current date into v_date from sysibm.sysdummy1;
set v_year = substr(v_date,1,4);
select dayid into v_time from v_oname ;
set v_nname = v_oname||v_year;
create table v_nname as (select * from v_oname ) definition only;
insert into v_nname select * from v_oname where dayid like '2013%';
end
@

报错
15:07:02 [CREATE - 0 row(s), 0.000 secs] [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=END-OF-STATEMENT;v_nname varchar(90);, DRIVER=3.57.82
15:07:02 [DECLARE - 0 row(s), 0.000 secs] [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=declare v_csql varchar;BEGIN-OF-STATEMENT;, DRIVER=3.57.82
15:07:02 [DECLARE - 0 row(s), 0.000 secs] [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=declare v_insql varchar;BEGIN-OF-STATEMENT;, DRIVER=3.57.82
15:07:02 [DECLARE - 0 row(s), 0.000 secs] [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=declare v_oname varchar;BEGIN-OF-STATEMENT;, DRIVER=3.57.82
15:07:02 [DECLARE - 0 row(s), 0.000 secs] [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=date;declare v_date ;END-OF-STATEMENT, DRIVER=3.57.82
15:07:02 [DECLARE - 0 row(s), 0.000 secs] [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=date;declare v_time ;END-OF-STATEMENT, DRIVER=3.57.82
15:07:02 [DECLARE - 0 row(s), 0.000 secs] [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=date;declare v_year ;END-OF-STATEMENT, DRIVER=3.57.82
15:07:02 [SELECT - 0 row(s), 0.000 secs] [Error Code: -206, SQL State: 42703] DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=V_DATE, DRIVER=3.57.82
15:07:02 [SET - 0 row(s), 0.000 secs] [Error Code: -206, SQL State: 42703] DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=V_YEAR, DRIVER=3.57.82
15:07:02 [SELECT - 0 row(s), 0.000 secs] [Error Code: -204, SQL State: 42704] DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DB2INST5.V_ONAME, DRIVER=3.57.82
15:07:02 [SET - 0 row(s), 0.000 secs] [Error Code: -206, SQL State: 42703] DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=V_NNAME, DRIVER=3.57.82
15:07:02 [CREATE - 0 row(s), 0.000 secs] [Error Code: -204, SQL State: 42704] DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DB2INST5.V_ONAME, DRIVER=3.57.82
15:07:02 [INSERT - 0 row(s), 0.000 secs] [Error Code: -204, SQL State: 42704] DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DB2INST5.V_NNAME, DRIVER=3.57.82
15:07:02 [END - 0 row(s), 0.000 secs] [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=END-OF-STATEMENT;end
@;JOIN , DRIVER=3.57.82
... 14 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 14 errors]

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问