How to create unique sequence number

Hello,
I'm new to ODI and trying to learn. Below is the requirement. Please advise.
I'm trying to load data from one database (oracle) to another database table (AS400). But when i load the data into AS400, I need to create a unique ID for each record and write this unique ID to one of the fields in AS400.
I don't have any issues loading the data from oracle to AS400. But I'm unable to generate a unique ID for each record. Can any share your thoughts how to get this.
Thanks for your help.

Hi ,
First, on the DB2/400 instance, create a table containing an Identity column:
CREATE TABLE THE_IDENTITY_TAB
(THE_IDENTITY_COL DECIMAL(31,0) GENERATED ALWAYS AS IDENTITY
START WITH 1000,
INCREMENT BY 1);
Second, in the same DB2/400 instance, create a function that returns an incremented number from the Identity column:
CREATE FUNCTION NEXT_IDENTITY_COL () RETURNS DECIMAL(31,0)
LANGUAGE SQL
MODIFIES SQL DATA
BEGIN
INSERT INTO THE_IDENTITY_TAB VALUES (DEFAULT);
DELETE FROM THE_IDENTITY_TAB;
RETURN (SELECT identity_val_local() FROM QSYS2.QSQPTABL);
END
Finally, in Designer, use the snpRef.getObjectName() substitution method to refer to the DB2/400 function in the interface's mapping for the appropriate field:
<%=snpRef.getObjectName("L","NEXT_IDENTITY_COL","<LOGICAL_SCHEMA_NAME>","D")%>()
Thanks,
Sutirtha

