On a Unix system, is there any way to run SQL*Loader from within a PL/SQL procedure or package? I need variables like the input file name and other info that is collected from a parameter table in order to complete the load.
There's not a direct way to do so. You can read the tables you need and then use UTL_FILE to write to your SQL*Loader parfile or something similar in PL/SQL. You could also simply write a shell script to start SQL*Plus and execute a query that pulls back the data you need and then pipe that data to the next command in your script which would be to run SQL*Loader.
For More Information
- Dozens more answers to tough Oracle questions from Karen Morton are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.