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

how to handle the auto incremental column in DB2Table


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

New User


Joined: 28 Oct 2010
Posts: 16
Location: India

PostPosted: Thu Nov 18, 2010 8:27 pm
Reply with quote

Hi,

I have table defined with column "A" defined with auto sequence nbr .
Once i insert a record through program , next sequence number is automatically inserted in that column "A" .

Now my requirement is i need to store this auto sequence nbr in the working storage for further processing .

Now the program is done such a way that i insert a record first and fetch same record again into the host variables and using it for further processing.
So IO operations are doubled for every single insert.

I wanted to avoid this . How can i ?

How can i handle this ?

Thanks
Raj
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Nov 18, 2010 9:09 pm
Reply with quote

Select from insert :

suppose EMPNO is identity column in table EMPLOYEE:
Code:
SELECT EMPNO
  FROM FINAL TABLE (INSERT INTO EMPLOYEE (NAME, SALARY, DEPTNO, LEVEL)
                    VALUES('Mary Smith', 35000.00, 11, 'Associate'));


publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db2.doc.relg/insl.htm
Back to top
View user's profile Send private message
raj1984

New User


Joined: 28 Oct 2010
Posts: 16
Location: India

PostPosted: Sun Nov 21, 2010 2:09 pm
Reply with quote

Thanks GuyC.
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts first column truncated in search result IBM Tools 13
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
Search our Forums:

Back to Top