I need to pass a physical file( or the contents of that file), that contains code to create an Oracle stored procedure into DBD-Oracle. So like SQL PLus, where I'd say  SQL> @package.spb, I have been trying to do all sorts of things with $DBH->prepare / do / etc. As of right now, this is not working:
# load file contents open (FILEDATA, "$sql"); while ($record = <FILEDATA>) { print $record; } close(FILEDATA); # prepare the stored procedure if ($sth = $DBH->prepare( $record )){ # execute the stored procedure if ($sth->execute()){ print $LOG "it made it: $HoH{$filename {'full_filename'} \n"; + $HoH{$filename}{'build_state'} = 'COMPILED'; } else { # update the hash, since we will not be loading this one print $LOG "couldnt excute: $HoH{$filename {'full_filename'} \n"; + $HoH{$filename}{'build_state'} = 'FAILED - COULD NOT EXECUTE'; + } } else { # update the hash, since we will not be loading this one print $LOG "couldnt prepare: $HoH{$filename {'full_filename'} \n"; + $HoH{$filename}{'build_state'} = 'FAILED - COULD NOT PREPARE'; } # preparing sql
When executed, I get: DBD::Oracle::db prepare failed: ORA-24373: invalid length specified for statement (DBD ERROR: OCIStmtPrepare) at C:\Tronweb\TW_AUTOMATED_BUILDS\scripts\release_cvs_to_dev.pl line 261. This file that I'm trying to prepare is small, and I've even set up my Oracle session as:
#Open an Oracle session $DBH = DBI->connect( "dbi:Oracle:$sid", $usr, $pwd ) or die "Unable to connect to $sid: $DBI::errstr"; $DBH->{RaiseError} = 1; $DBH->{LongReadLen} = 5242880; $DBH->{LongTruncOk} = 0;
Do you have any suggestions for this dilemma? THANK YOU for any advice / direction that you can provide!

In reply to Passing a file into DBD-Oracle by TJRandall

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.