IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want to delete the second occurance of a Key


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ysuryawanshi_mcs
Warnings : 1

New User


Joined: 25 Mar 2006
Posts: 15
Location: pune(India)

PostPosted: Fri Mar 31, 2006 7:45 pm
Reply with quote

I HAV ONE TABLE
EMPNAME(NAME VARCHAR(20))
TABLES VALUES ARE
EMPNAME
YOGESH
YOGESH
SATISH
RAKESH
RAHUL


NOW I WANT TO DELETE A ROW WHERE NAME=YOGESH
BUT I WANT TO DELETE ONLY SECOND YOGESH AND NOT FIRST.

IN ORACLE WE CAN DO
DELETE FROM EMPNAME WHERE NAME='YOGESH' AND ROWID='00000011'
IN ORACLE EACH ROW AND COLUMN IN THE TABLE HAS A UNIQUE IDENTIFIER KNOWN AS ROWID AND COLUMNID.
SO
WHAT IS THIS IN DB2.
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Fri Mar 31, 2006 7:56 pm
Reply with quote

hy ysuryawanshi_mcs,

if this is your table definition
and you have not the columns like in oracle,
how db2 can determine the right row for deletion???
it is not possible...
try to make any unique key or read the table with cursor for update
and delete the second row where duplicates exist.

martin9
Back to top
View user's profile Send private message
Jag

New User


Joined: 07 Dec 2005
Posts: 30
Location: India

PostPosted: Sun Apr 02, 2006 12:16 pm
Reply with quote

Hi,
First thing is in the table which you gave an example there is one column and it doesnt make any sense whether we delete teh fisrt row or second row in the rdbms..Right??.. Second thing if you have any second column in the table then using that coulmn you can delete the row specifying the second column in the where clause.


In DB2 the Rowid(Are hexa decimal) are purely for OS usage to get the rows and the details of the Row ID's are maintained by the system Only..


Cheers,
Jag,
Mail: ***EMail ID REMOVED... Read Forum Rules***
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts How to delete a user's alias from the... JCL & VSAM 11
No new posts Delete file row if blanks in the firs... DFSORT/ICETOOL 5
No new posts volume mass delete RMM JCL & VSAM 2
Search our Forums:

Back to Top