1. CREATE FUNCTION del_ora_table() RETURNS void AS $$
    2. DECLARE
    3. tmp VARCHAR(512);
    4. DECLARE names CURSOR FOR
    5. select tablename from pg_tables where schemaname='public';
    6. BEGIN
    7. FOR stmt IN names LOOP
    8. tmp := 'DROP TABLE '|| quote_ident(stmt.tablename) || ' CASCADE;';
    9. RAISE NOTICE 'notice: %', tmp;
    10. EXECUTE 'DROP TABLE '|| quote_ident(stmt.tablename) || ' CASCADE;';
    11. END LOOP;
    12. RAISE NOTICE 'finished .....';
    13. END;
    14. $$ LANGUAGE plpgsql;
    15. select del_ora_table();