-2

I want to fetch the record from oracle database in oracle procedure and develop a shell script to call oracle procedure and convert fetched data in .dat file how would i achieve it.

4
  • 5
    What have you done so far? Any error you are getting? Commented Mar 27, 2017 at 5:39
  • Let me get this straight. You want a oracle procedure to to get certain values from a table, then create a shell script using this data and the shell script should convert data in a .dat file? Commented Mar 27, 2017 at 7:32
  • @Gerry Yes you got me right. Actually i am new to this so i havent tried yet.but wanted proper direction to do it. Commented Mar 27, 2017 at 10:55
  • it will be best if you use an external language like perl. you can use dbms_scheduler to kick of the script and the perl script can do all the work. You can however issue the scheduler to kick of a shell script directly, but perl will be easier and more robust. Commented Mar 27, 2017 at 11:02

1 Answer 1

0

Shell script can't connect to database itself. Some ways to do it:

  1. call sqlplus in a shell script using spool option. There are question on SO about this subject, for example: How to create a oracle sql script spool file
  2. Use UTL_FILE to write to disk from Oracle directly, without shell script.
  3. Use another language to connect to oracle and read data and write it to a file(java, python, etc.)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.