Skip to main content

Posts

Generate SQL Loader Control Files

There is an easy way to generate SQL Loader control files using SQL Developer Import functionality as described by the post below http://www.thatjeffsmith.com/archive/2012/08/using-oracle-sql-developer-to-setup-sqlloader-runs/ Using Oracle SQL Developer to Setup SQL*Loader Runs by  thatjeffsmith   on August 15, 2012   55 comments Tell Others About This Story: 0 1 0 I've done a couple of posts on how to use SQL Developer to load your Excel files to an Oracle table. However, I always wonder how many folks realize there may be a 'better way.' If you are loading data to Oracle on a regular basis, there's a few things I want you to know about: SQL*Loader Data Pump External Tables SQL*Loader is a client tool. It runs on your desktop and connects to the database over SQL*Net. It's part of the Oracle Client installation. It reads one or more files, parses the data, and loads it to your tables. A control (CTL) file that defines how the data i...

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;

Local GitHub setup and push

After setting up a GitHub account, configure your local repository, using gitbash Create a folder for your local repository    mkdir /c/localrepo    cd /c/localrepo Git localrepo config    git config –global user.name “username”    git config –global user.email “youremail@yourdomain”    git init    git remote add origin  https://github.com/username/repository.git Copy/Create your file in your local repository and configure it for git    git add File.txt    git commit -m “Add a comment for your addition/update” Push your file from your localrepo to your GitHub repository    git push warning: push.default is unset; its implicit value has changed in Git 2.0 from ‘matching’ to ‘simple’. To squelch this message and maintain the traditional behavior, use:   git config –global push.default matching To squelch this message and adopt the new behavior now, use:   git config –g...

Using the assigned value of a variable as a dynamic variable (unix)

I was in a situation where I had to find a simple way to a variable mapping. The script whatIs would have to translate the received parameter  into the predefined values within the script. I wanted something straightforward, and didn't want to do a series of ifs to compare the contents.  The easiest solution I found was to simply use 'eval' to retrieve the matching value of the passed parameter and provide me with the correlated value. whatIs: orange="fruit" potato="vegetable" cod="fish" eval "v=\$$1" echo $v Call script whatIs with parameter orange and the output will be the value assigned to orange in the script. whatIs orange > fruit As for my use case, I would then use the output ( in this example: fruit ) as a variable name and use in my program.