标签:truncate begin creat 数据 trunc 删除数据库 order by cat arc
create or replace function clear_table_data() returns text as $$ declare select_result record; table_name varchar; begin for select_result in select relname as tablename from pg_class c where relkind = ‘r‘ and relname not like ‘pg_%‘ and relname not like ‘sql_%‘ order by relname loop table_name = select_result.tablename; execute ‘TRUNCATE TABLE ‘ || table_name; end loop; return ‘success‘; end; $$ language plpgsql; select * FROM clear_table_data();
标签:truncate begin creat 数据 trunc 删除数据库 order by cat arc
原文地址:https://www.cnblogs.com/sandyflower/p/9753992.html