Automatic ID generation in target table

I have source datastore(textfile.txt containing only one field) with datastructure (lets say: Name varchar(25))
Data structure of target datastore (id varchar(25), Name varchar(25))
Now i want to insert this textfile to db. Name is mapped to Name field of target datastore. But ID field should be automatically incremented in target datastore.(1,2,3......).
How can i achieve this?
with regards

Hi ,
Oracle is you Target DB, If yes you could follow the belosw steps to achive automatic increemeting ....
CREATE A VARIABLE NUMERIC AND HISTORIZE:
Then in the Refresh Tab, write this code :
SELECT NVL (MAX(EMPID),1001) FROM TESTTABLE  CREATE A PROCEDURE :
1.DROP SEQUENCE SEQUENCENAME ( Dont forget to mention Ignore Errors, the reason when u first run the interface, it will go into Error since no Sequence is been created Before)
2.
CREATE SEQUENCE SEQUENCENAME
MINVALUE #variablename or ( you can also directly have value eg:1001)
MAXVALUE 2001
START WITH 1001
INCREMENT BY 1
CACHE 20Use this Syntax in the Interface corresponding to the Column:
SEQUENCENAME.NEXTVALHope this helps...
Thanks
Ananda
Edited by: Ananda on Aug 3, 2009 1:46 PM
Edited by: Ananda on Aug 3, 2009 1:49 PM