Similar Messages

  • How to Create a Sequence Number from BI Publisher Layout editor?

    How to Create a Sequence Number (1,2,3,4,......,etc) from BI Publisher Layout editor

    Thank you for your replay, but <?position()?> we can used it in template builder only not from BI layout editor
    I found a solution in this case we can used the following query.
    SELECT
    ROW_NUMBER() OVER(order by item_status) as Row,

  • How to create a sequence number to insert values to database

    I am working on the application for the client to insert their vendor informaton to our database. We have a refvendor table and vendorid is primary key. I was asked for the vendorid to be a sequential number. I am not sure if the DBA set up the vendor id to be a sequential number by creating sequence or is this something i can do myself. if so can you help me how i can create and make the vendor id a sequentiial number. Thank you
    Tablename is Refvendor
    vendorId, vendorname, dbestaus

    user452051 wrote:
    thank you for the reply. I am still learning about sequence. so the value from seq.netval will be inserted to the vendor id field. my first number will be 00001,00002,00003,00004,.... How can I do for the sequence to start with 00001If you create a sequence as shown, it will start with 1
    ,..... and my other question if I delete sequence 00002 will the number be re-arranged?no
    There will be gaps in the numbers.

  • How do you create a sequence number in SQL Developer Data Modeler?

    I am new to Data Modeler and am looking to create a sequence number but do not know how to do the same using the Data Modeler. Can someone guide me? Thanks.
    Edited by: user6710206 on Jun 9, 2010 7:32 AM

    I have had found that the following works sometimes when coming immediately after the create or replace package body in a script (although it isn't doing anything for me on invalid package bodies at the moment):
    show errors package body <package name>
    Because it is inconsistent, you cannot really trust it, which gets you back to Jim's options (open in editor or compile from connection tree) or the old long hand of
    select * from user_errors where type = 'PACKAGE BODY' and name = '<package name>'

  • How to create a SEQUENCE in MSSQL2005

    Hi
    I am also having a similar problem which opened the thread
    Actually i am using a Repositery which is created in MSSQL2005.
    Now i want to create a SEQUENCE similar to Oracle and populate My surrogate Key Column.
    Can u tell me how to create a SEQUENCE in MSSQL2005?
    Does anyone is having the sql syntax?
    Thanks
    Gourisankar

    Hi Gourisankar,
    There is no sequence concept in MS SQL Server rather it has IDENTITY.
    In MS SQL Server if you declare a column type as a Identity it will be auto increment when a new record inserts.
    So in you underlying table create a column as ID and type as "Identity" and in your mapping leave that field un mapped.
    Have a look and google more on "identity in ms sql server" ;)
    http://www.sqlteam.com/article/autonumbering-identity-columns
    http://www.craigsmullins.com/ssu_0599.htm
    Thanks,
    G

  • How to Create Test Sequence Document in HTML using command line

    How to Create Test Sequence Document  in HTML using command line
    I have lot of sequences and I want to create Test Sequence Documentation in HTML format using Command Line automatically, is there a way to automate this task using .bat file or using   C#  .Net

    If you aren't able to figure out how to call a C++ DLL in .net then there may be another option.  Unfortunately I don't know how to do this off the top of my head and I don't have an example.
    The other option would be to change docgen.seq a little bit to the dialog doesn't display and you just hardcode the options.  Then you can use a command line to call testexec.exe: http://zone.ni.com/reference/en-XX/help/370052K-01/tsfundamentals/infotopics/startup_opt/
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • How to create a sequence DDL in a procedure

    Hello,
    i have a simple question but i dont find a solution here.
    How to create a sequence DDL in a procedure ?
    Thank 's

    Use Native Dynamic Sql. Look at the EXECUTE IMMEDIATE command.
    declare
    begin
       execute immediate 'create sequence xx_seq ';
    end;
    /Of course you need explicit permission to create a sequence. NOT through a ROLE.

  • How to create automatic serial number for ticket in illustrator?

    How to create automatic serial number for ticket in illustrator?

    Check this out
    http://forums.adobe.com/message/1271310#1271310

  • How to create Unique Number.

    I need to create a Unique Request Number for System.
    how Can i create this in Oracle.
    Regards,
    Agrawal's

    I have One table Says PRINT_MGMT_LOG & in this table there are more than 10 columns, so can i create SEQUENCE in this table or should i make a new table having one column to store these running number.
    Which one will be better considering performance issues.

  • How to create a sequence based on name, country, city, year, month, number

    Hello,
    I am using Application Express 4.2.1.00.08
    I am new to apex and i need some help in creating a sequence.
    I am creating an application where i profile people and i need to create an auto sequence that when the person is added to the database he will have his own sequence based on his name, country, city, year he was added, month he was added and his number.
    This is a bit tricky because each person will have a different name, country city etc.
    How can this be done ?

    Hello,
    I have to create a sequence so that when for example an employee is added using a form his ID will be saved based on his name, country, city, year he was created, month he was created and his number.
    However, each employee is diff, so when you add another employee to the form his ID will be different, different name, country, city etc..
    This has to be automatically generated.. is this possible?

  • How to create an INSERT trigger which creates a "sequence number"

    Imagine a table T_Q with columns C_1, C_2, C_3 and UN_123.
    C_1, C_2 and C_3 are all numeric and given by the user.
    UN_123 has to be a calculated sequence number starting by 1 and incremented by 1 for each combination of C_1, C_2 and C_3, i.e., the sequence number depends on the key values C_1, C_2 and C_3.
    Could anybody provide a code sample on how to create a BEFORE INSERT trigger , which calculates the value of the column UN_123 based on the values of C_1, C_2 and C_3 ??
    Premise: Rather than using any sequence, the trigger code should only be based on the table T_Q
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Rainer Wagner ([email protected]):
    Imagine a table T_Q with columns C_1, C_2, C_3 and UN_123.
    C_1, C_2 and C_3 are all numeric and given by the user.
    UN_123 has to be a calculated sequence number starting by 1 and incremented by 1 for each combination of C_1, C_2 and C_3, i.e., the sequence number depends on the key values C_1, C_2 and C_3.
    Could anybody provide a code sample on how to create a BEFORE INSERT trigger , which calculates the value of the column UN_123 based on the values of C_1, C_2 and C_3 ??
    Premise: Rather than using any sequence, the trigger code should only be based on the table T_Q<HR></BLOCKQUOTE>
    null

  • How to create a sequence in oracle forms6i

    Oracle forms 6i
    Hai All
    I am working in leave application entry so i need to create a sequence for giving a unique number for each entry
    Pls tell me the steps how to created and how to call the sequence from database
    Thanks in Advance
    Srikkanth.m

    Hi,
    Create sequence <sequence_name>
    Start with <number>
    increment by <number>
    in database
    eg:- create sequence test_seq
    start with 1
    increment by 1;
    in forms
    you can assign value in pre-insert trigger
    Declare
    cursor cur_seq is
    select test_seq.nextval from dual;
    begin
    open cur_seq;
    fetch cur_seq into :item_key ; /* :item_key give name of ur primary key field*/
    close cur_seq;
    end;

  • How to create a sequence for an particular item in my apex form

    Hi friends,
    I created an database application, of a form with a report, and it is working fine...
    But in my form, i have a requirement....The below are the existing fields in my form
    issue no
    created by
    start date
    status
    priority
    due date
    Among these fields in my form i need to create a 'Sequence' for my field "issue no",
    So that whenever i opened the form the 'issue number' must generate automatically like 1 for the first time, 2 for the second time and so on..
    For that i created a sequence
    CREATE SEQUENCE "ORDERS_SEQ"
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    INCREMENT BY 1
    START WITH 1000
    NOCACHE
    NOCYCLE;
    But for validation where i need to write the sequence query for the particular item 'issue no'....i dont have any idea of where to write the validation query for the sequence..
    please tell where i need to write in step wise manner..please help me friends...
    As the below is my validated sequence query for item 'issue no'
    'select seq.issue_id.nextval into issue_no'
    This is my above validation query whether the query that i mentioned is right..if not let me know the validation query..
    And also i need where to apply this validation query in steps..
    Thanks in advance
    Regards,
    Harry...

    Harry,
    Rik is on the right track. Here is a sample insert trigger: Would need to substitute you sequence ORDERS_SEQ with my sequence las_log_seq, how you define or use timestamps is up to you.
    DROP TRIGGER LASDEV.BINS1_LAS_LOG_TBL;
    CREATE OR REPLACE TRIGGER LASDEV."BINS1_LAS_LOG_TBL"
       BEFORE INSERT
       ON las_log_tbl
       FOR EACH ROW
    BEGIN
       -- Description: Insert log_seq, creation_dt, creation_id,
       --              lst_updt_dt and lst_updt_id.
       -- Maintenance:
       -- Date        Actor          Action
       -- ====        =====          ======
       -- 07-Sep-2010 J. Wells       Create.
       :new.creation_id := nvl( v( 'app_user' ), user );
       :new.creation_dt := SYSDATE;
       :new.lst_updt_dt := :new.creation_dt;
       :new.lst_updt_id := :new.creation_id;
        SELECT las_log_seq.NEXTVAL
          INTO :new.las_log_seq
          FROM DUAL;
    END bins1_las_log_tbl;
    /Heff

  • How to create a sequence in ABAP?

    Hi guys,
    we have a requirement to create some data in a FM and every document must have a unique sequential number. How to achieve this?
    Numbering should be in a format 0009561544 (so 10 chars) and should start from 0001000000.
    One option would be to create a table with one value and read and increase it's value each time it is called.
    Is there any other option how to achieve it?
    Thank you,
    Olian

    Hi Rob,
    thank you for the answer.
    Can you please tell me more details about it? When I create a number range object, how can I retrieve a current value and increase it from a FM?
    Thanks,
    Olian

  • How to create unique constraint in ODI

    Hi
    I have view at source side, I want to store source data to target interface table.
    For that I need to create UNIQUE constraint at source side to identify the unique records.
    I have composite primary key example as follow
    desc Test_V;
    orderID NUMBER,
    itemNumber NUMBER,
    productId NUMBER,
    quantity NUMBER,
    lot_number varchar2(80)
    where
    PRIMARY KEY (orderID, itemNumber,lot_number);
    Some times, lot_number can be null, So, I can't use lot_number in composite key (as per requirement)
    Please any body can help me on it
    Thanks
    Phani

    Hi
    Hope this may help
    http://mhimu.wordpress.com/2009/05/04/odi-incremental-update-and-surrogate-key-using-database-sequence/
    but some cases it is not working
    Thanks
    Phani

