Re: Deleting rows from a table in SQL
- From: "p175" <tdavidge@xxxxxxxxxxx>
- Date: 16 Aug 2006 19:15:29 -0700
In DB2 if you try to 'DELETE FROM T1' and T1 is empty you will get:
SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result
of a
query is an empty table. SQLSTATE=02000
Which of course is what the issue is. If you tried this in a SQL PL
stored procedure for example you would need to declare a CONTINUE
CONDITION HANDLER for SQL0100W. It's not exactly an error, rather a
warning is it not ? If your able to interrogate sql error or state and
interpret result as above.
Alternatively, re-create the table with 'NOT LOGGED INITIALLY'
statement.
Then when you want to empty it:
'ALTER TABLE T1 ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE'
This will empty the table completely without logging the individual
records being deleted.
.
- Follow-Ups:
- Re: Deleting rows from a table in SQL
- From: Steve Swift
- Re: Deleting rows from a table in SQL
- References:
- Deleting rows from a table in SQL
- From: Steve Swift
- Re: Deleting rows from a table in SQL
- From: p175
- Re: Deleting rows from a table in SQL
- From: Steve Swift
- Re: Deleting rows from a table in SQL
- From: Dave Saville
- Re: Deleting rows from a table in SQL
- From: Steve Swift
- Re: Deleting rows from a table in SQL
- From: Mickey
- Re: Deleting rows from a table in SQL
- From: p175
- Re: Deleting rows from a table in SQL
- From: Steve Swift
- Deleting rows from a table in SQL
- Prev by Date: Re: Deleting rows from a table in SQL
- Next by Date: Re: Rexx Menu Options
- Previous by thread: Re: Deleting rows from a table in SQL
- Next by thread: Re: Deleting rows from a table in SQL
- Index(es):
Relevant Pages
|