Re: How to solve Orcale 8 Error: ORA-01036: illegal variable name/number??
| From: | Thies C. Arntzen | Date: | Tue, 23 Jan 2001 20:56:27 +0000 |
| Subject: | Re: How to solve Orcale 8 Error: ORA-01036: illegal variable name/number?? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6114@lists.php.net to get a copy of this message | ||
On Tue, Jan 23, 2001 at 04:57:02PM +0800, Koala wrote:
> Here is the code:
> $arr_var = Array();
> $arr_var[] = Array("KEY"=>'rec_id',
> "VALUE"=>'000000', "LENGTH"=>-1);\
> ......
> $stmt = OCIParse('DECLARE rec_id NUMBER(20); SELECT recNum INTO rec_id FROM
> table WHERE recNum= 2 ');
> ......
> $num_rows = count($arr_var);
> for ($i=0; $i<$num_rows; $i++) {
> if (is_array($arr_var[$i])) {
> OCIBindByName($stmt, $arr_var[$i]['KEY'], $arr_var[$i]['VALUE'],
> $arr_var[$i]['LENGTH']);
> }
> }
> ....
>
> When it is execute, it return: OCIBindByName: ORA-01036: illegal variable
> name/number
DECLARE is implemented in sqlplus and not part of oracle's
SQL - you should be find by just saying:
$stmt = OCIParse('SELECT recNum INTO rec_id FROM table WHERE recNum= 2 ');
ocibindbyname($stmt,"REC_ID",$rec_id,128);
tc