The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-20-2009
shary shary is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 61
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
  #2 (permalink)  
Old 01-22-2009
shary shary is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 61
hi
any updates?
  #3 (permalink)  
Old 01-22-2009
SFNYC SFNYC is offline
Registered User
  
 

Join Date: Jun 2008
Location: New York City
Posts: 95
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.
  #4 (permalink)  
Old 01-22-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,813
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0