[请益] 连oracle但无法搜寻中文字串

楼主: SuLaPKLa (= =)   2013-10-23 23:02:35
小弟用perl连结oracle后 欲将sql资料输出在网页上
一般使用都没有问题
但在SQL叙述内如果有使用到中文
比如说:SELECT * FROM $Table where 某字段='某中文条件'
就会抓不到资料 = =
但若抓出来的资料有中文字 则是可以正常显示的
不知道哪边出了问题 请各位大大给一点方向or提示
完整程式码附上
use Win32::ODBC;
# set Data Source Name
$DSN = "Samples";
# Open connection to DSN
if (!($O = new Win32::ODBC($DSN))){
print "Failure. \n\n";
exit();
}
# set Table name
$Table = Product;
# Get the content of the table.
if (! $O->Sql("SELECT * FROM $Table"))
{
# print out the field names.
@FieldNames = $O->FieldNames();
$Cols = $#FieldNames + 1;
for ($iTemp = 0; $iTemp < $Cols; $iTemp++){
$FmH2 .= "$FieldNames[$iTemp] ";
}
chop $FmH2;
print "$FmH2\n";
# Fetch the next rowset
while($O->FetchRow()){
undef %Data;
%Data = $O->DataHash();
print $Data{'ID'}, " ", $Data{'Name'}, " ",
$Data{'Price'}, " ", $Data{'Qty'}, "\n";
}
}
# Close Connection.
$O->Close();

Links booklink

Contact Us: admin [ a t ] ucptt.com