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

Similar Messages

  • How to create unique constraint on a col which has duplicate values

    Hi all,
    how can i create a unique constraint on a field which have duplicate vaules with no validate clause.
    My table name is "ACCT"
    Regards
    Message was edited by:
    53637

    Check out following
    SQL>DROP TABLE TEST;
    Table dropped.
    SQL>CREATE TABLE TEST
      2  (
      3     ID          NUMBER
      4    ,NAME        VARCHAR2(30)
      5    ,CITY        VARCHAR2(30)
      6  );
    Table created.
    SQL>INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon');
    1 row created.
    SQL>INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon');
    1 row created.
    SQL>INSERT INTO TEST VALUES(2,'Dinesh','Delhi');
    1 row created.
    SQL>INSERT INTO TEST VALUES(1,'Rajan','Pune');
    1 row created.
    SQL>INSERT INTO TEST VALUES(1,'Rajan','Pune');
    1 row created.
    SQL>COMMIT;
    Commit complete.
    SQL>ALTER TABLE test ADD CONSTRAINTS uk_on_test UNIQUE(ID,NAME,CITY) DEFERRABLE NOVALIDATE ;
    Table altered.
    SQL>ALTER TABLE test
      2  ENABLE NOVALIDATE CONSTRAINT uk_on_test;
    Table altered.
    SQL>INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon');
    INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon')
    ERROR at line 1:
    ORA-00001: unique constraint (AIP.UK_ON_TEST) violatedRegards
    Arun

  • How to create Unique constraint

    Hi,
    How can I create a unique constraint on a column in a table which has already been created.
    Thanks

    ALTER TABLE your_table ADD CONSTRAINT yrt_uk UNIQUE (some_col)
    /You may find it illuminating to read the online documentation.
    Cheers, APC

  • How to create data stores in ODI ?

    Hi all,
    I am new to this ODI part.Can anyone please help me as how to create data stores in ODI.
    A prompt reply will be highly aprreciated.
    Thanks
    Saurabh.

    What do you mean by "create datastores"?
    If you mean you want to reverse engineer existing tables from a database, then the phrase used in the ODI docs is "reverse enginnering". If you mean to create new tables in a database, then:
    1) ODI is not meant to be a database design tool.
    2) Using the "diagrams" node under a data model, you are able to use the "Common Format Designer" (CFD) tool to design and create the structure. The CFD tool is a simple ER-digram tool, but importantantly, if you drag structures in from one model to another, it remembers where it came from, allowing automatic generation of interfaces, and it automatically translates the data types.

  • Create unique constraint on table

    Hello experts,
    Is it possible to define a unique constraint on table fields that aren't part of the primary key?
    Thank you in advance.

    One way is to create an index on the field and make it unique (SE11->GOTO->Indexes). Then in your programs Inserts, Appends and Updates would fail giving you a non zero SY-SUBRC when a program tries to enter a value that already exists.
    Don't forget to include MANDT in the index otherwise you'll end up with uniqueness across all clients

  • How to create mapping diagrams in ODI?

    Is there anything in ODI similar to informatica stencil for visio to create the mapping design diagrams to show the data flow and transformations in a visio schematic diagram?
    Thanks for your feedback.

    thanks for your reply.
    I am not looking to find where to design/create the map in ODI.
    This is for a schematic representation of the mapping for design documentation to show how the map is going to look like with icons of various transformations involved in the map and connecting arrows to show the data flow in the map.
    Something similar to this for informatica:
    https://community.informatica.com/mpresources/screenshots/Replication.png

  • How to create a metadata in ODI

    Hi
    Can anyone explain as to how can i create a metadata using ODI???
    Thanks n regards
    Gourisankar

    Hi David
    Thanks for the message and sorry for late reply.Actually i was on leave.
    BTW My repository Database is MSSQL2005 ans same is my Target database also.
    I have already Created ETL process and a package .
    Now i want ot use the Datawarehouse in Cognos for creating reports.
    For this i need to create a metadata and publish the same in FrameworkManager(Modelling tool of Cognos).
    Please help me out !!!!
    regards
    Gourisankar

  • How to Catch Unique Constraint in Exception

    Hi,
    I am writing a trigger TR_EMP on a table EMP which has columns EMP_ID, EMP_NAME, ALT_EMP_ID.
    Now I am updating ALT_EMP_ID for an EMP_ID(PK) which is unique.
    If ALT_EMP_ID is null
    then
          :new.ALT_EMP_ID = l_alt_emp_id;
    end if;As this ALT_EMP_ID is unique, same ID shouldn't be inserted again here. When data being inserted with 2 different sessions for 2 different EMP_ID there is a possible chance of inserting same ALT_EMP_ID for both which results in Unique error. I need to handle this exception. DUP_VAL_ON_INDEX or OTHERS Execption not able to handle this.
    Can you help me out on how to handle such exception?

    >
    jeneesh wrote:
    I am able to use dup_val_on_index
    >
    Can you please write an Exception for this query?
    If ALT_EMP_ID is null
    then     
          :new.ALT_EMP_ID = l_alt_emp_id;
    end if;jeneesh wrote:
    Moreover, what is your requirement? This design seems to be flawed. If you can explain teh actual requirement, forum members will be able to help you better..
    >
    Alternate Emp ID will be populated for Every employee. If on a same session when this ID is populated for 2 different Emplyoees then it will throw Unique constraint error, which should be handled.

  • How to create unique index on a View

    Hi All,
    11.2.0.1
    How do I create an index on a view or any workaround that my view wont get duplicates?
    SQL> create unique index indx01 on db_backup_details_vw(id);
    create unique index indx01 on db_backup_details_vw(id)
    ERROR at line 1:
    ORA-01702: a view is not appropriate here
    Thanks a lot,
    Kinz

    I'm thinking of using a distinct clause here.
    if i get 5 duplicate rows in my selection set because of the join condition, can't i discard the remaining 4 using a distinct clause.
    Observe this
    SQL> select * from a;
    T1 T2
    1 4
    2 4
    3 4
    SQL> select * from b;
    T1 T2
    1 4
    2 5
    in both a,b t1 is the primary key. so we'll write a join on t2 (non PK).
    SQL> select b.t1,b.t2 from a,b where a.t2=b.t2;
    T1 T2
    1 4
    1 4 -- duplicates
    1 4
    Now create view with distinct clause
    create view ab as select distinct b.t1,b.t2 from a,b where a.t2=b.t2;
    SQL> select * from ab;
    T1 T2
    ---------- ---------- -- no duplicates
    1 4
    CSM

  • How to create Unique Identifier and save it to identify user(device)

    I want to create unique identifier on iOS 5 and use it for identifying user (user device) every time app is started. I am able to create a unique identifier by following code 
    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID);
    But unable to save it on user device so that particular identifier is not deleted even when app is uninstalled. I tried using SSKeychain approach but it gives Apple Mach-o Linker error.
    Please let me know the the way I can accomplish the same.
    Any help is appreciated.

    I want to create unique identifier on iOS 5 and use it for identifying user (user device) every time app is started. I am able to create a unique identifier by following code 
    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID);
    But unable to save it on user device so that particular identifier is not deleted even when app is uninstalled. I tried using SSKeychain approach but it gives Apple Mach-o Linker error.
    Please let me know the the way I can accomplish the same.
    Any help is appreciated.

  • 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

  • How to create unique objects in class and store

    Hi, I have a class that opens a text file and reads in the
    lines. each line holds an ip address. i need to create x amount of
    objects, and each object is assigned a unique ip address from the file.
    and here i am stuck. the class reads in the file, then i think it should create an object for each line read in and assign that object the ip address. i want to store the objects in some sort of array or collection, and i guess each object will need a unique name, but i dont know how many objects until i read in the file and count the number of lines. can anyone give me any pointers as to how i should create/store the objects
    many thanx
    ness

    You could use your own object:
    public class Test {
      public class IPNumber {
        public int ip;
        public IPNumber(int ip) {
          this.ip = ip;
      public Test() {
        int numberOfIPs = 5; // this is your number of lines
        IPNumber[] ips = new IPNumber[numberOfIPs];
        for (int i = 0; i < numberOfIPs; i++) ips[i] = new IPNumber(i); // assign ip address from file
      public static void main(String args[]){
        new Test();
    }or you could store the ips as strings:
    public class Test {
      public Test() {
        final int numberOfIPs = 5; // this is your number of lines
        final java.util.ArrayList al = new java.util.ArrayList(numberOfIPs);
        for (int i = 0; i < numberOfIPs; i++) al.add(""+i); // assign ip address from file   
      public static void main(String args[]){
        new Test();
    }p.s Objects don't have names

  • 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 unique notification sounds for email on Droid Incredible 4G LTE

    I have three separate email accounts pushed to my Droid Incredible 4G LTE.  I can't for the life of me figure out how to set up unique notification sounds for each email account.  It was a snap to do on my old Blackberry.
    Same question for flagging individuals within my contact list.  (E.g., if my wife calls it makes one sound, if a client calls it makes a different sound.)
    Does anyone know how to do this, or, as they say, is there an app for that???
    Thanks in advance!

    I don't think you can on the email but got to each contact and edit them for different sounds, I'm not sure if it works on that new phone that way but as they don't have a dedicated room yet for it you had nowhere else to ask htc has good forums also

  • How to create unique key column in ROLAP fact table?

    Hi all,
    Is there a way to create a single column primary key (or unique index) on my ROLAP cube (and fact tables) in OWB? if so, what I should do in my mappings?
    Thanks!
    - Andrew

    Have you all conformed dimensions between the two facts?

Maybe you are looking for