How to Load data for extra columns exist in the dest schema....

Hi Experts,
Please help me.
I need to replicate data from SchemaA to SchemaB.
SchemaB has 3 extra columns. Two are varchar2 type and other is Integer type.
I need to replicate the data from SchemaA to SchemaB in the same database.
When ever i inserted the data in SchemaA, The extra columns should be populated with some default data.
And if we did any update on SchemaA then the extra columns on SchemaB should be populated with other Data.
I wrote some DML_HANDLER but it always populating same data.
I dont know ow to handle this type of situation.
my Handler is:
CREATE OR REPLACE PROCEDURE dml_handler(in_any in sys.anydata)
IS
lcr SYS.LCR$_ROW_RECORD;
rc PLS_INTEGER;
object_owner VARCHAR2(30);
BEGIN
rc := in_any.GETOBJECT(lcr);
object_owner := lcr.GET_OBJECT_OWNER();
IF lcr.get_object_owner() = 'SchemaB' THEN
lcr.add_column('new','SHIP_DATE',sys.anydata.convertvarcahr2('N'));
lcr.add_column('new','SHIP_ZONE',sys.anydata.convertvarchar2('N'));
lcr.add_column('new','SHIP_REACH_BY_DATE',sys.anydata.convertnumber(1));
lcr.EXECUTE(TRUE);
END IF;
END;
BEGIN
DBMS_APPLY_ADM.SET_DML_HANDLER
(object_name => 'SchemaB.TAB_TEST',
object_type => 'TABLE',
operation_name => 'INSERT',
error_handler => FALSE,
user_procedure => 'STRMADMIN.DML_HANDLER');
END;
On extra columns in SChemaB
if its a first insert then the default values are (N,N,1).
If we did any update the values should be (Y,Y,2)
Post any script or give me some idea.
Thanks,
Ray
Edited by: user7423698 on Mar 3, 2009 6:12 PM

