oracle 儲存過程

2021-06-06 18:46:48 字數 749 閱讀 3136

示例

create or replace procedure pro_droptable authid current_user is

cursor cur_table is select table_name from tabs;

cursor cur_sequence is select sequence_name from seq;

drop_sql varchar2(1000);

begin

for tbname in cur_table loop

begin

drop_sql:='drop table '||tbname.table_name||' cascade constraints';

execute immediate drop_sql;

end;

end loop;

for sqname in cur_sequence loop

begin

drop_sql:='drop sequence '||sqname.sequence_name;

execute immediate drop_sql;

end;

end loop;

end pro_droptable;

/call pro_droptable();

* sqlplus中載入儲存過程:

@./procedue.sql

Oracle儲存過程呼叫儲存過程

oracle儲存過程呼叫有返回結果集的儲存過程一般用光標的方式,宣告乙個游標,把結果集放到游標裡面,然後迴圈游標 declare newcs sys refcursor cs1 number cs2 number cstype table rowtype table列的個數和newcs返回的個數一樣...

ORACLE儲存過程

自定義函式開始 create or replace function fn wftemplateidget templatecategoryid number,organid number,templatemode number return number istemplateid number i...

Oracle 儲存過程

create or replace procedure p 有就替換,沒有就建立 iscursor c is select from emp for update begin for v emp in c loop if v emp.deptno 10 then update emp2 set sa...