Bona:
You're using OCIParse incorrectly. It's used to parse SQL commands. The var
statement that you quoted is a SQL*Plus command. That is, you're defining a
variable in SQL*Plus. That's why you're getting an Invalid SQL Command
error.
Use the OCIBindByName to bind a PHP variable (you're using test) to an
Oracle placeholder, which is denoted by a preceding colon.
e.g.,
$sql = "INSERT INTO emp (ename) VALUES (:ename_placeholder);";
$stmt = OCIParse($conn, $sql);
OCIBindByName($stmt,":ename_placeholder",$empno,32);
$empno = "Bona";
OCIExecute($stmt, OCI_DEFAULT);
Please let me know if this makes sense,
Anthony Carlos
> From: [EMAIL PROTECTED]
> Date: Mon, 10 Sep 2001 11:10:04 -0800
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] creating an Oracle variable...
>
> Hi,
>
> I creat the variable "test" using the sql plus:
>
> var test varchar2(10);
>
> I´ve been trying to do it wiht PHP:
>
> ================================================
> $comando1 = "exec var test varchar2(10);";
>
> $controle = OCIParse ($connection, $comando1);
> if ($controle == false){
> echo OCIError($controle)."<BR>";
> }
>
> $result1 = OCIExecute ($controle);
> ================================================
>
> I tryed $comando1 using begin and without the exec... with and without the
> ";" on the end...
>
> but I allways have the same message: Invalid SQL Command...
>
> can anybody help me???
>
> thanks
>
> Bona
>
> __________________________
> Visite http://www.trama.com.br
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]