DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Update count

  1. #1
    Join Date
    Jan 2001
    Posts
    642
    Hi,
    Assuming that , I issue a DML statement like this,

    update table_name
    set col1 = 'Y'
    where col1 = col2.

    How do I how, How many rows for col1 got updated with 'Y'.

    Badrinath

  2. #2
    Join Date
    Feb 2001
    Posts
    3
    AFAIK there is no way to find that. There may be a couple of workarounds that though: use a SELECT statement before issuing the UPDATE OR you may be able to use cursors in PL/SQL block which is an indirect way of using a SELECT anyway.

    HTH,

    Ravi Kulkarni

  3. #3
    Join Date
    Jul 2000
    Posts
    243
    Hi badrinathn

    sql%rowcount can help you check if and how much rows updated.

  4. #4
    Join Date
    Feb 2001
    Posts
    123
    Thinking about this in a very simplistic manner, two things spring to mind, which may or may not be of use:

    1) If you issue the update command from a SQL prompt, you will get the message

    nnn rows updated

    2) If you do not have other updates on the same table concurrently with the update you wish to count, issue a query to select count(*) from the table that you wish to update using the same where clause to give you a count of the records that will be updated.

    HTH

    David.

  5. #5
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    [QUOTE][i]Originally posted by Dave_A [/i]
    [B]1) If you issue the update command from a SQL prompt, you will get the message

    nnn rows updated
    [/B][/QUOTE]

    And how SQL*Plus (or any other tool) gets this information? Exactly the same way as shawish_sababa has sugested: by isuing (behind the screen) the query:

    SELECT SQL%ROWCOUNT FROM dual;

    You can do the same in any application.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width