Skip to main content

Posts

Showing posts from December, 2016

Apache Spark 2.0 - CSV to Oracle Table

A quick exercise to easily load a csv file with header, into an oracle table, using spark ( spark session created when launching spark-shell ) val prop = new java.util.Properties prop.setProperty("user","username") prop.setProperty("password","password") val vd = spark.read.option("header", "true").option("quote","'").option("escape","^").csv("file:///C:/tmp/test.csv") vd.write.mode("overwrite").jdbc("jdbc:oracle:thin:@host:port/SID","table_name",prop)

Oracle Regex for Path

Using Regex_replace you can extract bits of a path stored in an Oracle column using grouping backtracking. select regexp_replace('/tsacrm1/inf/prdcrm1/JEE/CRMProduct/application/attachments/attachments/case/3709/Request to clear.txt.txt', '(.+)\/([^\/]+)\/([^\/]+)\/([^\/]+)\.([^\/]+)$','\3') from dual;