[請益] 連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