我想知道如何在 PHP 中从 Oracle 获取单行?
检查我的脚本-:我想从ITEM_INFO表中获取单行并将该值与变量$sku和$code进行比较...我应用的逻辑适用于 Mysql 但不适用于 Oracle...
每次 $sku & $code 包含差异。值,所以我只需要将它们与 ITEM_INFO 表进行比较,如果匹配,则更新相同的标志...
$query_fetch = "SELECT ITEM_NAME,SITE_CODE FROM app.ITEM_INFO WHERE ITEM_FLAG = 'N'";
$stmt = oci_parse($conn,$query_fetch);
oci_execute($stmt);
while(($row = oci_fetch_array($stmt, OCI_BOTH)))
{
$ITEM_NAME = ($row["ITEM_NAME"]);
$SITE_CODE = ($row["SITE_CODE"]);
if(($ITEM_NAME === $sku) && ($SITE_CODE === $code))
{
$query_ora_update = "UPDATE app.ITEM_INFO SET ITEM_FLAG= 'Y', LAST_UPDATE_DATE = sysdate WHERE ITEM_NAME = '$sku' AND SITE_CODE = '$code' AND ITEM_FLAG = 'N' ";
$parse_result = oci_parse($conn,$query_ora_update);
$result = oci_execute($parse_result);
oci_commit($conn);
oci_close($conn);
}
}
请指导我...