Similar Messages

  • Create Target Table Automatically with ODI

    Hi,
    We can reverse engineer the source table Schema from the source Database, does ODI support creating the target schema based on the source schema on the Target Database automatically? is there any better way rather than creating manually on the target DB? Thanks in advance!

    If you are setting the staging area different from target then at IKM level choose CREATE TARGET TABLE to YES.
    ODI will create the target table for you. In ODI we call this type of interface as Yellow Interface.

  • Table compare deleting rows which does not exist in target table

    Hi Gurus,
    I am struggling with an issue in Data Services.
    I have a job which uses Table Compare, then History Preserving and then a Key Generation transforms.
    There is every possibility that data would get deleted from the source table.
    Now, I want to delete them from the target table also.
    I tried Detect deleted rows but it is not working.
    Could some one please help me on this issue.
    Thanks,
    Raviteja.

    Doesn't history preserving really only operate on "Update" rows.  Wouldn't it only process the deletes if you turned the "Preserve Delete row(s) as update row(s)" on?
    I would think if you turned on Detect Delete rows in the Table compare and did not turn this on in the history preserving it would retain those rows as delete rows and effectively remove them from the target.
    Preserve delete row(s) as update row(s)
    Converts DELETE rows to UPDATE rows in the target warehouse and, if you previously set effective date values (Valid from and Valid to), sets the Valid To value to the execution date. Use this option to maintain slowly changing dimensions by feeding a complete data set first through the Table Comparison transform with its Detect deleted row(s) from comparison table
    option selected.

  • Load data from flat file to target table with scheduling in loader

    Hi All,
    I have requirement as follows.
    I need to load the data to the target table on every Saturday. My source file consists of dataof several sates.For every week i have to load one particular state data to target table.
    If first week I loaded AP data, then second week on Saturday karnatak, etc.
    can u plz provide code also how can i schedule the data load with every saturday  with different state column values automatically.
    Thanks & Regards,
    Sekhar

    The best solution would be:
    get the flat file to the Database server
    define an External Table pointing to that flat file
    insert into destination table(s) as select * from external_table
    Loading only single state data each Saturday might mean troubles, but assuming there are valid reasons to do so, you could:
    create a job with a p_state parameter executing insert into destination table(s) as select * from external_table where state = p_state
    create a Scheduler chain where each member runs on next Saturday executing the same job with a different p_stateparameter
    Managing Tables
    Oracle Scheduler Concepts
    Regards
    Etbin

  • How to gather stats on the target table

    Hi
    I am using OWB 10gR2.
    I have created a mapping with a single target table.
    I have checked the mapping configuration 'Analyze Table Statements'.
    I have set target table property 'Statistics Collection' to 'MONITORING'.
    My requirement is to gather stats on the target table, after the target table is loaded/updated.
    According to Oracle's OWB 10gR2 User Document (B28223-03, Page#. 24-5)
    Analyze Table Statements
    If you select this option, Warehouse Builder generates code for analyzing the target
    table after the target is loaded, if the resulting target table is double or half its original
    size.
    My issue is that when my target table size is not doubled or half its original size then traget table DOES NOT get analyzed.
    I am looking for a way or settings in OWB 10gR2, to gather stats on my target table no matter its size after the target table is loaded/updated.
    Thanks for your help in advance...
    ~Salil

    Hi
    Unfortunately we have to disable automatic stat gather on the 10g database.
    My requirement needs to extract data from one database and then load into my TEMP tables and then process it and finally load into my datawarehouse tables.
    So I need to make sure to analyze my TEMP tables after they are truncated and loaded and subsequently updated, before I can process the data and load it into my datawarehouse tables.
    Also I need to truncate All TEMP tables after the load is completed to save space on my target database.
    If we keep the automatic stats ON my target 10g database then it might gather stats for those TEMP tables which are empty at the time of gather stat.
    Any ideas to overcome this issue is appreciated.
    Thanks
    Salil

  • Automatic number generation using the function module

    Hai Everyone,
    I have the doubt in automatic number generation.
    i find the function module. the function module is
    report 123.
    *DATA: RC         LIKE INRI-RETURNCODE,
         NUMBER(10) TYPE C.
       CALL FUNCTION 'NUMBER_GET_NEXT'
            EXPORTING OBJECT          = 'HUGO'
                        NR_RANGE_NR     = '01'
            IMPORTING RETURNCODE      = RC
                        NUMBER          = NUMBER.
      CASE RC.
        WHEN ' '.
         everything o.k.
        WHEN '1'.
         the assigned number lies in the critical area.
        WHEN '2'.
         this was the last number, next time the first number
          will be assigned
      ENDCASE.
      write:/ number.
      in that function module what i want to give the  Exporting Object  'HOGO'. where i want to define the number range. what is meant by 'HOGO'.
    If any one faced the same problem plz help me.
    Thanks and regards,
    P.Naganjana Reddy

    Hai Chandrasekhar,
    in that what i have to give. Plz help me in this.
    Subobject data element
    To-year flag
    Number length domain
    No interval rolling
    Number range transaction
    Warning %
    Main memory buffering
    Group table
    Subobject field in group table
    Fld  NoRangeElement
    Fields int./ext. no.range no.
    Fld. NoRangeNo
    Display element text
    Thasnks and regards,
    P.Naganjana reddy

  • How to execute query to store the result in the target table column ?

    Hi
    Source: Oracle
    Target: Oracle
    ODI: 11g
    I have an interface which loads the data from source table to target. Some of the columns in the target tables are automatically mapped with source table. Some of the column remain un-mapped. Those who remain un-mapped, I want to load the values in that column by executing an query. So can anybody tell me where I should mention that query whose result would become the value of the specific column.
    -Thanks,
    Shrinivas

    Actually I select the column from the target table then in the Property Inspector-->Mapping properties-->Implementation
    tab I have written the query which retrieve the value for that column. Is the right place to write the query? How can do this ?
    -Shrinivas

  • How find target table in interface which in package

    Hi All,
    I have a question?
    I created interface INT1
    I created variable VAR1
    I placed INT1 in package I need to get INT1 target table in to variable.
    Could you please help in write in the query to find target table of previous interface.
    Appreciate your help.

    Create a logical schema to refer work repository schema. For var1 with this logical schema, in the refresh section, run the following query:
    SELECT table_name FROM snp_pop WHERE pop_name = 'INT1';
    I do not see any hope to derive the interface name automatically unless you use scenarios and invoke it through variables.

  • Can not Load CLOB data 32k to target table

    SQL> DESC testmon1 ;
    Name Null? Type
    FILENAME VARCHAR2(200)
    SCANSTARTTIME VARCHAR2(50)
    SCANENDTIME VARCHAR2(50)
    JOBID VARCHAR2(50)
    SCANNAME VARCHAR2(200)
    SCANTYPE VARCHAR2(200)
    FAULTLINEID VARCHAR2(50)
    RISK VARCHAR2(5)
    VULNNAME VARCHAR2(2000)
    CVE VARCHAR2(200)
    DESCRIPTION CLOB
    OBSERVATION CLOB
    RECOMMENDATION CLOB
    SQL> DESC test_target;
    Name Null? Type
    LOCALID NOT NULL NUMBER
    DESCRIPTION NOT NULL CLOB
    SCANTYPE NOT NULL VARCHAR2(12)
    RISK NOT NULL VARCHAR2(6)
    TIMESTAMP NOT NULL DATE
    VULNERABILITY_NAME NOT NULL VARCHAR2(2000)
    CVE_ID VARCHAR2(200)
    BUGTRAQ_ID VARCHAR2(200)
    ORIGINAL VARCHAR2(50)
    RECOMMEND CLOB
    VERSION VARCHAR2(15)
    FAMILY VARCHAR2(15)
    XREF VARCHAR2(15)
    create or replace PROCEDURE proc1 AS
    CURSOR C1 IS
    SELECT FAULTLINEID,VULNNAME,scanstarttime, risk,
    dbms_lob.substr(DESCRIPTION,dbms_lob.getlength(DESCRIPTION),1) "DESCR",dbms_lob.substr(OBSERVATION,dbms_lob.getlength(OBSERVATION),1) "OBS",
    dbms_lob.substr(RECOMMENDATION) "REC",CVE
    FROM testmon1;
    c_rec C1%ROWTYPE;
    descobs clob;
    FSCAN_VULN_TRANS_REC VULN_TRANSFORM_STG%ROWTYPE;
    TIMESTAMP varchar2(50);
    riskval varchar2(10);
    pCTX PLOG.LOG_CTX := PLOG.init (pSECTION => 'foundscanVuln Procedure',
    pLEVEL => PLOG.LDEBUG,
    pLOG4J => TRUE,
    pLOGTABLE => TRUE,
    pOUT_TRANS => TRUE,
    pALERT => TRUE,
    pTRACE => TRUE,
    pDBMS_OUTPUT => TRUE);
    amount number;
    buffer varchar2(32000);
    BEGIN
    ---INITIALIZE THE LOCATOR FOR CLOB DATA TYPE
    select observation into descobs from testmon1 where rownum=1;
    OPEN C1;
    loop
    fetch C1 INTO c_rec;
    exit when C1%NOTFOUND;
    --LOAD THE DESCRIPTION FIELD FROM CURSOR AND WRITE IT TO THE CLOB LOCATOR descobs.
    dbms_lob.Write(descobs,dbms_lob(c_rec.DESCR),1,c_rec.DESCR);
    ------APPEND THE OBSERVATION FIELD FROM CURSOR TO THE CLOB LOCATOR descobs.
    dbms_lob.Writeappend(descobs,dbms_lob(c_rec.DESCR),c_rec.OBS);
    -- dbms_output.put_line ('the timestamp is :'||c_rec.scanstarttime);
    --dbms_lob.write(descobs,amount,1,buffer);
    descobs:=c_rec.OBS;
    --dbms_lob.read(descobs,amount,1,buffer);
    --dbms_lob.append(c_rec.DESCR,c_rec.OBS);
    --descobs:=c_rec.OBS;
    --dbms_output.put_line ('the ADDED DESCROBS is :'||dbms_lob.substr(c_rec.DESCR,dbms_lob.getlength(c_rec.DESCR),1));
    dbms_output.put_line ('the ADDED DESCRIPTION AND OBSERVATION is :'||descobs);
    --dbms_output.put_line ('the DESCROBS buffer  is :'||buffer);
    SELECT DESCRIPTION INTO FSCAN_VULN_TRANS_REC.DESCRIPTION
    FROM TESTMON1 WHERE ROWNUM=1;
    ---------LOAD THE DESCRIPTION+ observation value into the target table description
    DBMS_LOB.WRITE(FSCAN_VULN_TRANS_REC.DESCRIPTION, dbms_lob.getlength(descobs),1,descobs);
    TIMESTAMP:=substr(c_rec.scanstarttime,1,10)||' '|| substr(c_rec.scanstarttime,12,8);
    IF c_rec.risk <3
    THEN riskval:='Low';
    ELSIF c_rec.risk <6
    THEN riskval:='Medium';
    ELSIF c_rec.risk <10
    THEN riskval:='High';
    END IF;
    FSCAN_VULN_TRANS_REC.TIMESTAMP:=TO_DATE(TIMESTAMP, 'YYYY/MM/DD HH24:MI:SS');
    FSCAN_VULN_TRANS_REC.risk:= riskval;
    --dbms_lob.append(c_rec.DESCR,c_rec.OBS);
    FSCAN_VULN_TRANS_REC.DESCRIPTION:=c_rec.DESCR;
    FSCAN_VULN_TRANS_REC.RECOMMEND:=c_rec.REC;
    FSCAN_VULN_TRANS_REC.LocalID:=to_number(c_rec.FAULTLINEID);
    FSCAN_VULN_TRANS_REC.SCANTYPE:='FOUNDSCAN';
    FSCAN_VULN_TRANS_REC.CVE_ID:=c_rec.CVE;
    FSCAN_VULN_TRANS_REC.VULNERABILITY_NAME:=c_rec.VULNNAME;
    -- dbms_output.put_line ('the plog timestamp is :'||timestamp);
    -- dbms_output.put_line ('the timestamp is :'||riskval);
    --dbms_output.put_line ('the recommend is :'||FSCAN_VULN_TRANS_REC.RECOMMEND);
    --dbms_output.put_line ('the app desc is :'||FSCAN_VULN_TRANS_REC.DESCRIPTION);
    insert into test_target values FSCAN_VULN_TRANS_REC;
    End loop;
    close C1;
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    -- dbms_output.put_line ('Data not found');
    -----------dbms_output.put_line (sqlcode|| ':'||sqlerrm);
    end proc1;
    using dbms_lob package is not helping. Either DB stops responding. Or the Observation field ( which has max length >300000) can not be loaed into a CLOB variable.
    Please help or give me a sample code that helps.

    select     
         BANKING_INSTITUTION.BANK_REF_CODE     C1_BANK_ID,
         BANKING_INSTITUTION.NAME_BANK     C2_BANK_NAME,
         BANKING_INSTITUTION.BANK_NUMBER     C3_BANK_NUMBER,
         BANKING_INSTITUTION.ISO_CODE     C4_GBA_CODE,
         BANKING_INSTITUTION.STATUS     C5_STATUS,
         BANKING_INSTITUTION.SOURCE     C6_SOURCE,
         BANKING_INSTITUTION.START_DATE_BANK     C7_START_DATE,
         BANKING_INSTITUTION.ADDRESS_BANK     C8_BANK_ADDRESS1
    from     REF_DATA_DB.BANKING_INSTITUTION BANKING_INSTITUTION
    where     (1=1)
    insert /*+ append */ into XXSVB.C$_0XXSVB_BANKS_STAGING
         C1_BANK_ID,
         C2_BANK_NAME,
         C3_BANK_NUMBER,
         C4_GBA_CODE,
         C5_STATUS,
         C6_SOURCE,
         C7_START_DATE,
         C8_BANK_ADDRESS1
    values
         :C1_BANK_ID,
         :C2_BANK_NAME,
         :C3_BANK_NUMBER,
         :C4_GBA_CODE,
         :C5_STATUS,
         :C6_SOURCE,
         :C7_START_DATE,
         :C8_BANK_ADDRESS1
    )

  • Null value in target table

    Hi All
    I am using ODI 10.1.13
    I have declred teh Target datastore
    and mapped the target datastore with source in teh interface
    But when ODI is creating teh target database all the columns are created with accepting NULL Properties.
    where as i hv declared some as null and some with notnull.
    when i checked in IKM Oracle Incrimental KM(MERGE)-> create target table step
    the coding is
    create table <%=odiRef.getTable("L", "TARG_NAME", "A")%>
         <%=odiRef.getTargetColList("", "[COL_NAME]\t[DEST_CRE_DT] NULL", ",\n\t", "")%>
    due to which the target table is created with all field havine NULL properties.
    But i want the columns should hv the properties declared in the datastore.Eg. some columns with NULL and some columns with NOT NULL properties.
    Please help..
    Gourisankar

    In the IKM Merge , change the null to + odiRef.getInfo("DEST_DDL_NULL") so finally something like this <%=odiRef.getTargetColList("", "[COL_NAME]\t[DEST_CRE_DT] " + odiRef.getInfo("DEST_DDL_NULL"), ",\n\t", "")%> For bulk insert try SQL Control Append

  • Error in code generation for deleting table BUT000_TD

    Hi,
    Did anyone encounter this error while working on EEWB ?
    I created the project extension via EEWB and completed the wizard setting with the package (dev. class) value as $temp as I wanted to test it locally.
    One of the errors, that I got is:
    Error in code generation for deleting table BUT000_TD
        Message no. DA464
    Diagnosis
        This error message indicates that internal inconsistencies exist.
    Procedure
        Please consult SAP.

    Hi,
    As I mentioned in my previous post kindly check the consistency of the structure BUT000_TD.
    Regards,
    Sudheer.

  • How to load data into 3 different target tables usin BODS ?

    Hello Friends,
    I have 5 different source tables with same field definitions, Now I want to load all the records into three/four different target tables (Flat file, SQL Server, XML, and Oracle ) Could anyone please tell me how to do this task ?
    Thanks in Advance,
    Bheem.

    Hello Bheem,
    You can create separated dataflow for each target as suggested by Bala, this is a good choice when evaluating you scenario.
    If you put all targets in the same dataflow you may experience problems if one of them is down (as you have different servers as targets).
    BODS will send the data simultaneously to all targets and when one fails, the load will be break and you may have the tables not sinc anyways (if you plan to use a single dataflow to avoid this situation, it won't do it).
    So the best option is to create separated dataflow and put inside another one so you can run a singe dataflow that will call each one of the target and if onw fails the other will complete accordingly.
    Then if you put them inside a error trapping, you may even make your dataflow to retry the load prior abend the job.
    Think about cascading your dataflows and let the leaf level simple as it can be so it will be easier to schedule and debug your process.
    Pay attention to datatypes and other conversions you might need when working with more than one source/target.
    Regards,

  • How to delete some date in target table at a mapping?

    How to delete some date in target table at a mapping?
    I extract date from source tabel into target table,
    but before extract date I want to delete some date from target?
    how to do?

    Just to change a bit of terminology in the reply, within the mapping, click on operator properties and choose TRUNCATE/INSERT.
    Note that truncate is dependent on constraints, so you probably must disable those before doing this. You can of course do DELETE/INSERT...
    Jean-Pierre

  • How do I create a target table with the same PK as the source table?

    I am trying to create a target table in a mapping that will end up with the same primary key as the source table.
    It is a simple map that simply uses a subset of the columns of the source table in the target table. I was wanting to create and bind a new table by dragging the columns I want from the source to the initially blank target table operator, change the column names and create a primary key to match the source table.
    I can't seem to be able to create a constraint on the table in the mapping. I can create the constraint after the table is created and boound to the database object but the PK doesn't carry back into the mapping.
    I need it in the mapping so I can use the UPDATE/INSERT operation and use the 'All Constraints' implementation. The mapping won't let me validate the object without the PK on it in the map.
    Believe it or not folks, I am getting better at this.
    Thanks very much for the guidance.
    Gary

    Hi Gary
    You are close, you are really close... :-))
    You need to do exactly as you propose plus one extra step. Build the map as you describe, binding the new table to the target. Then you edit the table definition to add the primary key and any other constraints you need. After this is the step that you are missing.
    You need to do the following:
    1. Go back and re-edit the map
    2. Right click on the table
    3. From the pop up menu, select Reconcile Inbound
    4. Set any operators that you need for the UPDATE/INSERT
    5. Save the map
    6. Commit your changes
    The first three steps above make the map read in the indexes and constraints that you set on the table. Finally, you need to deploy the table and then deploy the map.
    Hope this helps
    Regards
    Michael

  • How to get source table name according to target table

    hi all
    another question:
    once a map was created and deployed,the corresponding information was stored in the repository and rtr repository.My question is how to find the source table name according to the target table,and in which table these records are recorded.
    somebody help me plz!!
    thanks a lot!

    This is a query that will get you the operators in a mapping. To get source and targets you will need some additional information but this should get you started:
    set pages 999
    col PROJECT format a20
    col MODULE format a20
    col MAPPING format a25
    col OPERATOR format a20
    col OP_TYPE format a15
    select mod.project_name PROJECT
    , map.information_system_name MODULE
    , map.map_name MAPPING
    , cmp.map_component_name OPERATOR
    , cmp.operator_type OP_TYPE
    from all_iv_xform_maps map
    , all_iv_modules mod
    , all_iv_xform_map_components cmp
    where mod.information_system_id = map.information_system_id
    and map.map_id = cmp.map_id
    and mod.project_name = '&Project'
    order by 1,2,3
    Jean-Pierre

