note 45067 deleted from function.ocibindbyname by sixd
| From: | sixd@php.net | Date: | Wed, 20 Nov 2013 19:49:20 +0000 |
| Subject: | note 45067 deleted from function.ocibindbyname by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197594@lists.php.net to get a copy of this message | ||
Note Submitter: jriley at gamesville dot com
----
To select a value from DUAL, use a length of -1. DUAL is defined as a table of VARCHAR2(1).
ex:
$stmt = OCIParse($conn, "select :VAR from DUAL");
ocibindbyname($stm, ":VAR", &$Var, -1);
For a query using LIKE, put the percent signs in the variable definition and skip the single quotes
you would normally put around the regex in SQL.
ex:
$ename = "%{$ename}%";
$stmt = OCIParse($conn, "select empno from emp where ename like :ename");
OCIBindByName($stmt, ":ename", $ename, 32);
Adding single quotes around :ename in $query will cause an
"ORA-01036: illegal variable name/number" error. Adding them in $ename will add single
quotes to the search string.