i have a table like this :
Name ADDRESS
Toto 123 ...
Toto 456
ToTo 678
I would like to delete 2 last row...please tell me how to
delete its
Answers were Sorted based on User's Feedback
Answer / mithlesh
delete from table_name
where address = '456' and '678'.
Is This Answer Correct ? | 10 Yes | 4 No |
Answer / prashant shettar
delete from (select rownumber() over() as rowid from tab1 )
where rowid = ( (select count(*) from tab1) - 1)
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / suv
We can use concept of cursor to delete particular row. The
row where the cursor is pointing will get deleted.
Please correct is wrong..
Is This Answer Correct ? | 0 Yes | 1 No |
I think better to perform this in following 2 queries
1. Select count(WS-COUNT) from TABLE;
2. DELETE FROM TABLE WHERE ROWCOUNT(*) IS WS-COUNT OR
(WS-COUNT-1);
Basically here the first row will give you the record count
and 2nd will delete the last and the 2nd last row.
Is This Answer Correct ? | 0 Yes | 2 No |
How do you pull up a query which was previously saved in qmf?
A Table feild is declared as Decimal(7,2). I want to insert the decimal in to this column thru cobol-db2 program. How should I declare my local input file variable or any suggestion?
1) I have 3 programs : PGMA, PGMB, PGMC. PGMA calls PGMB and PGMB calls PGMC. I have to do inserts, updates in all the 3 pgms. 2) Say PGMC has done its work successfully and returned to PGMB 3) PGMB had an SQL error while doing some update 4) PGMA has already done some updates before calling PGMB all are running under the same CICS region. What will happen if I issue SYNCPOINT ROLLBACK in PGMB when it abends ? Does all the changes in PGMA,B,C rollback ? (because all the pgms belong to same task).
How to resolve -502 sql code in DB2?
How does cobol compile db2 program?
Hi i need to write a query on the following requirement. SELECT COMM_TEXT INTO :WS_MIKM_COMM_TEXT FROM MPIPROD.MIKMV01 WHERE ACCOUNT_NO = :WFD_ACCOUNT_NO AND (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT AND SUBSTR(COMM_TEXT,47,14) = :WS_DENY_DESC) OR (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT) The above query is to be modified. The requirement is if both the fields are equal then that has to be given priority. In the above query if it satisfies any one it comes out without checking if both being equal is possible.
SQLCODE = -199, ERROR: ILLEGAL USE OF KEYWORD CHAR, TOKEN KEY was expected
Q4. How will you get the count of record without using COUNT verb in query?
What can the SET option of the Repair Utility accomplish?
How to find the number of rows in db2 tables?
what is the difference between where clause and having clause
Why use RUNSTAT Utility?