Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums 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: 147

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: 2108
Location: 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: 2038
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 Facing issue while executing multi ro... aagarwal88 DB2 6 Tue Oct 02, 2018 8:11 am
No new posts Facing Issue in Table Reorg satish.ms10 DB2 1 Tue Aug 07, 2018 2:44 am
No new posts SQL IN predicate using COBOL table jerryte DB2 16 Fri Jun 29, 2018 10:30 pm
No new posts Extracting DDL for all list of intere... Ashishpanpaliya DB2 5 Mon May 21, 2018 4:08 pm
No new posts Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am

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