Help with calling SQL Loader from a function [message #70324] |
Sun, 26 May 2002 06:24 |
John Adali
Messages: 2 Registered: May 2002
|
Junior Member |
|
|
Hi,
I'm trying to call SQL Loader from a function to bulk insert some data into an Oracle database, using Windows NT. If I open a command window and call the SQL Loader program directly, everything works just fine. I have created a function that calls SQL Loader, but when I call this function from SQL Worksheet, the data is inserted into the database, but the function never returns, stating it is finished. Can anyone help me with this problem? I need to have the function return, so I know when the data is inserted. Here is the code that I'm using:
connect sys/change_on_install
grant create any library to scott;
connect scott/tiger
create or replace library clib as 'c:winntsystem32crtdll.dll';
/
CREATE OR REPLACE FUNCTION plsql_system(cmd in varchar2)
RETURN BINARY_INTEGER AS EXTERNAL LIBRARY clibNAME "system";
/
plsql_system('sqlldr userid=adalij/adalij@JHA1 control=c:temptestdata.ctl log=c:tempdata.log errors=100');
/
Please note that I know that the records are being inserted because the log file is generated and the log file says it inserted the data okay.
Any help here is appreciated. Thanks,
John
|
|
|
Re: Help with calling SQL Loader from a function [message #70338 is a reply to message #70324] |
Wed, 29 May 2002 06:37 |
John Adali
Messages: 2 Registered: May 2002
|
Junior Member |
|
|
Upon further investigation, it seems that the SQL Loader app is not returning when finished. If I run the following in a command window, SQL Loader never returns to the command prompt:
sqlldr userid=adalij/adalij@JHA1 control=c:temptestdata.ctl log=c:tempdata.log errors=100
If I remove the 'JHA1' service name portion of the userid parameter, then SQL Loader *does* return properly. In both cases, the data is inserted into the database properly.
Does anyone have any suggestions to help me? I really need a solution for this problem.
Thanks,
John
|
|
|