Whether you are dealing with a query operation, selecting data from a database, or performing a DML operation, modifying database data, both parsing (preparing for execution) and executing are required when it comes to processing an SQL statement with OCI8. Besides these required steps, there may be a few optional steps, such as binding PHP variables to Oracle placeholders that you can perform after you have parsed the statement, but have not yet executed it.
Once a connection to the database is established and the query string is defined, you can go ahead and prepare the statement for execution using the oci_parse
function, passing to this function the database connection and the SQL statement string as the arguments.
As you saw in the sqlproc.php
script discussed earlier in this chapter, oci_parse
returns the statement identifier that can be then passed to oci_bind_by_name, oci_define_by_name, oci_set_prefetch...