in reply to Re: Calling Stored procedure from perl
in thread Calling Stored procedure from perl

Thank you very much for your reply. can u please tell me what is happening here and what i need to learn to understand below code.

my $sql = qq|$strStoredProc $strArg|; if ($mydb->Sql($sql)) { Win32::ODBC::DumpError(); } if ($mydb->FetchRow()) { %DataSet = $mydb->DataHash(); $strResultValue = $DataSet{$strResultField}; } else { writelog(info,"No row found for $strResultField"); $mydb->Close(); } $mydb->Close();

Replies are listed 'Best First'.
Re^3: Calling Stored procedure from perl
by Utilitarian (Vicar) on Mar 02, 2010 at 08:54 UTC
    Take a look through perldoc Win32::ODBC this will introduce the concepts you need to follow this code and define the methods used in your snippet.

    Essentially it creates a string of the stored procedure and argument(s) and then makes a single row selection from the results of this procedure which it returns as a hash and checks for a value in the field specified in the variable $strResultField

    In this specific caseExecStoredProcedureArg1("pr_CustomForPV",  "$VersionID,$AutoNumber", "IsCustom") it runs the pr_CustomForPV procedure with the values in $VersionID and $AutoNumber and checks to see if the IsCustom field is set

    print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."