oracle存储过程问题 create or replace package body scott.pkg_etl_trans is
procedure HQ_HISTORY_2_CLOSED is --当前系统日期 v_cur_day date;
--前一个交易日期 v_last_day date;
--当前交易日期 v_trans_day
BEGIN
--记录当前时间 v_cur_day:=sysdate;
--获取当天交易日期 select DATA_TIME into v_trans_day from T_LX_HQ_HISTORY where market_cd='SH' and sec_code='000001' and DATA_TIME=v_cur_day;
--当前日期是否开盘 if v_trans_day is null then
exit;
end if;
--获取前一个交易日期 select max(DATA_TIME) into v_last_day from T_LX_TRANS_DATE_AFTER_CLOSED where sec_code='000001' and market_cd='SH'
--前一个交易日期必须有 if v_last_day is null then
exit;
end if;
--将日行情数据同步到CLOSED表 merge into T_LX_TRANS_DATE_AFTER_CLOSED using ( select * from T_LX_HQ_HISTORY where DATA_TIME=v_trans_day )s on t.sec_code=s.sec_code when matched then update set t.sec_code=s.sec_code , , ;
--将当日缺少数据补齐 merge into T_LX_TRANS_DATE_AFTER_CLOSED using ( --在T_LX_TRANS_DATE_AFTER_CLOSED表中有,但在T_LX_HQ_HISTORY表中无 select * from T_LX_TRANS_DATE_AFTER_CLOSED where DATA_TIME=v_last_day and sec_code not in ( select sec_code from T_LX_HQ_HISTORY where DATA_TIME=v_trans_day ) )s on t.sec_code=s.sec_code when matched then update set t.sec_code=s.sec_code, t.data_time=v_trans_day, , , ;
commit;
END HQ_HISTORY_2_CLOSED;
end scott.pkg_etl_trans ;
编译报以下错误:
警告: 创建的包体带有编译错误。
SQL> show error PACKAGE BODY SCOTT.PKG_ETL_TRANS 出现错误:
LINE/COL ERROR -------- ----------------------------- 15/1 PLS-00103: 出现符号 "BEGIN"在需要下列之一时: constant exception <an identifier> <a double-quoted delimited-identifier> table LONG_ double ref char time timestamp interval date binary national character nchar
41/3 PLS-00103: 出现符号 "IF"在需要下列之一时: * & - + ; / at for mod remainder rem <an exponent (**)> and or group having intersect minus order start union where connect || multiset 符号 ";" 被替换为 "IF" 后继续。
------解决方案-------------------- v_last_day date; where sec_code='000001' and market_cd='SH' ; on 后面要加括号。 ------解决方案-------------------- 把你改后的全部代码粘出来,这肯定是个简单的语法错误。