报错:line 1, column 85, nearby [identity] has error: Syntax error
procedure deleteBusiness(identity in varchar2,res out number)
is
businessId number(20) := 0 ;
getBusinessIdSQL varchar(300) ;
getBusinessStructureIdSQL varchar(200) ;
cursor1 types.cursorType ;
oneRow number(20) ;
begin
getBusinessIdSQL := 'select business.id from B business where business.esidentifier = ''' || identity || '''' ;
open cursor1 for getBusinessIdSQL;
loop
begin
fetch cursor1 into oneRow;
exit when cursor1 %NOTFOUND;
if oneRow is not null then
begin
businessId := oneRow ;
end ;
end if ;
end;
end loop ;
close cursor1 ;
if businessId != 0 then
begin
getBusinessStructureIdSQL := 'select businessStructure.Id_Structure from A businessStructure where businessStructure.Id_Business = ' || businessId;
open cursor1 for getBusinessStructureIdSQL;
loop
begin
fetch cursor1 into oneRow;
exit when cursor1 %NOTFOUND;
if oneRow is not null then
begin
res := funDelStrc(oneRow) ;
end ;
end if ;
end;
end loop ;
close cursor1 ;
res := funDelMenuRef(businessId) ;
delete from C businessMenu where businessMenu.Business_Id = businessId ;
delete from D businessButton where businessButton.Business_Id = businessId ;
delete from E businessOption where businessOption.Business_Id = businessId ;
delete from F packageRight where packageRight.Business = businessId ;
delete from G estype where estype.business_id = businessId ;
delete from H business where business.id = businessId ;
end ;
end if;
commit ;
res := 1 ;
end ;
报错:line 8,column 16,nearby [stat] has error: Syntax error
procedure createS is
cursor structureIdsCur is SELECT distinct (REPLACE(REPLACE(table_name,'ESP_',''),'_TAMP','')) as id
FROM USER_TABLES WHERE TABLE_NAME LIKE 'ESP/_%' escape '/';
oneId structureIdsCur%rowtype ;
tablename varchar2(100);
str varchar2(100);
strsql varchar2(500);
stat number ;
cou number ;
begin
for oneId in structureIdsCur loop
tablename:= 'esp_' || oneId.id ;
str:= 'select count(*) as int from A where tname=upper('''|| tablename||''')' ;
execute immediate str into cou ;
if cou>0 then
begin
strsql:= 'select nvl(max(id),0)+1 from ' || tablename ;
execute immediate strsql into stat ;
strsql:='create sequence seq_' || tablename || ' minvalue 1 maxvalue 999999999999999999999999999 start with '|| stat ||' increment by 1 nocache';
execute immediate strsql;
end;
end if ;
end loop ;
end createS;
解决办法1:
将在存储过程中涉及到达梦关键字例如“identity”,“stat”修改名字为“identity_1”,“stat_1”,重新执行./dts导入
解决办法2:
1、修改dm_svc.conf ,在KEYWORDS中添加达梦的关键字:标识用户关键字,所有在列表中的字符串,如果以单词的形式出现在SQL语句中,则这个单词会被加上双引号。该参数主要用来解决用户需要使用DM8中的保留字作为对象名使用的状况。
[dmdba@dmdb1 etc]$ cat /etc/dm_svc.conf
TIME_ZONE=(+480)
LANGUAGE=(ch)
KEYWORDS=(identity,stat)
[dmdba@dmdb1 etc]$
2、重新开启./dts,重新执行导入