-- 创建函数
CREATE FUNCTION del_ora_table() RETURNS void AS $$
DECLARE
tmp VARCHAR(512);
DECLARE names CURSOR FOR
select tablename from pg_tables where schemaname='public';
BEGIN
FOR stmt IN names LOOP
tmp := 'DROP TABLE '|| quote_ident(stmt.tablename) || ' CASCADE;';
RAISE NOTICE 'notice: %', tmp;
EXECUTE 'DROP TABLE '|| quote_ident(stmt.tablename) || ' CASCADE;';
END LOOP;
RAISE NOTICE 'finished .....';
END;
$$ LANGUAGE plpgsql;
--执行函数批量删除表
select del_ora_table();
标签:tmp,NOTICE,批量,删除,PGAdmin,tablename,stmt,RAISE From: https://www.cnblogs.com/PrintY/p/17477407.html