note 45067 added to function.ocibindbyname

From: Date: Tue, 24 Aug 2004 22:16:52 +0000
Subject: note 45067 added to function.ocibindbyname
Groups: php.notes 
Request: Send a blank email to php-notes+get-75230@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.ocibindbyname.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45067 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45067&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45067&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75230) next »