$user = "myuser"; $pass = "mypass"; $dbh = DBI->connect("DBI:ODBC:MYDB",$user, $pass) || print "Connect to MYDB fail: $!"; #Here the SQL will not contain the values. The values (@array_accnumber) are passed in during each execution. #Instead of actually putting values in the sql,placeholders (?) are used instead. #Then the statement can be reused a bunch of times with different data sets. #It has a number of advantages with regards to security, performance, and reusability. my $p_str = join ',', ('?') x @array_accnumber; print "
L 1437 - \$p_str - @array_claim
"; $sql= "SELECT C58MASTER.CCLM, C58MASTER.CLIN FROM C58MASTER WHERE C58MASTER.CCLM IN ( $p_str ) AND C58MASTER.CLIN=$X_LINE "; my $sth = $dbh->prepare( $sql ); $sth->execute( @array_claim )|| die $sth->errstr; while (my $pointer = $sth->fetchrow_hashref){ #more code here...till I can use RETURN of the result data found... } $sth->finish; #done