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: 2002
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: 1886
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 Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Need inputs on DB2 tablespace/table r... ashek15 DB2 3 Sat Mar 24, 2018 11:49 pm
No new posts COBOL declaration for table Poha Eater DB2 3 Mon Feb 26, 2018 6:58 pm
No new posts load and delete table through JCL wit... ram_vizag JCL & VSAM 9 Thu Feb 01, 2018 12:47 am
No new posts Unloading DB2 table in CSV format alo... grvtomar COBOL Programming 7 Sun Jan 28, 2018 2:05 am

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