一个语句中的两个查询

时间:2013-08-14 09:11:14

标签: php oracle

我正在使用php并希望在oracle的一个语句中运行两个更新查询。

$x = strtolower($x);
$ore = getOreType($x); //returns ore type as string
$newTotal = getMined($ore)-($x_value*$weight); //adds existing ore quantity to additional quantity
$newTotalComp = $x_value + getComponentQuantity($x); //adds existing component quantity to additional quantity
$query = "UPDATE Material SET quantity=$newTotal WHERE name='$ore'; UPDATE Component SET   quantity=$newTotalComp WHERE name='$x'";
$statement = ociparse($conn, $query);
oci_execute($statement);
oci_free_statement($statement);

我在oci_execute上遇到以下错误....

 oci_execute(): ORA-00911: invalid character

是否可以在同一语句中运行这两个更新?它适用于Oracle SQL Developer。

TA

1 个答案:

答案 0 :(得分:0)

尝试

$query = "UPDATE Material,Component 
          SET Material.quantity=$newTotal , Component.quantity=$newTotalComp 
          WHERE Material.name='$ore' AND  Component.name='$x'";