store_proc to drop and recreate lock fastload table

Database
New Member

store_proc to drop and recreate lock fastload table

I do not write store_procs very well

Case...We want to automate the dropping and recreate of a table that is a FASTLOAD staging table that is locked.  As you know you can not release the lock on a fastloadtable.

 

So I need a store_proc that will drop the fastload table and recreated the DDL for it.  They want to this to be available for any fastload table.   So I guess I need 2 variables in the st_proc,  Databasename and tablename that needs to be recreated.  I was think of doing this way but I do not know who to pass the variables from the st_proc to the sql

 

rename lock table to 'dbname'.tablename'_2

create table 'dbname'.tablename' as 'dbname'.tablename'_2 with no data

drop table 'dbname'.tablename'_2