標籤:
/*
*
* 複製oracle表中任意一行,並改變相應的數列
* /
declare
cursor dept_cursor is select * from SCENE_PIC WHERE PICID=‘63563908576556815641‘;
begin
for dept_rs in dept_cursor
loop
dept_rs.PICID:=‘63563908576556815642‘;
exit when dept_cursor%notFound;
dept_rs.PICID:=null;
insert into ZQ values dept_rs;
end loop;
end;
/*
*
* 複製oracle表中任意一行,並改變相應的數列
* /
declare
begin
for rs in (select * from SCENE_PIC where PICID = ‘63563908576556815641‘)
loop
rs.PICID := ‘63563908576556815642‘;
insert into ZQ values rs;
end loop;
end;
/*
*
* 1到10 的平方
* /
declare
i number:=1;
begin
loop
dbms_output.put_line(i||‘的平方數為‘||i*i);
i:=i+1;
exit when i>10;
end loop;
end;
/*
*
* 複製scene_base表中的案例資訊,修改scene_id,根據scene_id修改scnen_pic中的scene_id和pic_id
* /
declare
v_index number(2):=1;
v_oldId nvarchar2(50):=‘1‘;
begin
for c in (select * from scene_base where sceneid=‘63581299721637758596‘)
loop
for v_index in 1..8 loop
if v_oldId=‘1‘ then
v_oldId := c.sceneid;
end if;
c.sceneid:=‘zx‘|| v_index ;
insert into scene_base values c;
--dbms_output.put_line(‘scene:‘||c.sceneid);
for p in (select * from scene_pic where sceneid = v_oldId)
loop
p.sceneid := c.sceneid;
p.picid := ‘zx‘||v_index||p.picId;
insert into scene_pic values p;
--dbms_output.put_line(‘sceneId:‘||c.sceneid||‘ picId:‘||p.picid);
end loop;
end loop;
end loop;
end;
oracle操作。