CREATE OR REPLACE FUNCTION "TRON2000"."DC_F_COD_RANDOM_MMA"
RETURN VARCHAR2 IS
####
CREATE OR REPLACE FUNCTION "TRON2000"."DC_F_COD_RANDOM_MMA"
RETURN VARCHAR2 IS
####
#!/usr/bin/perl -w
use strict;
use warnings;
use 5.010;
$/=undef;
my $start_search_str = 'CREATE OR REPLACE ';
while () {
my $rc;
# if the file contents are in the Oracle extract form
if( $rc = /$start_search_str (.+) \"TRON2000\"\.\"/ .. /(AS|IS)/ ){
# file is the right format - get the next one
last;
} else {
# nope - need to fix them - first - get the part of the string
# between 'CREATE OR REPLACE ' and (AS|IS), then insert
# "TRON2000"."" around the name
my $contents = $_;
$contents =~ /(($start_search_str)(.*)(AS|IS))/si;
my $function_name = $3;
if ($3 =~ /FUNCTION/si) {
$function_name =~ /( FUNCTION(.*) RETURN)/si;
print "NOW: function_name: $function_name\n";
# now substitute and write it back to $rc
};
};
}
__DATA__
CREATE OR REPLACE FUNCTION DC_F_COD_RANDOM_MMA
RETURN VARCHAR2 IS
--
l_random_code1 VARCHAR2(1) ;
RETURN l_random_code ;
--
END dc_f_cod_random_mma ;