0

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.

Bill
  • 1,237
  • 4
  • 21
  • 44

3 Answers3

1

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.
Community
  • 1
  • 1
Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
1

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.
Tim Kuehn
  • 3,201
  • 1
  • 17
  • 23
1

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.

Fabian Frank
  • 495
  • 4
  • 9
  • yes, I though about this but the table I need to load into is different then my progress table. That's why I though maybe exporting a temp-table. – Bill Feb 19 '13 at 12:54
  • I think it should be possible to export not only tables but also query results or views. That way you could change the table structure. – Fabian Frank Feb 19 '13 at 16:17