MOO.EXTERNAL.CALL


Process to run an external task to the Oracle DBMS_Scheduler.  This may be one of a number of predefined tasks or a shell script held on the server.  


Syntax


            call moo.external.call([Job{LSDIR|CHMOD|MAIL|MAIL_ATTACH}],

                                 [Argument1],[Argument2],[Argument3],[Argument4],

                                  [Enable],[AddBit],

                                   [Execute])


       where        LSDIR                         Lists the files in a provided directory

               CHMOD                Changes the permissions on a given file

               MAIL                        Send an email from OLAP provided that mailx has been installed

               MAIL_ATTACH                Send an email from OLAP provided that mails has been installed



Definitions


       Job                                Name of the predefined job

       Argument[1-4]                        Individual arguments to be passed to the job

       Enable                                Object holding the row descriptions of the dimension values        

       AddBit                                Object holding the column descriptions of the dimension values        

       Execute                        Name of a shell script to be run

               


Return Value


               none


Examples


       List all files in database directory alias MOOCDA  and send to a file [MOOCDA]/tmp.txt


               call moo.external.call('LSDIR', 'MOOCDA' ,  '  ' , 'listfile.txt',  NA, TRUE, FALSE, NA)

                  


       Changes the file permissions of a given file.  Example, Change /tmp/tmp.sh to 777


               call moo.external.call('CHMOD', '777', '/tmp/tmp.sh', NA,NA, TRUE, FALSE, NA)



       To send an email directly from Oracle OLAP. Example, Send an email to me@myobjectiveolap.com


               call moo.external.call('MAIL', 'This is the content', 'Subject: Message from OLAP', 'me@myobjectiveolap.com', NA, TRUE, FALSE, NA)



       To send an email with attachment directly from Oracle OLAP,  Example, Send an email to me@myobjectiveolap.com and attach a copy of the script which sends it


               call moo.external.call('MAIL_ATTACH', '/home/oracle/moochmod.sh', 'moochmod.sh',  

                                     'Subject Sending a file from olap', 'me@myobjectiveolap.com', TRUE, FALSE, NA)


       Running Your own Jobs


       You can pass the name of your own shell script to moo.external.call

       Essentially you could build a script dynamically through an OLAP DML OTF statement and then call this program to run it.

       Often you should change the permissions first. This is done by setting the REQUIRE_ADDBIT argument to TRUE as below.

       Permissions are set to 775.  This is only supported on Unix-like and otherwise POSIX-compliant systems.

       Do not try and set the REQUIRE_ADDBIT on Windows

       

               call moo.external.call('MyJob', 'myArg1stToMyJob', 'myArg2ndToMyJob', 'myArg3rdToMyJob', TRUE, TRUE, '/tmp/myShellScript.sh')


       Example


               call moo.external.call('myJob', '/u01', '/tmp/myjob.out', NA, NA, TRUE, FALSE, '/home/oracle/moolistfiles.sh' )