关于oracle数据库查询结果是否为空的判断???

leexhy 2003-05-13 05:59:12
$query="select f_num from t_gg where rep_date=to_date($date1,'yyyymm')";
$stmt=ociparse($db_connected,$query);
ociexecute($stmt);

怎样判断记录集$stmt是否为空???
...全文
1021 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuepengfei 2003-05-15
  • 打赏
  • 举报
回复
ociexecute($stmt);
if(($result=OCIExecute($stmt))=="")

把上面的那个ociexecute($stmt)去掉
leexhy 2003-05-15
  • 打赏
  • 举报
回复
谢了,结帖!(leexhy欢天喜地的说)
leexhy 2003-05-14
  • 打赏
  • 举报
回复
不,是出现Warning: OCIStmtExecute: ORA-00936: missing expression
leexhy 2003-05-14
  • 打赏
  • 举报
回复
$query="select f_num from gg where rep_date=to_date($date1,'yyyymm')";
$stmt=ociparse($db_connected,$query);
ociexecute($stmt);
if(($result=OCIExecute($stmt))=="")
{
echo'<head>';
echo"<meta http-equiv=\"content-Type\" content=\"text/html; charset=gb2312\">";
echo"<link rel=\"stylesheet\" href=\"baobiao.css\" type=\"text/css\">";
echo'</head>';
echo"<body bgcolor='#DEE2DE'>";
echo('<p> </p><font size=2><center>对不起,报表已经录入过,您不能重复录入!</center></font>');
echo'</body>';
ocifreestatement($stmt);
ocilogoff($db_connected);
exit;
}
else
{
ocifreestatement($stmt);
ocilogoff($db_connected);
}

谢谢!!!
yuepengfei 2003-05-14
  • 打赏
  • 举报
回复
贴出来你的程序看看
leexhy 2003-05-14
  • 打赏
  • 举报
回复
哈哈,再次感谢!!鞠躬!!

TO:yuepengfei(刁馋)

可以实现,可是一样出现上面的两个Warning,该怎么办呢??
是我其它什么地方写错了吗?
leexhy 2003-05-14
  • 打赏
  • 举报
回复
TO:calljia(边缘游走)

你的办法可行,可是,不管是那种结果,
页面总出现下面的两个Warning,怎么将它们去掉呢

Warning: OCIStmtExecute: ORA-00936: missing expression
Warning: Wrong parameter count for ocicolumnisnull()
yuepengfei 2003-05-14
  • 打赏
  • 举报
回复
不好意思,ociexecute()被写成了ociexcute()
$result是指语句执行结果
你也可以通过ocinumrows来做(不知道这次单词写错没有:p)
leexhy 2003-05-14
  • 打赏
  • 举报
回复
谢谢两位!!!

to:yuepengfei(刁馋)
提示以下错误:
Warning: OCIStmtExecute: ORA-00936: missing expression
Fatal error: Call to undefined function: ociexcute()

请问$result是什么?
我的意图是:如果查询结果为空,则输出一个提示页面,若不为空,
则继续该页面执行


to:calljia(边缘游走)
您的意思是if(OCIColumnIsNULL($stmt)==NULL)?
calljia 2003-05-14
  • 打赏
  • 举报
回复
OCIColumnIsNULL -- Test whether a result column is NULL
yuepengfei 2003-05-14
  • 打赏
  • 举报
回复
1.if(($result=OCIExcute($stmt))!="")

2.OCIFetchStatement($stmt,$array)

leexhy 2003-05-14
  • 打赏
  • 举报
回复
who can help me?

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