If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Stored procedure for db2 copy data from existing table to another table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-20-11, 17:15
dbsam dbsam is offline
Registered User
 
Join Date: Dec 2009
Posts: 31
Stored procedure for db2 copy data from existing table to another table

Hi All,

I have a requirement to copy all data from an existing table to another table. I need to write a stored procedure for that. COuld you please help me write a stored procedure. Ihave never written one before. so will be a good learning experience for me.

Thanks

dbsam
Reply With Quote
  #2 (permalink)  
Old 07-20-11, 21:56
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
I'm not sure if you really need a stored procedure for that, but there are some examples in the manual: README
Reply With Quote
  #3 (permalink)  
Old 07-21-11, 09:03
dbsam dbsam is offline
Registered User
 
Join Date: Dec 2009
Posts: 31
Thanks so much for your reply. Could you please provide me the link

dbsam
Reply With Quote
  #4 (permalink)  
Old 07-22-11, 07:18
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Copying data can be done with a simple "INSERT INTO <target> SELECT <column-list> FROM <source>". The only thing why you want to do it more complicated is to execute intermediate COMMIT statements.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 07-22-11, 19:13
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
If you do the above with shell scripts its easier and simple. But still if there is a need to copy and move data using Stored Procedure in DB2, then you can use ADMIN_CMD stored procs "ADMIN_CMD procedure is used by applications to run administrative commands using the SQL CALL statement. "
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On