永发信息网

oci_execute() [function.oci-execute]: ORA-00936: 缺失表达式

答案:1  悬赏:10  手机版
解决时间 2021-02-03 16:33
  • 提问者网友:温旧梦泪无声
  • 2021-02-03 12:34
$linkID; //连接ID
$stmt; //SQL语句资源ID

//连接字符串,包括主机地址,端口,SID:数据库名,如有更改,直接在$dbstring中改动
$dbstring="(DESCRIPTION=(ADDRESS=(PROTOCOL =TCP)(HOST=localhost)(PORT = 1521))(CONNECT_DATA =(SID=ZHIJIANJU)))";
$linkID = @oci_pconnect($userName, $passWord, $dbstring,'zhs16gbk');

$do="null";
$do=$_GET['do'];

if($do == "add")
{
$title = $_POST['article_title'];
$src = $_POST['article_src'];
$content = htmlspecialchars($_POST["content"],ENT_QUOTES);
$type = $_POST['article_type'];
$unsetDay = $_POST['unsetDay'];
if($type==2){
$class = $_POST['article_class'];
}
$writer = $_POST['article_writer'];

$sql = "insert into TRAINNEWS(TRAINNEWSID,TRAINNEWSSUBJECT,TRAINNEWSCONTENT,TRAINNEWSWRITER,TRAINNEWSSRC,TRAINNEWSTYPE,TRAINNEWSCLASS,UNSETDAY) values(\"SEQ_NEWSID\".nextval,'$title',EMPTY_CLOB(),'$writer','$src',$type,'$class',$unsetDay) RETURNING TRAINNEWSCONTENT INTO :LOBCONTENT";

$stmt = @oci_parse($linkID, $sql);

// 初始化一个新的空 LOB描述符
$myLOB = oci_new_descriptor($linkID, OCI_D_LOB);

// 绑定LOB描述符和本地LOB对象,mylob_loc是本地LOB对象?
oci_bind_by_name($stmt, ":LOBCONTENT", $myLOB, -1, OCI_B_CLOB);

// Execute the statement using , OCI_DEFAULT - as a transaction 执行语句
oci_execute($stmt, OCI_DEFAULT) or die ("Unable to execute query\n");

// Now save a value to the LOB 将数据保存到LOB
if (!$myLOB->save($content))
{
// 回滚未提交的事务
oci_rollback($linkID);
// Free resources
oci_free_statement($stmt);
$myLOB->free();

}
else
{

// On success, commit the transaction 提交事务
oci_commit($linkID);
// Free resources
oci_free_statement($stmt);
$myLOB->free();

}
最佳答案
  • 五星知识达人网友:时间的尘埃
  • 2021-02-03 14:02



行了,不用问了,问题解决了,其实错误你没贴出来,它的SQL语句有点问题,最后一项$unsetDay加个引号就好了,,不要浪费,把分给我吧
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