DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: SQL query how to find !!

  1. #1
    Join Date
    Dec 2001
    Location
    SAN FRANCISCO, CA
    Posts
    306

    SQL query how to find !!

    Thanks in advance


    I am running a batch of 5000 inserts & update sql for a particular user. Out of 5000 sql some are getting executed and some are
    failing

    I want to know how to find those failed ones.

    apart from spool option any other solution is there. let me know .
    Eat , Drink & Enjoy life -

    pravin_kini@hotmail.com

  2. #2
    Join Date
    Jan 2003
    Location
    india
    Posts
    175
    take copy of the table before update.

    take copy of the table after update.

    now you compare these two.

    difference in count is the successful inserts.

    difference in values is the successful updates.

    -Raja

  3. #3
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    thas painful...

    why not handle in Exceptions..?
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  4. #4
    Join Date
    Jan 2003
    Location
    india
    Posts
    175
    abhaysk,
    how can we handle this in exceptions?

    some more clues.....


    thank you!

    Raja

  5. #5
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Code:
    Begin
      SQL_STATEMENT;
    Exception
      When Others Then
         {Do What Ever U Want};
    End;
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  6. #6
    Join Date
    Oct 2000
    Posts
    467
    You can trap the sql error code / msg and act accordingly...again possible through exceptions.
    Vinit

  7. #7
    Join Date
    Aug 2001
    Location
    chennai,bangalore
    Posts
    840
    U can put the SQL in a script and send the output to log file, from the log file u can know which all updates failed, correct them and reexcute.

    regards
    anandk
    anandkl

  8. #8
    Join Date
    Jan 2003
    Location
    india
    Posts
    175
    thank you abhaysk!

    -Raja

  9. #9
    Join Date
    Sep 2002
    Posts
    376
    If i have 100 inserts to be done, and there is a error at 50 th record, then the control jumps to Exception. Right ????

    Is there any way that i just skip this bad record and continue with the rest 50 records ????

  10. #10
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    For every statement have a Begin .. Exception !!

    (am not sure how u can pass the control back to next statement after error with having only an exception)..
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

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