Create a table using OCI
Next we will create an email Personal Information Book. This time the oci8 API command is used
Related PHPCode:
Putenv ("oracle_sid = orasid ");
$ Connection = ocilogon ("username", "password ");
If ($ connection = false ){
Echo ocierror ($ connection )."
";
Exit;
}
$ Query = "create table email_info ".
"(Fullname varchar (255), email_address varchar (255 ))";
$ Cursor = ociparse ($ connection, $ query );
If ($ cursor = false ){
Echo ocierror ($ cursor )."
";
Exit;
}
$ Result = ociexecute ($ cursor );
If ($ result = false ){
Echo ocierror ($ cursor )."
";
Exit;
}
Ocicommit ($ connection );
Ocilogoff ($ connection );
?>
We can see that the two sections of code have almost the same syntax, with only different function names. Secondly, in oci8, we do not need to specifically run the command to open the cursor, when the ociparse system is called, a cursor ID is automatically returned.