Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Insert a Row_number into table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
useit

Active User


Joined: 05 Oct 2006
Posts: 150

PostPosted: Tue Sep 19, 2017 1:07 pm    Post subject: Insert a Row_number into table
Reply with quote

hi,
To avoid the duplicates i have to insert a row_number into the table. could someone please help me achieving this?


EXEC SQL
insert into TBL1
select
request_no,
seq_no,
account_no
into
:host-request-no,
:host-seq_no,---------------------> row_number
:host-account-no
END-EXEC.

I need to populate the seq_no as Row_number in the above Query.please help me in this regard

Regards,
useit
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2255
Location: Hampshire, UK

PostPosted: Tue Sep 19, 2017 1:58 pm    Post subject:
Reply with quote

So you read the highest row number from some control table/data set, add 1 insert the row and update the control data. What is the problem?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2310
Location: NY,USA

PostPosted: Tue Sep 19, 2017 5:34 pm    Post subject:
Reply with quote

Read
https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/sqlref/src/tpc/db2z_sequencereference.html
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 DB2 Block insert (-803 Error Handling) NJDevils28 COBOL Programming 5 Mon Nov 11, 2019 7:54 pm
No new posts LOAD JCL for db2 table, taking too lo... Somnath Giri DB2 5 Mon Oct 14, 2019 3:35 pm
No new posts Adding FIND to ISPF Panel display of ... Harold Barnes TSO/ISPF 3 Mon Oct 07, 2019 5:46 pm
No new posts Query to Truncate value in table bhaskar_kanteti DB2 2 Mon Aug 12, 2019 3:26 pm
No new posts RACF RANGE TABLE Martin Wickenden All Other Mainframe Topics 1 Mon Jul 08, 2019 9:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us