[SQL] Function to total reset a schema

2011-05-30 Thread Surfing
Hi all, I need to write a function that totally empty a schema. So I have written a TRUNCATE statement for each table and set to 0 each sequence. Btw, it could be good to execute a vacuum statement on each table, but from within the function this is not allowed. Is there a way to obtain the s

Re: [SQL] Function to total reset a schema

2011-05-30 Thread Rob Sargent
I would hope you have readily at hand the ddl for the schema in question. Then it's simply a matter of drop schema cascade and re-run you ddl scripts. Surfing wrote: Hi all, I need to write a function that totally empty a schema. So I have written a TRUNCATE statement for each table and set

Re: [SQL] Function to total reset a schema

2011-05-29 Thread Surfing
I have two schemas, so I can't do that ... @ Scott. You are totally right ... I have just read this on the documentation: "TRUNCATE quickly removes all rows from a set of tables. It has the same effect as an unqualified DELETE on each table, but since it does not actually scan the tables it is

Re: [SQL] Function to total reset a schema

2011-05-29 Thread Thomas Kellerer
Surfing wrote on 29.05.2011 09:38: Hi all, I need to write a function that totally empty a schema. So I have written a TRUNCATE statement for each table and set to 0 each sequence. Btw, it could be good to execute a vacuum statement on each table, but from within the function this is not allow

Re: [SQL] Function to total reset a schema

2011-05-29 Thread Scott Marlowe
On Sun, May 29, 2011 at 1:38 AM, Surfing wrote: > Hi all, > I need to write a function that totally empty a schema. > > So I have written a TRUNCATE statement for each table and set to 0 each > sequence. > Btw, it could be good to execute a vacuum statement on each table, but from > within the fun

[SQL] Function to total reset a schema

2011-05-29 Thread Surfing
Hi all, I need to write a function that totally empty a schema. So I have written a TRUNCATE statement for each table and set to 0 each sequence. Btw, it could be good to execute a vacuum statement on each table, but from within the function this is not allowed. Is there a way to obtain the s