0

我正在使用 PHP 和 Oracle OCI8 创建一个在线系统。

这里的任何人都遇到了错误:

Warning: oci_bind_by_name() [function.oci-bind-by-name]: Error while trying to retrieve text for error ORA-01036 in dbcontrol.php on line 50
Success 

这是我的 dbcontrol.php:

function plsql_insert($plsql, $array){
        $this -> connect(); //Create Database Connection
        $this -> statement = oci_parse($this -> conn, $plsql); //Prepare the statement to call PL/SQL stored procedure

        foreach ($array as $key => $value){
            oci_bind_by_name($this -> statement, $key, $array[$key]);
        }

        $this -> execute = oci_execute($this -> statement); //Execute the statement
        $this -> result = ($this -> execute) ? "Success" : "Failed";
        return $this->result;
    }

这是我调用该函数的代码:

include "../dbaseconn/dbcontrol.php";

extract($_GET);

$personalBackground = explode(",",$personalBackground);

$arrPersonal = array();

foreach($personalBackground as $val)
{
    $tmpData = explode("*",$val);
    $arrPersonal[$tmpData[0]]=$tmpData[1];
}
$arrPersonal[':REC_NO'] = '4';
$plsql = "call TEST.INSERT_BACK_PERSONAL(:NAME_LAST,:NAME_FIRST,:NAME_MIDDLE,:PRESENT_ADDRESS,:MOBILE_PHONE,:PERMANENT_ADDRESS,:HOME_NUMBER,:DATE_OF_BIRTH,:BIRTH_PLACE,:CIVIL_STATUS,:SSS_NO,:TIN,:PHILHEALTH_NO,:HDMF_NO,:BLOOD_TYPE,:GENDER,:GOV_LICENSE,:EMAIL_ADDRESS,:REC_NO)";
$dbcontrol = new DbControl;
echo $dbcontrol->plsql_insert($plsql,$arrPersonal);

还有我的 PL/SQL 块:

CREATE OR REPLACE PACKAGE BODY RECRUIT.TEST AS                        


 PROCEDURE INSERT_BACK_PERSONAL( v_NAME_LAST IN VARCHAR2,
                  v_NAME_FIRST IN VARCHAR2,
                  v_NAME_MIDDLE IN VARCHAR2,
                  v_PRESENT_ADDRESS IN VARCHAR2,
                  v_MOBILE_PHONE IN VARCHAR2,
                  v_PERMANENT_ADDRESS IN VARCHAR2,
                  v_HOME_NUMBER IN VARCHAR2,
                  v_DATE_OF_BIRTH IN CHAR,
                  v_BIRTH_PLACE IN CHAR,
                  v_CIVIL_STATUS IN CHAR,
                  v_SSS_NO IN VARCHAR2,
                  v_TIN IN VARCHAR2,
                  v_PHILHEALTH IN VARCHAR2,
                  v_HDMF_NO IN VARCHAR2,
                  v_BLOOD_TYPE IN VARCHAR2,
                  v_GENDER IN CHAR,
                  v_GOV_LICENSE IN VARCHAR2,
                  v_EMAIL_ADDRESS IN VARCHAR2,
                  v_REC_NO IN VARCHAR2
                  )

                  --out_data out CV_TYPE

IS           


BEGIN           
          INSERT INTO  RECRUIT.BACK_PERSONAL (REC_NO, NAME_LAST,NAME_FIRST, NAME_MIDDLE, 
                                              PRESENT_ADDRESS, MOBILE_PHONE, PERMANENT_ADDRESS,  
                                              HOME_NUMBER, DATE_OF_BIRTH, BIRTH_PLACE, CIVIL_STATUS, 
                                              SSS_NO, TIN, PHILHEALTH_NO, HDMF_NO,  
                                              BLOOD_TYPE, GENDER, GOV_LICENSE, EMAIL_ADDRESS, INSERTDATE)
          VALUES (v_REC_NO, v_NAME_LAST, v_NAME_FIRST, v_NAME_MIDDLE,
                  v_PRESENT_ADDRESS, v_MOBILE_PHONE, v_PERMANENT_ADDRESS,
                  v_HOME_NUMBER, v_DATE_OF_BIRTH, v_BIRTH_PLACE, v_CIVIL_STATUS, 
                  v_SSS_NO, v_TIN, v_PHILHEALTH, v_HDMF_NO, 
                  v_BLOOD_TYPE, v_GENDER, v_GOV_LICENSE, v_EMAIL_ADDRESS, SYSDATE
                  );
          commit;


END INSERT_BACK_PERSONAL;  

当我尝试这个时,我可以成功插入到我的数据库中,但我收到了警告:ORA-01036。这有点烦人。

如何解决这个问题?

4

1 回答 1

0

请访问此答案它与您想要的相同......它只是直接编写的PL / SQL块而不是调用过程......

从 php 中的 pl/sql 函数中恢复 varchar2 表

于 2013-09-04T09:04:52.647 回答