Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6657693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:48:05+00:00 2026-05-26T01:48:05+00:00

SQL> DECLARE 2 TotalUpd NUMBER(36) := 0; 3 BEGIN 4 dbms_output.put_line (‘Job Start time……………

  • 0
SQL>  DECLARE
2    TotalUpd   NUMBER(36) := 0;
3  BEGIN
4   dbms_output.put_line ('Job Start time............... : ' || to_char(SYSDATE, '             hh24:mi:ss'));
5   UPDATE Asset SET _status = 'PROGRESS' WHERE status is null;
6   TotalUpd := SQL%ROWCOUNT;
7   dbms_output.put_line('Total Records Updated. : ' || TotalUpd);
8    COMMIT;
9   EXCEPTION
10   WHEN NO_DATA_FOUND THEN
11  dbms_output.put_line ('No more data to update.');
12  WHEN OTHERS THEN
13  dbms_output.put_line ('Error while status as SUCCESS ');
14  END ;
15  /

The result for the above procedure is
Job Start time…………… : 04:41:41
Total Records Updated. : 0

But my expected result is “No more row to be updated” must be printed,since i have truncated the table Asset.Please tell where I went wrong in this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:48:05+00:00Added an answer on May 26, 2026 at 1:48 am

    it is as simple as the update does not geneate an error if there is no data.

    you need to look at the value of TotalUpd if you want to control the flow of your code

     DECLARE 
     TotalUpd   NUMBER(36) := 0;
     BEGIN
        dbms_output.put_line ('Job Start time............... : ' 
            || TO_CHAR(SYSDATE, '             hh24:mi:ss'));
        UPDATE Asset SET _status = 'PROGRESS' WHERE status IS null;
        TotalUpd := SQL%ROWCOUNT; 
        IF TotalUpd = 0 THEN
            dbms_output.put_line ('No more data to update.');
        ELSE
            dbms_output.put_line('Total Records Updated. : '
                || TotalUpd);
        END IF; 
        COMMIT; 
     EXCEPTION 
     WHEN OTHERS THEN
        dbms_output.put_line ('Error while status as SUCCESS '); 
     END; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of stored procedures structured similarly to this: DECLARE @sql NVARCHAR(MAX)
in this SQL code DECLARE @n tinyint WHILE (@n > 0) BEGIN SELECT @n
we have created following anonymous block........... DECLARE sql_str long(32000); where_str long(32000); counter NUMBER(3):=0; BEGIN
Hi i am using the following dynamic sql: declare @cmd nvarchar(4000) set @cmd= 'select
This SQL Server 2005 T-SQL code: DECLARE @Test1 varchar; SET @Test1 = 'dog'; DECLARE
I have the following table variable in SQL Server 2005: DECLARE @results TABLE (id
I have a sql query as follows: Declare @DivisionNo INT SET @DivisionNo = 5117
How can I declare a Boolean parameter in SQL statement?
Consider the following Transact sql. DECLARE @table TABLE(val VARCHAR(255) NULL) INSERT INTO @table (val)
I have built a T-SQL query like this: DECLARE @search nvarchar(1000) = 'FORMSOF(INFLECTIONAL,hills) AND

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.