How can I control incremental value in ODI?
642770Dec 23 2008 — edited Dec 29 2008Hi guys,
I have to do something on the target table by insert a incremental value to some field that need to automatically increase by 1.
Although , I tried with a variable that query a sequence from oracle but the output to the target table was the same number not the automatic increase number.
eg. I have a variable name "AUTO_INC" on ODI and "AUTO_SEQ" which is a sequence on oracle target site.
This variable has this statement
select AUTO_SEQ.nextval from dual;
So,This is my fault because after testing.
This variable was executed once.
The output from this variable is 1.
After I executed the interface. And check the result in the target table it shows that the field that contain incremental value is 1 in all rows.
Any idea?
By the way ,
I have tried the sequence and has some trigger on the target table.
And Let oracle do the automatic generate a sequence number not the ODI.
But it has a problem with number of the sequence that oracle generate was skipped.
eg. first time I execute the interface . The field that bind to the automatic sequence was fine (increasing value by 1 with sequnce)
Let's say I have 187 rows , So the last sequence number is 187.
After that I execute the interface again , and the next sequence number should be 188
But the result was 211.
I don't know why because this table nobody touch it excepts me.
Why the sequence number was skipped.
My SQL to create a Sequence:
create sequence AUTO_SEQ
start with 1
increment by 1
nomaxvalue;
A trigger that binding with target table :
create trigger test_trigger
before insert on test
for each row
begin
select AUTO_SEQ.nextval into :new.id from dual;
end;
Thanks in advance for every ideas.