Browsed by
Tag: oracle

Load database from CSV with columns and tables read from file.

Load database from CSV with columns and tables read from file.

The issue at hand here is to load a database with CSV-files in a generic way without having to write separate script for each table. This short Groovy-script is working based on two conventions: The name of the CSV-file matches the name of the table in the database. The name of the CSV-header matches the name of the column in the table. The script requires the CSV-files to be read in the folder “to_digest”. The connection details is placed in…

Read More Read More

Safe functions for casting numbers and timestamp in Oracle SQL

Safe functions for casting numbers and timestamp in Oracle SQL

In the process of importing data which can be irregular from a flat file it is convenient to import all values as character strings, in this case Oracle’s varchar2, and then cast them into the proper format using the built-in datatype converters as e.g. to_number. The problem occurs when some value which is not convertible is stored in the column. This could be either because table column-overflow in the import process or because the value is optional and may be…

Read More Read More