'Call Perl Script from PLSQL Package
I'm new to Perl/Java/PLSQL thing so I'm doing some research on how can I call a perl script from the pl/sql package but unfortunately all I can see is, from Perl calling the Oracle OR setup in the dbms_scheduler.
I need to create a package where I will get file name and it's last modified date from the sftp server, because I will print it in a report.
First, I will create a perl script that will connect to the SFTP server, in order for me to do that, I'll be following this Net::SFTP Module
Then, I will list all the files and it's last modified dates. This is a sample script (sample.pl).
#!/usr/bin/perl
use strict;
use warnings;
my $directory = '/testdir';
my $modtime = ();
my $f_detail = ();
opendir (DIR, $directory) or die $!;
while (my $file = readdir(DIR)) {
my $modtime = (stat $file)[9];
my $timestamp = localtime($modtime);
$f_detail = $file.' '.$timestamp;
print "$f_detail\n";
}
closedir(DIR);
After that, I need to call the sample.pl from the plsql package. Based on my research, I need to create a Java Stored Procedure, but I don't know how.
Are the procedures just fine? or is there a better way where I can just connect from the PLSQL to SFTP and just what i need?
And can someone help me in the Java Stored Procedure?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
