Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL%ROWCOUNT

user12093849Nov 17 2014 — edited Nov 17 2014

when I am using SQL%ROWCOUNT, it returns the count = 1 though there is no record from PRODUCT table for the condition

   SELECT count(*) into v_count FROM PRODUCT WHERE LOC = v_oldloc;

   dbms_output.put_line('Records found in PRODUCT table for column LOC with value '|| v_oldloc ||':'|| SQL%ROWCOUNT );

   COMMIT;

But, When i use the v_count to display the count of records , it returns ZERO (correct value) as below

   SELECT count(*) into v_count FROM PRODUCT WHERE LOC = v_oldloc;

   dbms_output.put_line('Records found in PRODUCT table for column LOC with value '|| v_oldloc ||':'|| v_count );

   COMMIT;

Please let me know if there is any problem with the code?

Thanks in advance

This post has been answered by Stako Botev on Nov 17 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2014
Added on Nov 17 2014
4 comments
350 views