Toad World® Forums

refresh table

Hello Everyone,

I am using TOAD version 11.0. I am new to the process

In the database, I want to refresh a table (Suppose Emp) automatically by dropping it manually and then recreate the same table from another table (Main_emp)

i.e

drop table emp;

create table emp as select * from Main_emp;

Is it possible to run the above two line automatically daily at 9 am.

Yes, use automation designer, and within there using the ‘Execute Script’ action. Then you can schedule it to run whenever you want. I won’t go into detail here as there are lots of help, blogs, etc. on Toad World and within the product on how to do this.

On a side note…I’m not sure why you want to drop and recreate the same table everyday - seems like a lot of overhead on the database. I don’t know your specific reasoning/needs, but I would recommend maybe looking into truncating the table instead.

Or you might consider a materialized view instead of a table. That way it can refresh itself.

mine 5c

if table has no child records, “truncate table emp drop storage” would be much more efficient.

Then you may placed:

insert into emp select * from main_emp;

commit;

Brg,

Damir