【发布时间】:2015-01-01 03:19:09
【问题描述】:
我制作了一个如下所示的 Oracle 包。
我将传递参数字符串,如“2014-11-05”。
--SEARCH 2014 11 04
FUNCTION SEARCHMYPAGE(v_created_after IN DATE, v_created_before IN DATE)
return CURSORTYPE is rtn_cursor CURSORTYPE;
BEGIN
OPEN
rtn_cursor FOR
select
news_id
from
(
select
news_id,
news_title, news_desc,
created, news_cd
from
news
)
where
1=1
AND (created BETWEEN decode(v_created_after, '', to_date('2000-01-01', 'YYYY-MM-DD'), to_date(v_created_after, 'YYYY-MM-DD'))
AND (decode(v_created_before, '', sysdate, to_date(v_created_before, 'YYYY-MM-DD')) + 0.999999));
return rtn_cursor ;
END SEARCHMYPAGE;
我在 Eclipse 控制台消息中确认了我的参数,因为我正在使用 Eclipse IDE。 我得到了2014-10-29~2014-10-31制作的内容。
当我将 '2014-11-01' 作为 created_after 传递时,它返回 0 条记录。(但我期望所有内容,因为每个内容都是在 10-29 和 10-31 之间制作的)
你会发现我的函数有什么问题吗?
谢谢:D
【问题讨论】:
标签: java sql oracle date package