Before the update on naoms_fims_notuserinfo for each row
Declare
Rownums number (5);
The begin
Rownums=select count (*) from naoms_fims_notuserinfo n where n.u pdate_date=to_date (to_char (sysdate, 'mm - dd yyyy -'), '- dd yyyy - mm) and n.d eptname=new. The deptname and n.r esouretype.=new resouretype;
If rownums> 0 then
The update naoms_fims_notuserinfo n set n.u pdate_date=sysdate, n.n otuse_source_count.=new notuse_source_count, n.d escription=new. The description where n.d eptname=new. The deptname and n.r esouretype=new. Resouretype;
The else
Insert into naoms_fims_notuserinfo (id, notuse_source_count, description, update_date update_employee, version, RESOURETYPE, the DEPTNAME)
Values (config_seq nextval, new notuse_source_count, new, description, sysdate, new. Update_employee, 0, new. RESOURETYPE, new. The DEPTNAME);
End the if;
End naoms_fims_notuserinfo_trigger;
CodePudding user response:
Want to update the existing data are set out, there have been an insertCodePudding user response:
Select count (*) into rownums the from...Give rownums assignment such assignment
CodePudding user response:
Such as upstairs in ORACLE by the SELECT assignment is through INTO processingIn addition, the feeling in order to realize the function, you don't need to use the trigger,
Through the MERGE can be achieved
LZ can see the MERGE grammar conform to does not conform to your needs
CodePudding user response:
Use the merge into when no data table, I'm using the update statement, this how to useCodePudding user response:
Can you write a example, the data is not from the table, but from the update dataCodePudding user response:
want to update the existing data are set out, didn't insertHas not been updated data, it is not the implementation of this trigger;