Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Want to delete the second occurance of a Key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Want to delete the second occurance of a Key
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: 287
Location: Basel, Switzerland

PostPosted: Fri Mar 31, 2006 7:56 pm    Post subject:
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    Post subject: Hi
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts Delete record or Reset RC code using ... mpawan Compuware & Other Tools 4 Tue Jul 26, 2016 3:52 pm
No new posts Delete VSAM File Records amitc23 CICS 6 Sun Apr 10, 2016 10:10 am
No new posts DB2 Stored Procedure - Dynamic SQL - ... GuyC DB2 2 Wed Feb 17, 2016 5:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us