I am using MyBatis 3.3.0 with Postgresql 12. I want to inject some pl/pgsql in my xml mapper
for example: to insert data with for loop
<update id="generateNumbers" parameterType="tn.tt.nbms.dto.RangeDTO" statementType="CALLABLE">
<![CDATA[
declare
.....
begin
for number in ......
insert into.....(....) values (...)
end loop;
end; ]]>
</update>
with oracle and Pl/sql it works fine but I can't convert it to pl/pgsql How can I do it I know I can use stored procedure but my question is how to inject pl/pgsql in xml mapper files if it is possible?
After some research I found that for poqgresql (unlike oracle) we can not set parameters to anonymous code block
so we can use batch operations
[1] https://github.com/mybatis/mybatis-3/wiki/FAQ#how-do-i-code-a-batch-insert [2] https://stackoverflow.com/a/55518327/
or stored procedure
I hope that will help some one ....