警告:oci_execute():ORA-00917:缺少逗号

时间:2014-01-23 10:36:17

标签: php sql oracle

  

警告:oci_execute():ORA-00917:第66行的C:\ xampp \ htdocs \ TTO \ pulldata2.php中缺少逗号

代码

$sql = "INSERT into project (PROJECT_ID , PROJECT_NAME ,CREATED , LAST_MODIFIED , PSTART_DATE , PEND_DATE)VALUES(project_id_seq.nextval , '$projectname1' ,'$un' , 'to_date('2000-01-01','yyyy-mm-dd')' ,'to_date('2000-01-01','yyyy-mm-dd')','to_date('2000-01-01','yyyy-mm-dd')') ";
$insert_project=oci_parse($conn,$sql);
oci_execute($insert_project);

2 个答案:

答案 0 :(得分:0)

格式化SQL,因为现在很难阅读

你不能把变量放在''中,因为不会解析变量。同样影响函数的名称。

$sql = "INSERT INTO `project` (`PROJECT_ID`, `PROJECT_NAME`, `CREATED`, `LAST_MODIFIED`, PSTART_DATE, PEND_DATE)
                      VALUES(project_id_seq.nextval, $projectname1, $un, to_date('2000-01-01','yyyy-mm-dd'), to_date('2000-01-01','yyyy-mm-dd'), to_date('2000-01-01','yyyy-mm-dd')) "; 
$insert_project=oci_parse($conn,$sql); 
oci_execute($insert_project);

答案 1 :(得分:0)

  • 试试这个

     INSERT into project (PROJECT_ID , PROJECT_NAME ,CREATED ,
                     LAST_MODIFIED , PSTART_DATE , PEND_DATE)VALUES        
                     (project_id_seq.nextval , '$projectname1' ,'$un' , 
                      to_date('2000-01-01','yyyy-mm-dd') ,
                      to_date('2000-01-01','yyyy-mm-dd'),
                      to_date('2000-01-01','yyyy-mm-dd'));