Is there any way to invoke or execute Unix command from Oracle PL/SQL? Hostcommand will be the answer where it is another alternative way for Unix call and we don’t need to write any shell script to achieve the execution.
Hostcommand is a function or utility in Oracle database which was used to pass in command to Unix operating system for execution.
We mentioned that we can call the hostcommand in either SQL or PL/SQL in our previous post of HostCommand Unix Call From Oracle SQL.
The example below shows on how we call the sqlldr binary from Unix database machine using hostcommand feature in PL/SQL.
The reason of why we are calling the sqlldr from Unix machine was the version of 10.x can be used to load the XML data file into database.
CREATE OR REPLACE PROCEDURE APPS.ORACLE_XML_SQLLDR
(errbuf OUT varchar2, retcode OUT NUMBER) IS
fnd_file.put_line(fnd_file.log,'Launch sqlldr from Unix database machine');
fnd_file.put_line(fnd_file.log,'sqlldr_runtime = '||
control=<.ctl location> log=<.log location>'));
Next» ORA-29283 Invalid File Operation sys.utl_file