oracle存储过程中带空值的输入怎么写?COALESCE()函数用错了吗?
(start_timeindate,end_timeindate,nameinnvarchar2,tnameinnvarchar2,cusersoutsys_refcur...
(start_time in date,end_time in date,name in nvarchar2,tname in nvarchar2,cusers out sys_refcursor)
as
begin
open cusers for select * from C_USERS where logintime >= COALESCE(start_time,logintime)
and logintime <= COALESCE(end_time,logintime)
and username = COALESCE(name,username)
and truename = COALESCE(tname,truename);
end;
编译提示错误:
Line # = 6 Column # = 17 Error Text = PL/SQL: SQL Statement ignored
Line # = 9 Column # = 71 Error Text = PL/SQL: ORA-12704: 字符集不匹配 展开
as
begin
open cusers for select * from C_USERS where logintime >= COALESCE(start_time,logintime)
and logintime <= COALESCE(end_time,logintime)
and username = COALESCE(name,username)
and truename = COALESCE(tname,truename);
end;
编译提示错误:
Line # = 6 Column # = 17 Error Text = PL/SQL: SQL Statement ignored
Line # = 9 Column # = 71 Error Text = PL/SQL: ORA-12704: 字符集不匹配 展开
1个回答
展开全部
空值 ,你直接用NVL不就行了.
open cusers for select * from C_USERS where logintime >= NVL(start_time,logintime)
and logintime <= NVL(end_time,logintime)
and username = NVL(name,username)
and truename = NVL(tname,truename);
open cusers for select * from C_USERS where logintime >= NVL(start_time,logintime)
and logintime <= NVL(end_time,logintime)
and username = NVL(name,username)
and truename = NVL(tname,truename);
追问
是这样的,谢谢
追答
System.out.println("是的");
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询