Reputation: 1247
Version: 10.2b
So lets say I have a table dogs in progress:
table: dogs
fields: name, age, breed
I want to load them into oracle database using the standard load utility. But the table in oracle looks like this
table: dog
fields: name, age, date_last_updated
so if i make a temp-table matching this, is there a way to 'dump' the temp table into sql? (so that i can load it into oracle)
If not, that is a fine answer too.
Thanks for any help!!
EDIT: By 'sql dump' I mean:
INSERT INTO dog
VALUES (Max, 5, Feb 18, 2013)
is there any way to get the table in this format other then exporting the words "INSERT INTO" into my file.
Upvotes: 0
Views: 3483
Reputation: 14020
Thanks for the clarification.
From the 4GL the "natural" way to dump a table (either a real table or a temp-table) would be to use the EXPORT statement to create a text file. Like so:
/* export the dog record as-is
*/
output to "dog.d".
for each dog no-lock:
export dog.
end.
output close.
or:
/* export modified dog records
*/
output to "dog.d".
for each dog no-lock:
export dog.name dog.age now.
end.
output close.
This Oracle: Import CSV file suggests that importing CSV files into Oracle is possible so you could modify the code above like so to create a comma separated file rather than using Progress' default space delimiter:
/* export modified dog records to a CSV file
*/
output to "dog.csv".
for each dog no-lock:
export delimiter "," dog.name dog.age now.
end.
output close.
Upvotes: 1
Reputation: 495
Using a Database Management Tool with ODBC Support (DBeaver for example) you can connect to progress Databases and export Tables and Views to SQL Inserts.
Upvotes: 1
Reputation: 3251
Based on your question, something like this would work. You can also replace the "TT" references with the actual table name.
OUTPUT TO VALUE("sqldump").
FOR EACH tt-dogs:
PUT UNFORMATTED
"INSERT INTO dog VALUES (" tt-dogs.dog-name tt-dogs.age TODAY ")" SKIP.
END.
OUTPUT CLOSE.
Upvotes: 1