插入数据时ora-00936缺少表达式

时间:2017-04-13 18:03:01

标签: php sql oracle sql-insert

我有一个名为“员工”的表格,如下所示:

create table employee
(

employee_id  NUMBER GENERATED ALWAYS AS IDENTITY (START WITH 201714001 
INCREMENT BY 1) ,
employee_name varchar(100),
employee_religion varchar(100),
employee_DOB date,
employee_ssc_gpa varchar(30),
employee_hsc_gpa varchar(30),
employee_graduate_cgpa varchar(30),
employee_post_graduate_cgpa varchar(30),
employee_road_no varchar(50),
employee_house_no varchar(50),
employee_flat_no varchar(50),
employee_zip_code  varchar(50),
employee_district varchar(50),
employee_post_code  varchar(50),
employee_class varchar(50),
employee_fathers_name varchar(50),
employee_mothers_name varchar(50),
employee_fingerprint_id varchar(100),
employee_working_hour_starts  timestamp,
employee_working_hour_ends  timestamp,
employee_image_name varchar(150),


CONSTRAINT EMPLOYEE_EMPLOYEE_ID_pk PRIMARY KEY(EMPLOYEE_ID)
); 

我的php代码如下所示:

$empName              = htmlspecialchars($_POST['employeeName']);
$empReligion          = htmlspecialchars($_POST['employeeReligion']);
$empDOB               = htmlspecialchars(date('m.d.y', strtotime($_POST['employeeDOB'])));
$empSSCGPA            = htmlspecialchars($_POST['employeeSSCGPA']);
$empHSCGPA            = htmlspecialchars($_POST['employeeHSCGPA']);
$empGraduateCGPA      = htmlspecialchars($_POST['employeeGraduateCGPA']);
$empPostGraduateCGPA  = htmlspecialchars($_POST['employeePostGraduateCGPA']);
$empRoadNo            = htmlspecialchars($_POST['employeeRoadNo']);
$empHouseNo           = htmlspecialchars($_POST['employeeHouseNo']);
$empFlatNo            = htmlspecialchars($_POST['employeeFlatNo']);
$empZipCode           = htmlspecialchars($_POST['employeeZipCode']);
$empDistrict          = htmlspecialchars($_POST['employeeDistrict']);
$empPostCode          = htmlspecialchars($_POST['employeePostCode']);
$empClass             = htmlspecialchars($_POST['employeeClass']);
$empFatherName        = htmlspecialchars($_POST['employeeFatherName']);
$empMotherName        = htmlspecialchars($_POST['employeeMotherName']);
$empFingerPrintID     = htmlspecialchars($_POST['employeeFingerPrintID']);
$empWorkingHourStarts = 
htmlspecialchars($_POST['employeeWorkingHourStarts']);
$empWorkingHourEnds   = htmlspecialchars($_POST['employeeWorkingHourEnds']);
$empImage             = htmlspecialchars($_POST['employeeImage']);

,我插入数据库的插入代码如下所示:

$stmt = "INSERT INTO EMPLOYEE
    (EMPLOYEE_NAME,EMPLOYEE_RELIGION,EMPLOYEE_DOB,EMPLOYEE_SSC_GPA,EMPLOYEE_HSC_GPA,
    EMPLOYEE_GRADUATE_CGPA,EMPLOYEE_POST_GRADUATE_CGPA,EMPLOYEE_ROAD_NO,EMPLOYEE_HOUSE_NO,
    EMPLOYEE_FLAT_NO,EMPLOYEE_ZIP_CODE,EMPLOYEE_DISTRICT,EMPLOYEE_POST_CODE,EMPLOYEE_CLASS,
    EMPLOYEE_FATHERS_NAME,EMPLOYEE_MOTHERS_NAME,EMPOLYEE_FINGERPRINT_ID) 
    VALUES (:E_NAME,:E_RELIGION,TO _DATE('" . $empDOB . "','MM/DD/YYYY'),:E_SSC,:E_HSC,
    :E_GRADUATE,:E_POST_GRADUATE,:E_ROAD,:E_HOUSE,:E_FLAT,:E_ZIP,:E_DISTRICT,:E_POSTCODE,
    :E_CLASS,:E_FATHER,:E_MOTHER,:E_FINGER)";
$stid = oci_parse($c1, $stmt);


oci_bind_by_name($stid, ':E_NAME', $empName);
oci_bind_by_name($stid, ':E_RELIGION', $empReligion);
//oci_bind_by_name($stid, ':E_DOB', $empDOB);
oci_bind_by_name($stid, ':E_SSC', $empSSCGPA);
oci_bind_by_name($stid, ':E_HSC', $empHSCGPA);
oci_bind_by_name($stid, ':E_GRADUATE', $empGraduateCGPA);
oci_bind_by_name($stid, ':E_POST_GRADUATE', $empPostGraduateCGPA);
oci_bind_by_name($stid, ':E_ROAD', $empRoadNo);
oci_bind_by_name($stid, ':E_HOUSE', $empHouseNo);
oci_bind_by_name($stid, ':E_FLAT', $empFlatNo);
oci_bind_by_name($stid, ':E_ZIP', $empZipCode);
oci_bind_by_name($stid, ':E_DISTRICT', $empDistrict);
oci_bind_by_name($stid, ':E_POSTCODE', $empPostCode);
oci_bind_by_name($stid, ':E_CLASS', $empClass);
oci_bind_by_name($stid, ':E_FATHER', $empFatherName);
oci_bind_by_name($stid, ':E_MOTHER', $empMotherName);
oci_bind_by_name($stid, ':E_FINGER', $empFingerPrintID);
oci_bind_by_name($stid, ':E_WORKINGSTARTS', $empWorkingHourStarts);
oci_bind_by_name($stid, ':E_WORKINGENDS', $empWorkingHourEnds);
oci_bind_by_name($stid, ':E_IMAGE', $empImage);


oci_execute($stid);

当我尝试提交表单时,我收到以下错误:

enter image description here

我不明白为什么我会收到此错误。谁能帮我?感谢

0 个答案:

没有答案