Search code examples
oracletalend

Talend how to use an Oracle database created sequence


I've created a sequence object in Oracle DB and I need to assign it to a context variable in Talend and so that I can increment the value from Talend. How can I do that? What component should I use and how can I assign the value to the variable? I couldn't find any guide.


Solution

  • As you have said that your Sequence is already created, assuming you (your schema) will be having SELECT privilege on the Sequence.

    In that case you could simply say (to generate the next sequence number) -

    SELECT <yoursequencename>.NEXTVAL FROM dual;

    Put this query in your tOracleInput and connect a row to say tJavaRow. In tJavaRow you would have to read the input row value and assign it to your already created context variable, something like this -

    context.CurrentDate = input_row.CurrentDate;
    System.out.println(context.CurrentDate);