Compile my first Pro*C program — unloader from asktom

  • A+

These days I needed to export some tables to CSV files, and usually I could finish such task using SQLcl, but this time the table is too big (more than 120G) so although I still could export it with SQLcl, I also want to find a more efficient tool.

SQLULDR2 was the first tool I wanted to have a try, and I did try to make it work but got some errors about ORA-24345, and finally I decided to find other tool.

I found below webpage from Tom:

How Can I unload data to a flat file?

From this page I got the source code, while I did spend some time to make it work, and that is why I want to share my experience here.

  1. find your library path, usually under /usr/lib/gcc/x86_64-redhat-linux for RHEL/CentOS/Oracle Linux systems, for me it is /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include.
  2. Add the above path to the $ORACLE_HOME/precomp/admin/pcscfg.cfg
  3. Add below line to the head of the Pro*C source code: #include <stdlib.h>
  4. Try to compile it to C source code
  5. Try to build the C code to execute file
  6. Unload the data as below example
  7. Please check your statement carefully, and convert date and double to char using to_char function.
  8. Compare some sample rows first to make sure you will not miss any valid data


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: