Yes, you can even do that completly dynamically. But for your first
step, consider:

create procedure copytbl(suffix varchar(10))
as
begin
  execute statement 'create table test' || suffix || '( ID bigint )'
  with autonomous transaction;
  execute statement 'insert into test' || suffix || '(ID) '
    'select ID from test where ID > 100'
  with autonomous transaction;
end

I did not test this...

Good luck.


Am 03.04.2014 17:47, schrieb [email protected]:
>  
> 
> Hi, 
> 
> 
> I want to create monthly backups of some tables by executing a procedure.
> For ex, lets say I have a table named as COMPANY, and every month I want
> to create a backup table named as
> COMPANY_BCK_2014_01, COMPANY_BCK_2014_02 and copy the existing data into
> these backup tables. 
> 
> Can I create a table in a stored procedure by using the DDL of an
> existing table?
> Thank you. 
> 
> 

-- 
Mit freundlichen Grüßen,

Thomas Beckmann
Diplom-Informatiker


Wielandstraße 14c • 23558 Lübeck
Tel +49 (22 25) 91 34 - 545 • Fax +49 (22 25) 91 34 - 604
Mail [email protected] <mailto:[email protected]>

ASSFINET-Logo

*ASSFINET Dienstleistungs-GmbH*
Max-Planck-Straße 14 • 53501 Grafschaft bei Bonn
[email protected] <mailto:[email protected]> • www.assfinet.de
<http://www.assfinet.de/>

Geschäftsführer: Dipl. Wirtschaftsinformatiker Marc Rindermann
Registergericht Koblenz HRB 23331

Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist
nicht gestattet.

Reply via email to