insert a db2 sequence generated value

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ajmore
Participant
Posts: 22
Joined: Fri Aug 25, 2006 5:25 am

insert a db2 sequence generated value

Post by ajmore »

Hi all :) ,

I have to insert a db2 sequence generated value into a field for a table(say ABC),the sequence name is IA.INDIV_EN_ID_SEQ


INSERT INTO #TgtDB#.ABC
(IDENTITY_ID, INDIVIDUAL_ENTITY_ID)
VALUES
(ORCHESTRATE.IDENTITY_ID, NEXTVAL FOR IA.INDIV_EN_ID_SEQ)

But while doing this i am getting the following error

An unexpected token "NEXT" was found following "L_ENTITY_ID = SELECT". Expected tokens may include: "WHERE". SQLSTATE=42601.

Is this the proper method to insert seq. generated value in a Col.?? :?:
vivekreddy
Participant
Posts: 43
Joined: Mon Jan 15, 2007 10:53 pm

Re: insert a db2 sequence generated value

Post by vivekreddy »

ajmore wrote:Hi all :) ,

I have to insert a db2 sequence generated value into a field for a table(say ABC),the sequence name is IA.INDIV_EN_ID_SEQ


INSERT INTO #TgtDB#.ABC
(IDENTITY_ID, INDIVIDUAL_ENTITY_ID)
VALUES
(ORCHESTRATE.IDENTITY_ID, NEXTVAL FOR IA.INDIV_EN_ID_SEQ)

But while doing this i am getting the following error

An unexpected token "NEXT" was found following "L_ENTITY_ID = SELECT". Expected tokens may include: "WHERE". SQLSTATE=42601.

Is this the proper method to insert seq. generated value in a Col.?? :?:
There wouldn't be any select clause; take the value directly from the said sequence.
Regards,
Vivek D. Reddy

__________________________________________
If knowledge can create problems, it is not through ignorance that we can solve them. - Isaac Asimov
Post Reply