--表結構
create table item_prop
(pid integer,
name varchar2(20),
is_key_prop integer,
is_sale_prop integer,
is_color_prop integer,
parent_pid integer,
parent_vid varchar2(20),
prop_values propvalues
)--無參形式
create or replace procedure pro_drop is
sql_str varchar2(1000) := '';
begin
for v_cat in (select pid from item_prop where pid = 1627207) loop
sql_str := 'select * from item_prop where pid =' || v_cat.pid;
dbms_output.put_line(v_cat.pid);
dbms_output.put_line(sql_str);
execute immediate sql_str;
end loop;
end;
--有參形式
create or replace procedure pro_drop
(id in int,
name in varchar2
) is
sql_str varchar2(1000) := '';
begin
for v_cat in (select pid from item_prop where pid = id) loop
sql_str := 'update item_prop set name = name where pid =' || v_cat.pid;
dbms_output.put_line(v_cat.pid);
dbms_output.put_line(sql_str);
execute immediate sql_str;
end loop;
commit;
end;
Oracle儲存過程中定義多個游標
1 直接定義多個顯示游標 create orreplace procedure acc.dbp realcitytrafficcnt is cursor cur1 is select 第乙個游標 cursor cur2 is select 第二個游標 begin 呼叫cur1 begin open ...
Oracle 儲存過程中自定義異常
參考 oracle 使用者自定義異常小例子 oracle中raise異常深入分析 customize exp exception 自定義異常 begin for c in select d.from scott.dept d loop begin dbms output.put line dept ...
在ORACLE儲存過程中建立臨時表
create procedure pro asstr varchar2 100 begin str create global temporary table tablename col1 varchar2 10 col2 number on mit preserve rows execute im...