Forum und email

ora_bind

(PHP 4, PHP 5 <= 5.0.5)

ora_bind — Binds a PHP variable to an Oracle parameter

설명

bool ora_bind ( resource $cursor , string $phpvar , string $sqlparam , int $length [, int $type ] )

Binds the named PHP variable with a SQL parameter.

ora_bind() must be called after ora_parse() and before ora_exec(). Input values can be given by assignment to the bound PHP variables, after calling ora_exec() the bound PHP variables contain the output values if available.

매개변수

cursor

An Oracle cursor, opened with ora_open().

phpvar

The PHP variable to be bound.

sqlparam

The SQL parameter. Must be in the form :name.

length

type

Defines the type of the parameter. It defaults to ORA_BIND_INOUT. Possible values are listed below:

Constant Value
ORA_BIND_INOUT 0
ORA_BIND_IN 1
ORA_BIND_OUT 2

반환값

성공할 경우 TRUE를, 실패할 경우 FALSE를 반환합니다. Details about the error can be retrieved using the ora_error() and ora_errorcode() functions.

변경 기록

버전 설명
5.1.0

oracle 확장은 권장되지 않습니다. oci8를 사용하십시오.

3.0.1 The constants for the type were added. In previous versions, you should use the numerical values.

예제

Example#1 ora_bind() example

<?php
  ora_parse
($curs"declare tmp INTEGER; begin tmp := :in; :out := tmp; :x := 7.77; end;");
  
ora_bind($curs"result"":x"$len2);
  
ora_bind($curs"input"":in"51);
  
ora_bind($curs"output"":out"52);
  
$input 765;
  
ora_exec($curs);
  echo 
"Result: $result<br />Out: $output<br />In: $input";
?>

주의

권장되지 않는 oracle을 대신하여 oci8를 사용할 때는 다음을 고려하십시오: