Oracle中存儲過程傳入表名:
一、動態清除該表的數據
create or replace procedure p_deletetable(i_tableName in varchar2) as --定義變量存放動態的SQL語句 dynamic_drop_sql varchar2(500); begin dynamic_drop_sql := 'DELETE FROM ' || i_tableName ; --執行動態SQL語句 execute immediate dynamic_drop_sql; commit; end p_deletetable; 二、oracle創建表,動態表名: beginexecute immediate 'create table a_bak_'||to_char(sysdate, 'yyyymmdd')||' as select * from a';
end;