CREATE OR REPLACE PROCEDURE dml_handler (
in_any IN SYS.ANYDATA
IS
lcr sys.lcr$_row_record;
rc PLS_INTEGER;
cmd_type VARCHAR2 (30);
BEGIN
rc := in_any.getobject (lcr);
cmd_type := lcr.get_command_type;
IF cmd_type = 'INSERT'
THEN
lcr.set_values ('new', lcr.get_values ('new', 'N'));
lcr.add_column ('new', 'type', sys.anydata.convertchar ('I'));
lcr.set_values ('old', NULL);
lcr.add_column ('new', 'time', sys.anydata.converttimestamp (systimestamp));
lcr.execute (TRUE);
END IF;
END;
Set the DML handler for INSERT and write a similar one for UPDATE.

Similar Messages

  • Problem in Loading data for clob column using sql ldr

    Hi,
    I am having problem in loading data for tables having clob column.
    Could anyone help me in correcting the below script for ctrl file inorder to load the data which is in mentioned format.
    Any help really appreciated.
    Table Script
    Create table samp
    no number,
    col1 clob,
    col2 clob
    Ctrl File
    options (skip =1)
    load data
    infile 'c:\1.csv'
    Replace into table samp
    fields terminated by ","
    trailing nullcols
    no,
    col1 Char(100000000) ,
    col2 Char(100000000) enclosed by '"' and '"'
    Data File(1.csv)
    1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
    2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"
    Error Encountered
    ORA-01461: can bind a LONG value only for insert into a LONG column
    Table sampThanks in advance

    I can't reproduce it on my 10.2.0.4.0. CTL file:
    load data
    INFILE *
    Replace into table samp
    fields terminated by ","
    trailing nullcols
    no,
    col1 Char(100000000) ,
    col2 Char(100000000) enclosed by '"' and '"'
    BEGINDATA
    1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
    2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"Loading:
    SQL> Create table samp
      2  (
      3  no number,
      4  col1 clob,
      5  col2 clob
      6  );
    Table created.
    SQL> host sqlldr scott/tiger control=c:\temp\samp.ctl log=c:\temp\samp.log
    SQL> select * from samp
      2  /
            NO
    COL1
    COL2
             1
    asdf
    assasadsdsdsd"sfasdfadf"sdsdsa,ssfsf
             2
    sfjass
    dksadk,kd,ss"dfdfjkdjfdk"sasfjaslaljs
            NO
    COL1
    COL2
    SQL> SY.

  • How to Load data for Inventory Organizations

    Hi All,
    I have flat file containing data for following fields,
    Organization Code, Name, From(Date), Location,Org Classification ,Primary Ledger, Legal Entity, Operating Unit ,Item Master Org,     Material Account,     Outside Processing,     Material Overhead,     Overhead,     Resource,     Expense     Transfer Credit     Inter Org Receivables,     Inter Org Payables,     Intransit Inventory,     Invoice Price Variance,     Inventory AP Accural,     Expense AP Accural(Operating Unit Level),     Encumbrance,     Sales,     Cost Of goods Sold,     Deferred COGS     Cost Variance,     Receiving Inventory Account,     Receiving Clearing Account.
    Now i want to Load this data using API/Interface, any one has any idea which API's are present or any way of doing this.
    Thanks and Regards,
    Prashant

    I have tried winparrot for such loading and now i have a lot of macro to load data from Excel to forms or to any browser.
    I do not have a macro for your needs nevertheless it should be very easy to make it.
    You can watch on youtube its tutorials for Oracle EBS.
    Regards

  • How to load data for attribute of Master Data Object from PSA

    Hi Experts,
    I have a Master data Object, 0Equipment.
    I loaded data to PSA from R/3.
    I am able to see records for Zxxx field in PSA.
    I have added a new mapping object Zxxx in BW.
    But, when I loaded the data from PSA to Master Data Object, 0Equipment,
    I am not able to see records for Zxxx which is an attribute of 0Equipment.
    I do see the records for rest of the attributes of this Master Data Object.
    I tried deleting and reloading the data
    and treid to check attribute change run
    Please let me know if I am missing something in loading the Master Data from PSA

    Jr Roberto,
    I checked all the records in Maintain Master Data and did set the Zxxx Not Equal To Blank.
    No data for Zxxx InfoObject, eventhough there is data in the corresponding field in PSA.
    I did 1:1 mapping.
    Need help

  • How to avoid seeing data for a particular member in the row level

    Hello,<BR>I am using Essbase. In that i am having members like taks n/a, demand n/a. Purpose of these members are, if i load data for demand, task wont have data so i am mapping to task n/a.And same for the task loading.I am using alphablox for reporting and report script for retriving the data.So, if i select the task n/a and demand n/a then some value will be existing for this. Is there any possibility to remove this from report.I mean while seeing in the report, it should not get this member and respective value for display and also avoid taking this data for any manipulation.I know RESTRICT for column level data. Is there anything for row level restrictions.<BR>Please help me on this.<BR>Regards<BR>R.Prasanna

    Hi,
    Into the rule containing the Color metadata, you can restrict the values of the list.
    In "Has restricted list and pane", list the values 1, 2 and 3 (new line for each value) :
    1
    2
    3
    Romain.

  • How to  load data into user tables using DIAPIs?

    Hi,
    I have created an user table using UserTablesMD object.
    But I don't have know how to load data into this user table. I guess I have to use UserTable object for that. But I still don't know how to put some data in particular column.
    Can somebody please help me with this?
    I would appreciate if somebody can share their code in this regard.
    Thank you,
    Sudha

    You can try this code:
    Dim lRetCode As Long
    Dim userTable As SAPbobsCOM.UserTable
    userTable = pCompany.UserTables.Item("My_Table")
    'First row in the @My_Table table
    userTable.Code = "A1"
    userTable.Name = "A.1"
    userTable.UserFields.Fields.Item("U_1stF").Value = "First row value"
    userTable.Add()
    'Second row in the @My_Table table
    userTable.Code = "A2"
    userTable.Name = "A.2"
    userTable.UserFields.Fields.Item("U_1stF").Value = "Second row value"
    userTable.Add()
    This way I have added 2 lines in my table.
    Hope it helps
    Trinidad.

  • How to load data thru flat file in demantra?

    Hi,
    I am using seeded data model for loading data for DM module in demantra.
    As per data model there is 3 staging tables for item, location and sales_data i.e. t_src_item_tmpl,t_src_loc_tmpl,t_src_sales_tmpl respectively.
    I have seen the final table for sales data i.e. sales_data table. ther is only one item_id and location_id column against which sales_date and quantity is loaded.
    I have same sales_data and quantity to be loaded for different location hierarchy and item hierarchy .
    How the data file is created ? if you have any sample data files , can you please share with me ? If any changes needs to be done in data model for loading datardsa in custom hierarchies ?
    Regards

    Welcome user10979220 to the wonderful forum.
    "How many rows will be there in item flat file ?
    How many rows will be there in location flat file ?
    How many rows will be there in sales data flat file ?"
    Answer to these questions are based on the number of sales that has occured as well as the item hierarchy and the product hierarchy.
    From the example
    Item_name | organization | ship to site | Sales date | quantity
    item 1 org1 site1 19-Jan-2008 80
    item1 org1 site2 20-Jan-2008 100
    I can say that the number of rows in sales data is 2 while that in item file is 1 and location file is 2.
    The answer to how the flat file will look is
    Item file can have
    Item_Id|Item_Name
    01     Item1
    Location file can have
    Org_Id|Org_Name|Site_Id|Site_name
    O_01     Organization 1     S_01     Site 1
    O_01     Organization 1     S_02     Site 2
    Sales file can have
    Item_Id|Item_Name|Org_Id|Org_Name|Site_Id|Site_name|sales_date|Quantity
    01     Item1     O_01     Organization 1     S_01     Site 1     19-Jan-2008 80
    01     Item1     O_01     Organization 1     S_02     Site 2     20-Jan-2008 100
    Once you define the data model and load the data it is advisable not to change the data model since the next time when you load the incremental data it will error out due to the mismatching columns. So its better that you define the data model first and then create the files accordingly.
    Hence after loading data if you want to view sales data at the product_category1 level then you should already have the product_category1 level defined in the data model.Else You have to create the product_category1 level and associate it in the item hierarchy.Also the sales file should have columns for product_category1.
    Then the item file will look like
    Item_Id|Item_Name|Product_category1_Id|Product_category1_desc
    01     Item1     PC_01     Product_category 1
    and the sales file will look like
    Item_Id|Item_Name|Org_Id|Org_Name|Site_Id|Site_name|sales_date|Quantity
    01     Item1     O_01     Organization 1     S_01     Site 1     19-Jan-2008 80
    01     Item1     O_01     Organization 1     S_02     Site 2     20-Jan-2008 100
    This is just a basic overview about loading the data into the staging tables.In short the item table should have the item hierarchy in it, the location file should have the location hierarchy in it and the sales file must contain the details about the sales at the lowest item-location level.
    Hope I answered your query.
    Thanks and Regards,
    Shekhar

  • How to load data from MS Excel file

    Hello All,
    Please help me regarding:
    how to load data/ insert records from MS Excel spreadsheet into Oracle table without converting that MS Excel file into CSV.
    Thank You in advance.

    Vivek More wrote:
    how to load data/ insert records from MS Excel spreadsheet into Oracle table without converting that MS Excel file into CSV.Setup HS connectivity:
    1. Create ODBC SYSTEM DSN using Microsift Excel driver(xls) and select your excel file as workbook.
    2. Create file initXLS.ora in %ORACLE_HOME%\hs\admin directory contailing the following line:
    HS_FDS_CONNECT_INFO = XLS3. Modify listener.ora file in %ORACLE_HOME%\network\admin directory and add the following lines to SID_LIST under SID_LIST_LISTENER
        (SID_DESC =
          (SID_NAME = XLS)
          (ORACLE_HOME = your-oracle-home)
          (PROGRAM = hsodbc)
        )4. Modify tnsnames.ora file in %ORACLE_HOME%\network\admin directory and add the following lines:
    XLS =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        (CONNECT_DATA =
          (SID = XLS)
        (HS=OK)
      )5. Restart listener.
    6. Create database link (public or private depending on your needs):
    CREATE PUBLIC DATABASE LINK XLS USING 'XLS';7. Now you are all set. For example my file has:
    NAME
    SAM
    JOEDefault sheet name "Sheet1$" is treated as table name (Since excel is case sensitive you need to use quoted name). First row is treated as column name. And select:
    SQL> select * from "Sheet1$"@xls;
    NAME
    SAM
    JOE
    SQL> Now if you do not know excel sheet names you can issue (I renamed excel sheet Sheet1$ to Names$):
    SQL> select table_name from all_tables@xls;
    TABLE_NAME
    Names$
    Sheet2$
    Sheet3$
    SQL> select column_name from all_tab_columns@xls where table_name = 'Names$';
    COLUMN_NAME
    NAME
    SQL> SY.

  • I need how to load data from MS Excel(csv format) to NW Excel

    Hi,
    I am doing Migration project from SAP MS to NW Manually.
    I need how to load data from MS excel (csv format) to NW excel .
    For example 2008 budget data.
    Could you please help me in this.
    Thanks and Regards
    Krishna

    Hi,
    You need to create a transformation file and a conversion file if required. First upload the excel (csv) file into BPC using Manage Data and Upload File option.
    Create the transformation file (refer to the sap help  on how to define a transformation file). You need to specify the mapping correctly and include all your application dimensions and map them to appropriate columns of the flat file.
    Before running the import package, do validate the data in the flat file you uploaded into BPC with the transformation file you created.
    Thanks,
    Sreeni

  • How to fetch data for sales order costing

    Hi All,
    How to fetch data for VA03 --> Extras --> Costing having cost element details.
    Thanks
    Gaurav

    Hi Gaurao ,
    There is no such function module  to extract data  in one column   , you have to  Convert all the columns data    in one column
    for period   .
    regards
    Deepak.

  • How to load data to a cube from multiple infosources ?

    Hi friends,
    How to load data to a cube from multiple infosources ? could u please answer this question .
    thanks in advance......

    Hi ,
    say for example you need to load data to 1 cube from 3 info sources:
    1) You need to create 3 update rules for the Cube.
    2) Each time you create the update rules. Mention the name the name of the Info source. and create update rules correspondingly.
    Regards
    satish
    Message was edited by:
            satish murthy

  • How to load data from a ODS to CUBE Request ID - by - Request ID?

    <i>How to load data from a ODS to CUBE Request ID - by - Request ID?</i>
    The problem is that... some requests had been eliminated of the cube and the delta control between the ODS and CUBE was lost. The flag "<b>data mart status of request</b>" of all the requests of the ODS had been blank.
    Now it is necessary to load some requests from the ODS for the cube.
    Notes:
    - it is not possible to make a complete load selecting the data to be loaded;
    - the PSA is not being used;
    - considering the data volume it is impracticable to reload the cube completely.
    Thanks in advance,
    Wesley.

    Dear R B,
    Considering the following:
    -> the delta control was lost;
    -> the data already are active in the ODS;
    -> part of the data of the ODS already is in the cube.
    The indicated procedure it only guarantees the load of the data that are in the ODS and that are not in the cube.
    Tks,
    Wesley.

  • How to populate data for 2LIS_40_REVAL, 2LIS_43_POSCAS and 2LIS_44_POSREC

    Hi
    How to populate data for 2LIS_40_REVAL, 2LIS_43_POSCAS and 2LIS_44_POSREC datasources at RSA3?
    I'm very new to retail BI.
    I think there is no setup tables for Retail infosources.
    Any IDoc or BAPI activation is required or other procedure?
    We are in BI-700 SAPKW70015 support pack R/3 side
    and SAP_BW 700 Support pack SAPKW70016 &
    BI_CONT 703 Support pack SAPKIBIIP9 BI side
    Can anyone guide me how to load data?
    Points assured
    Thanks in advance
    Ramana P

    Dear Ramana,
    There is no setup table for POSCAS and POSREC.This has to be popuated with a BADI Implementation. 
    As of PlugIns 2002_1_470 and 2002_2_470, POS data is update into BW the 2LIS_44_POSREC and 2LIS_43_POSCAS extractors using a BADI. To be able to update data into BW, the relevant implementation for the BADI must be activated in each case. You can activate the implementation in transaction SE19. The implementations are as follows:
    POS_EX_REC_PI2003_1 for extractor 2LIS_44_POSREC
    POS_EX_CAS_PI2003_1 for extractor 2LIS_44_POSCAS
    Once the activation of BADI , create the back ground jobs for the 44 application and the data is pushed into Delta queue and it can be loaded into BI .
    Hope this helps you.
    Thanks,
    Krishna Charan

  • How to load data with carriage return through DRM action script ?

    Hello,
    We are using DRM to manage Essbase metadata. These metadata contain a field for member formula.
    Currently it's a string data type property in DRM so we can't use carriage return and our formula are really hard to read.
    But DRM support other data type property : memo or formatted memo where we can use carriage return.
    Then in the export file, we have change the record delimiter to an other character than CRLF
    Our issue : we are regularly using action script to load new metadata => How to load data properties with carriage return using action script ? There is no option to change the record delimiter.
    Thanks!

    Hello Sandeep
    here what I want to do through action script : loading a formula that use more on than one line:
    Here, I write my formula using 4 lines but action script cannot load since one line = 1 record.
    ChangeProp|Version_name|Hier_name|Node_name|Formula|@round(
    qty*price
    *m05*fy13

  • Step by Step details on how to load data from a flat file

    hi can anyone explain how to load data from a flat file. Pls giv me step by step details. thnx

    hi sonam.
    it is very easy to load data from flat file. whn compared with other extrations methods...
    here r the step to load transation data from a flat file.......
    step:1 create a Flat File.
    step:2 log on to sap bw (t.code : rsa1 or rsa13).
    and observe the flat file source system icon. i.e pc icon.
    step:3 create required info objects.
    3.1: create infoarea
         (infoObjects Under Modeling > infoObjects (root node)-> context menu -
    > create infoarea).
    3.2:  create char /keyfig infoObject Catalog.(select infoArea ---.context menu --->create infoObject catalog).
    3.3:   create char.. infoObj and keyFig infoObjects accourding to ur requirement and activate them.
    step:4 create infoSource for transaction data and create transfer structure and maintain communication structure...
        4.1: first create a application component.(select InfoSources Under modeling-->infosources<root node>>context menu-->create  applic...component)
       4.2: create infoSource  for transation data(select appl..comp--.context menu-->create infosource)
    >select O flexible update and give info source name..
    >continue..
    4.4: *IMp* ASSIGN DATASOURCE..
      (EXPAND APPLIC ..COMP..>EXPAND YOUR INFOSOURCE>CONTEXT MENU>ASSIGN DATASOURCE.)
    >* DATASOURCE *
    >O SOURCE SYSTEM: <BROWSE AND CHOOSE YOUR FLAT FILE SOURCE SYSTEM>.(EX:PC ICON).
    >CONTINUE.
    4.5: DEFINE DATASOURCE/TRANSFER STRUCTURE  FOR IN FOSOURCE..
    > SELECT TRANSFER STRUCTURE TAB.
    >FILL THE INFOOBJECT FILLED WITH THE NECESSARY  INFOOBJ IN THE ORDER OR SEQUENCE OF FLAT FILE STRUCTURE.
    4.6: ASSIGN TRANSFER RULES.
    ---> NOW SELECT TRANSFER RULES TAB. AND SELECT PROPOSE TRANSFER RULES SPINDLE LIKE ICON.
    (IF DATA TARGET IS ODS -
    INCLUDE 0RECORDMODE IN COMMUNICATION STRUCTURE.)
    --->ACTIVATE...
    STEP:5  CREATE DATATARGET.(INFOCUBE/ODS OBJECT).
    5.1: CREATE INFO CUBE.
    -->SELECT YOUR INFOAREA>CONTEXT MENU>CREATE INFOCUBE.
    5.2: CREATE INFOCUBE STRUCTURE.
    ---> FILL THE STRUCTURE PANE WILL REQUIRE INFOOBJECTS...(SELECT INFOSOURCE ICON>FIND UR INFOSOURCE >DOUBLE CLICK > SELECT "YES" FOR INFOOBJECT ASSIGNMENT ).
    >MAINTAIN ATLEAST  ON TIME CHAR.......(EX; 0CALDAY).
    5.3:DEFINE AND ASSIGN DIMENSIONS FOR YOUR CHARACTERISTICS..
    >ACTIVATE..
    STEP:6 CREATE UPDATE RULES FOR INFOCUDE USING INFOSOURCE .
    >SELECT UR INFOCUBE >CONTEXT MENU> CREATE UPDATE RULES.
    > DATASOURCE
    > O INFOSOURCE : _________(U R INFOSOURCE). AND PRESS ENTER KEY.......
    >ACTIVATE.....UR UPDATE RULES....
    >>>>SEE THE DATA FLOW <<<<<<<<----
    STEP:7  SCHEDULE / LOAD DATA..
    7.1 CREATE INFOPACKAGE.
    --->SELECT INFOSOURCE UNDER MODELING> EXPAND UR APPLIC.. COMP..> EXPAND UR INFOSOURCE..> SELECT UR DATASOURCE ASSIGN MENT ICON....>CONTEXT MENU> CREAE INFOPACKAGE..
    >GIVE INFOPACKAGE DISCREPTION............_________
    >SELECT YOUR DATA SOURCE.-------> AND PRESS CONTINUE .....
    >SELECT EXTERNAL DATA TAB...
    > SELECT *CLIENT WORKSTATION oR APPLI SERVER  >GIVE FILE NAME > FILE TYPE> DATA SAPARATER>
    >SELECT PROCESSING TAB
    > PSA AND THEN INTO DATATARGETS....
    >DATATARGET TAB.
    >O SELECT DATA TARGETS
    [ ] UPDATE DATATARGET CHECK BOX.....
    --->UPDATE TAB.
    O FULL UPDATE...
    >SCHEDULE TAB..
    >SELECT O START DATA LOAD IMMEDIATELY...
    AND SELECT  "START" BUTTON........
    >>>>>>>>>>
    STEP:8 MONITOR DATA
    > CHECK DATA IN PSA
    CHECK DATA IN DATA TARGETS.....
    >>>>>>>>>>> <<<<<<<<<----
    I HOPE THIS LL HELP YOU.....

Maybe you are looking for

  • List of purchase orders is empty on Goods Receipt PO

    Hi, a user can't see the purchase order lists (empty result) when he clicks the "copy from" button on Good Receipt PO, although he just added several new purchase orders (hence they are still open). The weird thing is, another user with the same auth

  • Help with Running Averages and Graphs on Ipad3

    I am new to Mac, slowly learning but quickly falling in love with it. I need to keep track of our basketball teams free throw percentages for 5 team and for each kid. The coaches are asking for, made shots, missed shots, total attempts and their perc

  • Could not complete the itunes store request. The store may be busy

    I'm unable to sign into the iTunes store, keep getting this message: "Could not complete the itunes store request. The store may be busy. Check your internet connection or try again later." it worked fine before I had to replace the hard drive. I'm o

  • Changing names on Verizon bill?

    Does anyone how to change name on your account?

  • Xdg-open Fix

    This is for any frustrated by Google Chrome using random applications to open its downloads. Google Chrome uses xdg-open to open its downloads. Since I don't use Gnome or KDE, the DE environment variable is unset. If the DE environment variable is un