[ Please do not top-post.  TIA ]

Gopal Karunakar wrote:
Hi,

Hello,

    Here's the code pasted below. The sub basically executed an anonymous
pl/sql block (which is executing fine). I want to make sure that the user
will not be able to a ctrl-c and exit at the stage where the sql statements
are getting executed.

    I tried declaring it as local but even then its hanging when i give the
interrupt.


sub CopyData
{
   local $SIG{'INT'} = 'IGNORE';

   ($option, $sourceID, $targetID, ) = ($_[0], $_[1], $_[2]);

That is usually written as:

    my ( $option, $sourceID, $targetID ) = @_;


    $option         =~ s/^\s*(\S*(?:\s+\S+)*)\s*$/$1/;
    $sourceID       =~ s/^\s*(\S*(?:\s+\S+)*)\s*$/$1/;
    $targetID       =~ s/^\s*(\S*(?:\s+\S+)*)\s*$/$1/;

That is a very inefficient and non-standard way to remove leading and trailing whitespace:

      s/^\s+//, s/\s+$// for $option, $sourceID, $targetID;


    my $retval;

    $retval = `/$ENV{'ORACLE_HOME'}/bin/sqlplus -s  $QUERY_STRING<<  EOF>>
$db_log

$retval gets the standard output from /$ENV{ORACLE_HOME}/bin/sqlplus but you are redirecting the standard output to >>$db_log so $retval should always be empty.


    WHENEVER OSERROR EXIT 5 ROLLBACK;
    WHENEVER SQLERROR EXIT 10 ROLLBACK;
    SET SERVEROUTPUT ON SIZE 1000000;
    SET FEEDBACK OFF;
    set pagesize 0;
    set linesize 150;

    DECLARE

     ........................

     ............

              COMMIT;

         EXCEPTION

           WHEN OTHERS
            THEN


         o_ret_message :=  'Exception occured -' || ' Module Name:' || g_msg
|| CHR(10) ||
                           'Error Code: ' || SQLCODE || CHR(10) ||
                           'Error Message: ' || SUBSTR(sqlerrm,1,2000) ;

Is that a valid SQL statement? I know that that is not valid in Perl or the shell.


         DBMS_OUTPUT.PUT_LINE (o_ret_message);
         DBMS_OUTPUT.PUT_LINE (DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);


         ROLLBACK;

         END;
/

EOF` ;

return $retval;
}



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to