Oracle在存储过程中清空表数据
1.指定表名进行数据清空
create or replace procedure 存储名称
as
begin
execute immediate 'truncate table 表名';
execute immediate 'truncate table 表名';
commit;
end;
2.下面是传入参数清空表
CREATE PROCEDURE [dbo].[SSS](@TableName varchar(100)/*参数是表名*/)
AS
BEGIN
DECLARE @SQL varchar(8000)
SET @SQL =''
SELECT @SQL=@SQL+'DELETE FROM '+@TableName
--SELECT @SQL /*查看@sql当前值*/
EXEC (@SQL) /*执行语句*/
END
: