INSERT inside plsql procedure does not tell how many rows were inserted

点点圈 提交于 2019-12-11 08:41:56

问题


i am trying to insert some rows and update some rows inside a pl/sql loop.

however all i get to see is the pl/sql procedure is successfully completed.

i do get to see dbmbs_ouput statements but not the output status of insert and/or update queries.

the serveroutput is set to on.

how do i get to see the status of insert and update rows(namely how many rows were inserted and updated)


回答1:


In Oracle, the rowcount is not output automatically like it is in SQL Server.

You should do it explicitly:

BEGIN
        INSERT
        INTO    mytable
        SELECT  …
        FROM    other_table;
        DBMS_OUTPUT.put_line(SQL%ROWCOUNT);
END;


来源:https://stackoverflow.com/questions/4139945/insert-inside-plsql-procedure-does-not-tell-how-many-rows-were-inserted

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!