daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $sql = "begin some_procedure(:ID,  :JSON);";  
  2.     try{  
  3.       $i=0; //ID  
  4.       $arr[$i]['name']='ID';  
  5.       $arr[$i]['val']=$id;  
  6.       $arr[$i]['len']=10;  
  7.  
  8.       $i=0;
  9.       $res[$i]['name']='JSON';
  10.       $res[$i]['len']=1000;
  11.  
  12.       $res=db_call_func($sql, $arr, $res, $conn);  
  13.       var_dump($res["JSON"]);
  14.      }catch(Exception $exc) {
  15.       var_dump($exc->getMessage());
  16.     }
  17.  
  18.  
  19.   function db_call_func($sql,$arr=null,$res=null, $conn){
  20.     $stmt = oci_parse($conn, $sql);
  21.     foreach ($arr as $a){
  22.       oci_bind_by_name($stmt, ":".$a['name'], $a['val'], $a['len']);
  23.     }
  24.     $resarr = [];
  25.     foreach ($res as $r){
  26.       oci_bind_by_name($stmt, ":".$r['name'], $resarr[$r['name']], $r['len']);
  27.     }
  28.     oci_execute($stmt);    
  29.     oci_commit($conn);
  30.     $resarr['stmt']=$stmt;  
  31.     return $resarr;  
  32.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top