注册

oracle sql语句迁移执行失败

ThinkDifference 2023/07/17 512 3 已解决

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:V8
【操作系统】:linux 麒麟
【CPU】:
【问题描述】*:该段sql语句第一次执行提示 语法分析错误
第二次执行,提示执行成功。语句是合法的 oracle 语句

具体sql语句如下:

declare tableExist number; begin select count(1) into tableExist from user_tables where TABLE_NAME = upper('T_REALACCOUNTOPTINSTRUMENT'); if tableExist = 0 then execute immediate 'create table T_REALACCOUNTOPTINSTRUMENT ( ID INTEGER not null, ACCOUNTID INTEGER not null, PRODUCTID VARCHAR2(100) default '''' not null, ISPRODUCT INTEGER not null, MAINFORCE INTEGER default 0 )'; execute immediate 'comment on column T_REALACCOUNTOPTINSTRUMENT.MAINFORCE is ''主力次主力 0 未配置 1主力 2次主力'''; execute immediate 'alter table T_REALACCOUNTOPTINSTRUMENT add primary key (ID) using index '; execute immediate 'create index T_ACCOUNTOPTINSTRUMENT on T_REALACCOUNTOPTINSTRUMENT(ACCOUNTID)'; end if; end; declare tableExist number; begin select count(1) into tableExist from user_tables where TABLE_NAME = upper('t_realaccoptinstrumentNight'); if tableExist = 0 then execute immediate 'create table t_realaccoptinstrumentNight ( ID INTEGER not null, ACCOUNTID INTEGER not null, PRODUCTID VARCHAR2(100) default '''' not null, ISPRODUCT INTEGER not null, MAINFORCE INTEGER default 0 )'; execute immediate 'comment on column t_realaccoptinstrumentNight.MAINFORCE is ''主力次主力 0 未配置 1主力 2次主力'''; execute immediate 'alter table t_realaccoptinstrumentNight add primary key (ID) using index '; execute immediate 'create index t_realaccoptinstrumentNight on t_realaccoptinstrumentNight(ACCOUNTID)'; end if; end;

TEXKC~OHXB_R3A4NYE4U.png
JTWFRLT7PZR.png

回答 0
暂无回答
扫一扫
联系客服