![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help needed at awk function | rider29 | Shell Programming and Scripting | 2 | 06-03-2008 11:54 AM |
| Help needed to Keep calling a function after every 5 seconds. | nua7 | Shell Programming and Scripting | 11 | 03-25-2008 08:08 AM |
| Help needed in function calling in a script | jisha | Shell Programming and Scripting | 3 | 01-15-2008 07:48 AM |
| ORACLE return a function to Solaris | Rafael.Buria | Shell Programming and Scripting | 1 | 10-23-2007 06:38 PM |
| i want to call a oracle function in my shell script | dineshr85 | Shell Programming and Scripting | 4 | 10-16-2007 12:18 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Oracle Function Needed
Dear Experts, Please find below the script in perl and can any body convert this script exactly in to oracle 9i fiunction which will return the required result same as perl. Code:
#!/usr/bin/perl
$nof=@ARGV;
@var2 = ();
for($n=0; $n<$nof; $n++)
{
$filename = @ARGV[$n];
open (input, "<$filename");
while(<input>)
{
chomp;
@var3 = split(',',$_);
$cnt_var3 = @var3;
if(@var3[2] eq '501')
{
if($cnt_var3 eq '214')
{
for($i=0,$j=27; $i<15; $i++)
{
@var2[$i]+=@var3[$j];
$j = $j + 13;
}
}
else
{
for($i=0,$j=27; $i<15; )
{
@var2[$i]+=@var3[$j];
$k = $j + 5;
if(@var3[$k] eq '|')
{
$j = $j + 11;
}
else
{
$j = $j + 13;
$i++;
}
}
}
}
}
close (input);
}
$sum = 0;
for($i=0; $i<15; $i++)
{
print "@var2[$i],";
$sum+=@var2[$i];
}
print "$sum\n"
Thanks Last edited by Franklin52; 01-20-2009 at 03:23 PM.. Reason: adding code tags |
|
||||
|
What does the input look like? What should the output be?
If you are going to read files, you have to make sure that you have permissions to read file systems from Oracle - which only a DBA can set up. What have you tried so far? I'd recommend asking people on an Oracle specific forum for the answer to this. |
|
||||
|
Oracle has a DBA-specified startup parameter called utl_file_dir which tells Oracle to use that directory only for file input/output for packages (functions, triggers, etc) running inside that instance of Oracle.
Plus as SFNYC, mentioned it is impossible for someone here to port the perl code based the above to an Oracle db function. It is a fairly major deal in terms of schema information, input output required, etc. You need an Oracle forum. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|