Recently, the company used Ibatis development projects, can use stored procedures to deal with bulk inserts, batch modification and multiple sets of conditional query; But since the use of modules is relatively small, temporarily in the XML configuration, has not done in the XML similar processing, it is necessary to record; Okay, here's the code:
<!--BULK Insert - <InsertID= "Savenotificationpushinfo"Parameterclass= "Java.util.List"> <! [Cdata[INSERT All]]> <Iterateconjunction="" >Into notification_push_info (Push_log_no, Business_book, employee_id, Notification_no, Push_flag, Push_time ) VALUES (bep_seq_package.fetch_seq (' Notification_push_info ', ' PU Sh_log_no ', ' bepdata '), #list [].businessbook:varchar#, #list [].employeeid:varchar#, #list [].notificationno:varchar#, #list [].pushflag:varchar#, Sysdat e)</Iterate> <! [Cdata[SELECT * from dual]]> </Insert> <!--multiple sets of conditional queries - <SelectID= "Getsamenotificationlist"Parameterclass= "Java.util.List"ResultClass= "Java.util.HashMap">SELECT DISTINCT employee_id "EmployeeId", Notification_no "Notificatio NNo "from Notification_push_info npi where npi.invalid_flag = ' N '<Iterateconjunction= "or"Open= "and"Close="">npi.employee_id = #notiList [].employeeid# and Npi.business_book = #notiList [].b usinessbook# and npi.notification_no = #notiList [].notificationno#</Iterate> </Select> <!--Batch Modification - <UpdateID= "Updatenotilist"Parameterclass= "Java.util.List">begin<Iterateconjunction="">Update notification_push_info Set push_flag = #list []. flag#, push_time = sysdate where Invalid_flag = ' N ' and employee_id = #list [ ].employeeid# and notification_no = #notiList [].notificationno#; </Iterate>end; </Update>
If you have any questions, please point out, thank you!
Oracle BULK INSERT, batch modification, and multiple set of conditional queries in XML