validate Oracle non-SELECT query

FRANKTHETANK

New Member
Is there any way to check if an SQL query for Oracle would run successfully (by successfully I mean that the query is syntactically correct, all the table/column names exist, the user has proper permissions, etc.) without actually running it? The query may be not SELECT, but I do not want the changes to actually happen if it would modify any data. I thought about something like:\[code\]$valid = false;$stmt = oci_parse($db, $query);if(!empty($stmt)) { $res = oci_execute($stmt, OCI_DESCRIBE_ONLY|OCI_NO_AUTO_COMMIT); if(!empty($res)) { $name = oci_field_name($res, 1); if(!empty($name)) { $valid = true; } } oci_rollback($db);}\[/code\]But if $query has some DDL in it, I understand that Oracle would commit it immediately. So is there any way to check the query without any modifications happening?
 
Top