由于 oracle 中没有现成的功能来验证这样创建的查询。所以我尝试了下面的代码来检查 QUERY 是否有效。
if(isset($_POST['btn_Submit_Query']))
{
$check_query=$_POST['txtQuery'];
echo $check_query;
$valid = false;
$stmt = oci_parse($DB, $check_query);
echo "Statement" . $stmt;
//oci_define_by_name($stmt, 'NUMBER_OF_ROWS', $number_of_rows);
oci_execute($stmt, OCI_DEFAULT);
echo oci_num_rows($stmt);
}
我在执行中收到以下警告:
Warning: oci_parse() expects parameter 1 to be resource, object given in D:\xampp\htdocs\app\DashBoardSite\Admin\querybuilder.php on line 899
Statement
Warning: oci_execute() expects parameter 1 to be resource, null given in D:\xampp\htdocs\app\DashBoardSite\Admin\querybuilder.php on line 902
Warning: oci_num_rows() expects parameter 1 to be resource, null given in D:\xampp\htdocs\app\DashBoardSite\Admin\querybuilder.php on line 903
我的错误在哪里?