Home > database > Batch update oracle database update operations
Batch update oracle database update operations
Time:09-27
These days have a need to batch update operation requirements, let me also very headache, what a great god to help me, is like this:
Update user u set u.u sername='flowers' where u.i d=' 1 '; Update user u set u.u sername='Ming' where u.i d='2'. Update user u set u.u sername='xiao li' where u.i d='3'. Update user u set u.u sername='wang' where u.i d='4; .
Such operations, At present my solution is
The begin Update user u set u.u sername='flowers' where u.i d=' 1 '; Update user u set u.u sername='Ming' where u.i d='2'. Update user u set u.u sername='xiao li' where u.i d='3'. Update user u set u.u sername='wang' where u.i d='4; . ; The end;
But there are a lot of question, efficiency doesn't know how to say, but do not return can affect the number of rows, do not know to have better SQL statements, oracle database,
If familiar with ibatis great god best help, think of ibatis inside should be how to write, I now is like this:
The begin Update user u set u.u sername=# [] username# where u.i d=# [] id#;
The end;
So can bulk changes, but the return value is always 1, and also don't know how to efficiency, efficiency must be considered because is the batch problem
CodePudding user response:
If we can use the stored procedure, the value of Name, ID | Name, ID , stored procedure for loop, record is changed