0
오케이, PHP/Oracle 커넥터를 처음 사용합니다. 내가 뭘 하려는지 ID 번호를 받아 값을 반환하는 간단한 저장 프로 시저를 호출합니다. 일치하는 항목이 있으면 잘 작동하지만 일치하지 않으면 조건부 논리를 추가하는 방법을 이해할 수 없습니다. 기본적으로 일치하는 것이 있으면 $ strategy를 설정하고, 일치하지 않으면 $ strategy를 NULL로 설정하십시오.PHP Oracle Ref 커서
$sql = 'BEGIN STOREDPROCEDURENAME(:v_id_number, :entries); END;';
$stmt = oci_parse($conn, $sql);
oci_bind_by_name($stmt,':v_id_number',$id_number,32);
// Create a new cursor resource
$entries = oci_new_cursor($conn);
// Bind the cursor resource to the Oracle argument
oci_bind_by_name($stmt,":entries",$entries,-1,OCI_B_CURSOR);
// Execute the statement
oci_execute($stmt);
// Execute the cursor
oci_execute($entries);
while ($entry = oci_fetch_array($entries)) {
$strategy = $entry['STRATEGY'];
}
oci_close($conn);