时间的表示

yan1617 2003-08-18 04:49:02
select next_day(to_date('12-4-1971','dd-mm-yyyy'),'Saturday') from dual;
错误提示:周中的日无效
请问如何修改
...全文
35 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
beckhambobo 2003-08-18
  • 打赏
  • 举报
回复
create or replace function getdate(indate varchar2)
return date
as
i number;
j number;
begin
if indate='星期一' then
i:=2;
elsif indate='星期二' then
i :=3;
elsif indate='星期三' then
i :=4;
elsif indate='星期四' then
i :=5;
elsif indate='星期五' then
i :=6;
elsif indate='星期六' then
i :=7;
elsif indate='星期七' then
i :=1;
end if;

select to_char(sysdate,'D') into j from dual;
if i>j then
return sysdate+(i-j);
elsif i=j then
return indate;
else
return sysdate+(7-j+i);
end if;
end;
/

SQL> select getdate('星期一') from dual;
Michaelyfj 2003-08-18
  • 打赏
  • 举报
回复
这个语句是正确的啊

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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