It seems that DBD:Oracle cant read in columns that have spaces in between. For example the field that this error is reporting is a string of '99602BOB BO3606'. '99602BOB BO3606' is from a VarChar field in SQL Server and going into a Char field in Oracle. It seems to think that it needs commas in the value. I would think that since its being stored as a string in an array that this shouldnt be a problem. So why would Oracle complain about this? The error accurs during the insertion into Oracle database during the while loop($row[0] is '99602BOB BO3606' and thats where it's erroring out). Here is a copy of my code:
#!/usr/bin/perl use DBI qw(:sql_types); use DBD::Oracle qw(:ora_types); # setting up database connection to SQL Server $dblab = DBI->connect('dbi:ODBC:DL_SWIPE','user', 'pass', { RaiseErro +r => 1, odbc_cursortype => 2}); # setting up database connection to CDW-V my $dbv = DBI->connect( 'dbi:Oracle:cdwv','user','pass',) || die "Database connection not made: $DBI::errstr"; #Prepare SQL to create Table $table = $dbv->prepare("Create table DL_SWIPE (CR_APLT_I char, FRST_N +char, MID_INIL_N char, LAST_N char, SSN_I char, ID_I char, ISS_ST_C c +har, BIRTH_D char, ADDR_LINE_1_T char, ADDR_LINE_2_T char, CITY_N cha +r, ST_C char, PSTL_C char, ID_ISS_D char, ID_EXPR_D char, ID_SCAN_MET +H_C char, ID_REC_CHG_F char, ID_SYS_RESP_C char)"); # # Execute create Table stmt $table->execute( ); ### Prepare a SQL statement for execution $sth = $dblab->prepare( "SELECT * FROM CR_APLT_ID_CD"); ### Execute the statement in the database $sth->execute; ### Retrieve the returned rows of data while ( @row = $sth->fetchrow_array( ) ) { print @row; ### Errors out here, $row[0] where the scalar = '99602BOB BO3606' $inserted = $dbv->prepare("INSERT INTO DL_SWIPE VALUES ($row[0], $row[1], $row[2],$row[3],$row[4], $row[5],$row[6],$row[7], $row[8],$row[9],$row[10],$row[11],$row[12],$row[13],$row[14],$row[15 +],$row[16], $row[17],$row[18])"); $inserted->execute(); } ### Disconnect from the database $dblab->disconnect or warn "Error disconnecting: $DBI::errstr\n"; exit; # ### Disconnect from the database $dbv->disconnect or warn "Error disconnecting: $DBI::errstr\n"; exit;
Thanks in advance, Fuism

In reply to DBD:Oracle::db prepared error by Fuism

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.