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;
begin
execute immediate ‘create table a_bak_‘||to_char(sysdate, ‘yyyymmdd‘)||‘ as select * from a‘;
end;
时间: 2024-12-29 11:50:33