0

我正在尝试通过 php 脚本插入到 oracle 表中。

我的样本数据是这样的:

$sql="insert into VMSTAT_PRD (DATE, LPAR, lcpu, mem, ent, r, b, p, avm, free, fi, fo, pi, po, fr, sr, in_faults, sy, cs, usr, sys, idle, waitio, pc, ec) VALUES ('2013-06-27 14:52:54','servera',96,393216,16.00,8,1,0,50104312,279318,5291,632,0,0,5799,10185,4533,74621,32708,5,4,91,1,1.87,11.7)";

$conn=odbc_connect('Odbc_name','user','passwd');
$rs=odbc_exec($conn,$sql);

我收到此错误:

PHP Warning:  odbc_exec(): SQL error: [Oracle][ODBC][Ora]ORA-00928: missing SELECT keyword
, SQL state S1000 in SQLExecDirect in C:\PHP\cpu.php on line 100

Warning: odbc_exec(): SQL error: [Oracle][ODBC][Ora]ORA-00928: missing SELECT keyword
, SQL state S1000 in SQLExecDirect in C:\PHP\cpu.php on line 100
Error in SQL

任何想法此错误消息的含义是什么?

4

1 回答 1

1

你真的应该使用准备插入数据库。

   $conn=odbc_connect('Odbc_name','user','passwd');


   $sql="insert into VMSTAT_PRD (DATE, LPAR, lcpu, mem, ent, r, b, p, avm, free, fi, fo, pi, po, fr, sr, in_faults, sy, cs, usr, sys, idle, waitio, pc, ec) VALUES ('2013-06-27 14:52:54','cigp01a2a001',96,393216,16.00,8,1,0,50104312,279318,5291,632,0,0,5799,10185,4533,74621,32708,5,4,91,1,1.87,11.7)";
   $prepare = odbc_prepare($conn, $sql);
   $rs=odbc_execute($prepare);
于 2013-06-27T19:00:47.333 回答