Maybe you are looking for

  • Apple id/ icould family sharing

    I was hoping someone could help me or point me in the right direction.  I have been using my old mobile me account converted into icloud account for my phone (thankfully paid for by work) on my iPhone 5s and  iPad mini.  Before family sharing was ava

  • Can't import LDIF format exported mail address to Address Book

    New to iMac and trying full migration from PC I have a LDIF format address file (exported from Comcast's Webmail in Netscape Communicatore LDIF format). Can't import the file to my new iMAC's Address Book. Getting the following msg: No Cards Added. N

  • Printing Calendar:An unexpected error occurred.  Please try again later.

    I have been trying unsuccessfully for 3 days to print out a calendar from iphoto. I have done this every year for xmas gifts and this usually goes off without a hitch. I click on buy calendar and it makes me login to my account (account works, I can

  • T61 Cut off in middle of working and will not come back on

    I have a T61p that was working fine, then just cut off.   It was plugged into power outlet.  It will not come back on, or display any lights.  I have tried the 10 power button pushes, last for 30 secs several times now and it does not have an effect.

  • Fonts/Styles - Word vs. RoboHelp

    I just received the 9.0.2 upgrade to RoboHelp HTLML. We use about 10 styles in our Word documents only. In version 7 of RH, there used to be an option where I could have the Word styles remain intact and RoboHelp would not "change" them (I only had t