Home > database >  Oracle error: the expression type errors
Oracle error: the expression type errors

Time:09-22

- some readers have to borrow some books
The Create or replace function f_borrowed_num (v_readerid number)
Return the number
As
V_num number;
The Begin
Select count (*) into v_num from reader, borrow the where reader. Readerid=v_readerid and reader. Readerid=borrow. Readerid;
Return v_num;
The End;

- using a custom function to write a as long as there is change in the borrow list is updated rest_borrow_num triggers (double cursor loop I don't pass, I'm not sure right)
The create or replace the trigger tr_update_borrow
After the update or delete or insert on borrow
For each row
Declare
Cursor cur_reader is the select readerid from reader;
Cursor cur_rule is the select * from rule;
The begin
For v_readerid cur_reader in loop
For v_rule cur_rule in loop
The update reader set rest_borrow_num=v_rule. Num - f_borrowed_num (v_readerid)
Where v_readerid=: old. Readerid and reader. Readertype=v_rule. Readertype;
End loop cur_reader;
End loop cur_rule;
The End;

Run the trigger times wrong: error (270, 21) : PLS - 00382: expression type error
Who told me the trigger which zha wrong, double loop cursor is wrong?

CodePudding user response:

Should be the problem of function calls that place

CodePudding user response:

Also have a feeling, but I don't know how change,
Another statement, stick the wrong end of cycle, is not an error reason,
End loop cur_rule;
End loop cur_reader;

CodePudding user response:

Also have a feeling, but I don't know how change,
Another statement, stick the wrong end of cycle, is not an error reason,
End loop cur_rule;
End loop cur_reader;

CodePudding user response:

Also have a feeling, but I don't know how change,
Another statement, stick the wrong end of cycle, is not an error reason,
End loop cur_rule;
End loop cur_reader;
  • Related