Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLPLUS Doesn't print number of rows affected

Im executing below Script in a .sql file. I'm using Windows Command line console to invoke sqlplus. When script terminates everything looks good, except that I couldn't see number of records added by the INSERT statement. You can see the Output also below:

SCRIPT

WHENEVER SQLERROR EXIT 1 ROLLBACK
WHENEVER OSERROR EXIT 1 ROLLBACK
SET FEEDBACK  ON 
SET VERIFY ON
BEGIN
DBMS_OUTPUT.put_line('Output Nothing');
END;
/
INSERT INTO .........

COMMIT;
QUIT;
/

OUTPUT DISPLAYED

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Apr 9 22:08:47 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

PL/SQL procedure successfully completed.

Commit complete.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64
bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

When I execute the same SQL on a tool like TOAD/SQLNavigator, I could see the number of rows added (See ** marked line below).

OUTPUTDISPLAYED ON TOAD

Processing ...
SET FEEDBACK  ON 

SQL*Plus command ignored.
Processing ...
SET VERIFY ON


SQL*Plus command ignored.
Processing ...
BEGIN
DBMS_OUTPUT.put_line('Doing Nothing');
END;

Doing Nothing
Processing ...
INSERT INTO .......

**11 row(s) inserted**

Processing ...
COMMIT

Processing ...
QUIT;

SQL*Plus command ignored.

Can you tell me which setting probably will help me geting numbers of rows impacted by this SQL, even when I run this script through simple 'sqlplus'?

like image 503
Vicky Avatar asked Nov 08 '25 19:11

Vicky


2 Answers

SQL*Plus doesn't ouput the row count but you can do it explicitly with something like:

INSERT blah blah blah;
DBMS_OUTPUT.put_line (SQL%ROWCOUNT);
like image 115
paxdiablo Avatar answered Nov 10 '25 11:11

paxdiablo


The default threshold for SET FEEDBACK ON is 6. If you want feedback on a fewer number, use "SET FEEDBACK 1".

like image 29
REW Avatar answered Nov 10 '25 10:11

REW



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!