Maybe you are looking for

  • How do you get your experts with negative stance for new things / innovations to HANA

    We have over 50 ABAP developer (senior experts). Primarily we develop in the old core module (SD, MM, FI, CO, HR, PP, CS, IH, PS) on ERP systems / business suite. We have three groups of developer: Group 1: They can’t await to work on new architectur

  • Is there any possible that pivot table can display date values in the data area like this?

    I use Power Query to load data(including all the of data showed in the following table without accumulating) from database to the Excel Worksheet, and I want to build a pivot table like this. But the data area of the pivot table can only accecpt and

  • Problem in Hierarchy

    Hi All,   i am trying to install the SAP standard 'Balance sheet' (0FIGL_VC1_Q0001) query. The query uses the hierarchy loaded from the R/3 system to the characteristics 0GLACCEXT. In that i have a leaf node for charc value '0GLACCEXT' = 'EICA/000400

  • Building CrossBridge on WIndows

    As noted elsewhere, I constructed a minimal PATH variable to exclude random unix-like tools from the tool chain.  That got me a ways through the "make". My current stumble is in make "make" checking whether the C compiler works... no configure: error

  • SAP Certified Logo / S-userid ???

    Hello friends, Last week i have cleared C_TADM51_70 : SAP Certified Technology Associate - System Administration (Oracle DB) with SAP NetWeaver 7.0 test. I have seen few threads regarding discussion on : SAP Certified Logo/Technical Consultant Logo S