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.
-
5What have you done so far? Any error you are getting?Nitish– Nitish2017-03-27 05:39:05 +00:00Commented 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?user2082599– user20825992017-03-27 07:32:23 +00:00Commented 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.AspiringDeveloper– AspiringDeveloper2017-03-27 10:55:50 +00:00Commented 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.user2082599– user20825992017-03-27 11:02:35 +00:00Commented Mar 27, 2017 at 11:02
Add a comment
|
1 Answer
Shell script can't connect to database itself. Some ways to do it:
- call
sqlplusin 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 - Use UTL_FILE to write to disk from Oracle directly, without shell script.
- Use another language to connect to oracle and read data and write it to a file(java, python, etc.)