to_char(:new.lgsj,'hh24:mi:ss')<'18:00:00'改为
to_date(to_char(:new.lgsj,'hh24:mi:ss'))<to_date('18:00:00')
to_date(to_char(:new.lgsj,'hh24:mi:ss'))<to_date('18:00:00')
解决方案 »
- 数据库中只存了一个字段来代表周一到周日的情况,怎么用这一个字段来分别代表周一到周日
- --求高人相助:一个SQL Server 2005的存储过程转换为Oracle的---
- utl_file导出的文件大小受了限制,怎么解决?/急
- TNSPING 通 SQLPLUS 通 应用程序连接失败!!是怎么会事啊?
- ORACLE中写FUNCTION所遇到的问题,(急,急急!!)
- 求助:oracle8恢复问题
- ****如何修改oracle中默认的varchar的长度??**** 急急急!!!!
- 哪位高手能细讲一下数据的导入导出
- plsql登录出错
- 多对多关系求解答
- 安装oracle后修改了机器名称,OracleOraHome92TNSListener服务起不来,不将名称改回去,需要修改哪些文件?
- 怎样插入大于4000的字符串?第---3-----次发
ORA-01843: not a valid month
ORA-06512: at "T_INSERT", line 9
ORA-04088: error during execution of trigger 'T_INSERT'
wfeng907:我改了,还是不对。
下面是原来的错误信息:
ORA-04091: table TableAis mutating, trigger/function may not see it
ORA-06512: at "TableA", line 11
ORA-04088: error during execution of trigger 'T_INSERT'
下面是原来的错误信息:
ORA-04091: table TableAis mutating, trigger/function may not see it
ORA-06512: at "TableA", line 6
ORA-04088: error during execution of trigger 'T_INSERT'
改为
to_date(to_char(:new.lgsj,'hh24:mi:ss'),'hh24:mi:ss')<to_date('18:00:00','hh24:mi:ss')如果报错
将11行'yyyy-mm-dd' 改为'yyyy-mon-dd'
select 1 from dual
where to_char(sysdate,'hh24:mi:ss')<'18:00:00';
莫非是:new.lgsj有问题?
ORA-04091: table TableA is mutating, trigger/function may not see it
ORA-06512: at "T_INSERT", line 11
ORA-04088: error during execution of trigger 'T_INSERT'
update TableA set tjsj=trunc(add_months(:new.lgsj,1))
也改掉
update TableA set tjsj=trunc(:new.lgsj)
Action Rewrite the trigger (or function) so it does not read that table.
好象不是这些写法的问题!
改为TableA set tjsj=:new.lgsj应该就可以了
你说的就是用trunc函数截取日期。
好像与触发器不能使用没有关系的。
我把成功的案例发给大家共享:)
create or replace trigger t_insert
before insert on TableA --注意是before
for each row
declare
stime varchar2(20);
dtjsj1 date;
dtjsj2 date;
begin
--获取时间
select to_char(:new.lgsj,'hh24:mi:ss'),trunc(:new.lgsj),trunc(add_months(:new.lgsj,1))
into stime,dtjsj1,dtjsj2 from dual;
if stime<'18:00:00' then
:new.tjsj := dtjsj1;--直接修改new.tjsj
else
:new.tjsj := dtjsj2;
end if;
end t_insert;