oci

■■接続
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
■■select
$stmt = oci_parse($conn, 'select * from t where pk = :id');
oci_bind_by_name($stmt, ':id', $id, -1);
oci_execute($stmt, OCI_DEFAULT);
■取得①
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
}
■取得②
oci_define_by_name($stmt, 'USRID', $userid);
oci_define_by_name($stmt, 'UNAME', $name);
while (oci_fetch($stid)) {
echo "Hello $userid is $name
\n";
}
■取得③
while (oci_fetch($stid)) {
echo oci_result($stmt, 'USRID') . " is ";
echo oci_result($stmt, 'UNAME') . "
\n";
}
■■リソースの解放
oci_free_statement ( $stmt )