|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Moving data from one table to another
Hello...
I am trying to move data from one table to another table. The tables have very similar designs. I will only be moving one row at a time. How do I do this? My original idea was to retrieve each column value, stick it into a temporary variable then insert the values into the target table. However, this method is not working. Please note that I need to move multiple columns worth of data. Thank you! Last edited by pabloj : January 22nd, 2005 at 08:23 AM. Reason: More descriptive subject added |
|
#2
|
|||
|
|||
|
A simple method is to:
INSERT INTO table AS (SELECT column1, column2 FROM table2 WHERE column1 = 'X'); if (as in your question) you need to process each record in turn you will need to create an anonomous block (or other progam unit) eg: DECLARE CURSOR csr_test IS SELECT column1, column2 FROM table; BEGIN FOR csr_rec IN csr_test LOOP --additional pre-insert validation here INSERT INTO table VALUES (csr_rec.column1, csr_rec.column2); END LOOP; COMMIT; END; hope this helps. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Easy Oracle Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|