#!/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', { RaiseError => 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 char, BIRTH_D char, ADDR_LINE_1_T char, ADDR_LINE_2_T char, CITY_N char, ST_C char, PSTL_C char, ID_ISS_D char, ID_EXPR_D char, ID_SCAN_METH_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;