http://www.oracle-base.com/articles/8i/shell-commands-from-plsql.php
With the help from your link i was able to deploy this successfully in a linux box.
But the below code is not working as expected in a Windows box
- Code: Select all
DECLARE
L_OUTPUT DBMS_OUTPUT.CHARARR;
L_LINES INTEGER := 1000;
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
DBMS_JAVA.SET_OUTPUT(1000000);
/*
HOST_COMMAND('/bin/sh/ls -alrtd /data/source/');
--HOST_COMMAND('/bin/ls -alrtd /data/source/*'); -- Working from Linux Box
*/
HOST_COMMAND('dir /b /ad d:\rnd\*'); -- Not Working from Windows Box 2008 Server R2
DBMS_OUTPUT.GET_LINES(L_OUTPUT, L_LINES);
FOR I IN 1 .. L_LINES LOOP
DBMS_OUTPUT.put_line(l_output(i));
END LOOP;
END;
/
- Code: Select all
OS Command is - dir /b /ad d:\rnd\*
The above command should lists the directory names under the directory rnd in D Drive, i am trying to spool it into the character array and use it in my application.
Code above works very well when number of directories it reads is below 40 or maximum 50 but when number of directories increases to more than 50 (i.e. in d:\rnd folder if there are more than 50 folders ) the respective ORACLE session just hangs the & i am forced to kill it from the task manager of the oracle database server. Even killing it through Alter system doesnt kills the session.
Any known issues/limitations when this code is put on a windows box. Your inputs would be great help as always.
Thanks in advance.