我尝试在下面执行脚本,它会卡住,脚本和错误粘贴在下面。
SCRIPT:
declare maxid number;
begin
delete from measure_details
where id in (select id from general_measures where code in ('12345','12346'));
delete from general_measures
where code in (select code from general_measures where code in ('12345','12346'));
select nvl(max(id),0) into maxid from general_measures;
insert into general_measures (id, code, description, valid, domain_id, rec_user_code, rec_time_stamp)
select maxid + ROWNUM,12345,'Golden Store','Y',d.id,'MARSAdmin',sysdate from domains d
where not exists (select * from general_measures gm where gm.domain_id = d.id and gm.code = 12345);
select nvl(max(id),0) into maxid from general_measures;
insert into general_measures (id, code, description, valid, domain_id, rec_user_code, rec_time_stamp)
select maxid + ROWNUM,12346,'Platinum Store','Y',d.id,'MARSAdmin',sysdate from domains d
where not exists (select * from general_measures gm where gm.domain_id = d.id and gm.code = 12346);
select nvl(max(id),0) into maxid from measure_details;
insert into measure_details (id, measure_id, details, objective, category_code, brand_code, product_id, general_id, domain_id, rec_user_code, rec_time_stamp, valid,
code)
select maxid + ROWNUM, m.id, 'Hit distr. and merch. objectives','Hit 100% RPS',null, null, null, gm.id, gm.domain_id, 'MARSAdmin',sysdate,'Y',maxid + ROWNUM
from general_measures gm join measures m
on gm.domain_id = m.domain_id and m.code = 'RPS' and gm.code = 12345
where not exists (select * from measure_details where domain_id = gm.domain_id and general_id = gm.id);
select nvl(max(id),0) into maxid from measure_details;
insert into measure_details (id, measure_id, details, objective, category_code, brand_code, product_id, general_id, domain_id, rec_user_code, rec_time_stamp, valid,
code)
select maxid + ROWNUM, m.id, 'Hit distr. and merch. objectives','Hit 100% Platinum',null, null, null, gm.id, gm.domain_id, 'MARSAdmin',sysdate,'Y',maxid +
ROWNUM
from general_measures gm join measures m
on gm.domain_id = m.domain_id and m.code = 'RPS' and gm.code = 12346
where not exists (select * from measure_details where domain_id = gm.domain_id and general_id = gm.id);
end;
/
错误:
ERROR at line 28:
ORA-06550: line 28, column 1:
PLS-00103: Encountered the symbol "*" when expecting one of the following:
( begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << continue close current delete fetch lock
insert open rollback savepoint set sql execute commit forall
merge pipe purge
注意:我从begin语句中删除了一些代码