查看: 1013|回复: 4
|
想问下关于oracle 的问题...和date 有关。。
[复制链接]
|
|
我要做一个condition 那就是当25-dec 的时候 user不能add data因为那天是xmas holiday。。谢谢帮忙。。 |
|
|
|
|
|
|
|
发表于 9-11-2005 11:55 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 12-11-2005 01:33 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 12-11-2005 09:00 AM
|
显示全部楼层
1.可以在PL/SQL程式(stored procedure或stored function)里开个简单的if condition,
select to_char(SYSDATE, 'MMDD') into v_vchr_now from dual;
if v_vchr_now != '1225' then
insert into ....
end if;
或
2.开一个lookup table, 专门储存假日或business rule禁止insert的日子,每次要issue insert时先verify.
SQL> create table OFF_DAYS
2 (OFF_DAY char(4) not null);
SQL> insert into OFF_DAYS values ('1225');
SQL> commit;
select to_char(SYSDATE, 'MMDD') into v_vchr_now from dual;
if v_vchr_now not in (select OFF_DAY from OFF_DAYS) then
insert into ...
end if; |
|
|
|
|
|
|
|
发表于 24-11-2005 12:48 PM
|
显示全部楼层
用trigger.
当update or insert that table,
trigger 可以 check holiday_table (table for holiday date only).
if date in holiday_table, trigger return false then cannot update or insert. |
|
|
|
|
|
|
| |
本周最热论坛帖子
|