Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Host Command from PlSQL

ramarunSep 2 2011 — edited Sep 2 2011
Hi All

Requirement is to read a Sub-directory in the database and when ever a new Sub-directory is created in a particular Directory, we need a alert to be triggered in to the database. Alert can be of any form, even a insert into a table with all relevant details about the new directory created is enough.

If there is a way of achieving the above requirement without using the below methods please suggest those first before correcting the code below

We have tried with the utility given in this link.

[Oracle base| http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php]

and using the particular OS Command below */bin/ls -alrtd */ /tmp*

This command when executed from OS lists the directories created under /tmp including /tmp. Where as while executing from the below program does not behave so. I am not sure why and where i am going wrong.
DECLARE
     L_OUTPUT DBMS_OUTPUT.CHARARR;
     L_LINES  INTEGER := 1000;
   BEGIN
     DBMS_OUTPUT.ENABLE(1000000);
     DBMS_JAVA.SET_OUTPUT(1000000);
     HOST_COMMAND(' /bin/ls -alrtd */ /tmp ');
     DBMS_OUTPUT.GET_LINES(L_OUTPUT, L_LINES);
     FOR I IN 1 .. L_LINES LOOP
        DBMS_OUTPUT.put_line(L_OUTPUT(I));
       -- DO SOMETHING WITH THE LINE.
       -- DATA IN THE COLLECTION - L_OUTPUT(I)
       NULL;
     END LOOP;
   END;
Can the PRO's clarify and help me out of this.

Thanks in advance.
This post has been answered by Richard Harrison . on Sep 2 2011
Jump to Answer

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 30 2011
Added on Sep 2 2011
3 comments
294 views