Passing value to bind variable of another table from one table

hi,
I have a multi select table. When one row is selected from this table (no button is clicked, only selection is done), an attribute from that selected row (say userid) should be passed to the bind variable of another table and the corresponding details of that particular userid should be displayed in the other table. When more than one row is selected, the other table should display no rows.
My main problem is what code has to be written to pass value to bind variable and where it should be written.
Please give me a detailed explaination as soon as possible.
Thank you.

Sorry, didnot add this. The table is multi select table.

Similar Messages

  • To make three tables from one table

    Hi,
    I have created a random table from a big table and now i want to make three tables of same numbers, means each table should contain 1000 records, as the table has random idx column, so i cant divide directly on basis of idx. in addition, i cant create three seperate tbles from main table, as i dont want any duplicate data in those three tables, whcih may occur if i will create each table individually.
    Best regards,

    Table 1.
    create table emp1 as
    select empno,ename,sal--,................
    from(select e.*,row_number() over(order by rowid) rn,count(*) over(order by null) cnt
         from emp e)
    where rn < cnt/3
    Table 2.
    create table emp1 as
    select empno,ename,sal--,................
    from(select e.*,row_number() over(order by rowid) rn,count(*) over(order by null) cnt
         from emp e)
    where rn between cnt/3 and cnt*2/3
    Table 3.
    create table emp1 as
    select empno,ename,sal--,................
    from(select e.*,row_number() over(order by rowid) rn,count(*) over(order by null) cnt
         from emp e)
    where rn > cnt*2/3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Move a table from one table space to another tablespace and different table

    Hi,
    I have a 60gb table nearly 200 million records in it and the table has range partition.
    inorder to archive this table we have created 3 different tables and 3 different tablespaces for the tables.
    I want to move certain partitions to tableA and certain partitions to tableB and on to tableC and on the top i'm creating a view to access these 3 tables.
    Is there any technique to move the partition wise data to different tables. is there any new technique in 11g database?
    The database is 11gr1
    linux rhel5 x-86-64
    Edited by: user8894072 on Oct 12, 2010 2:03 PM

    if i do that like each partition has some millions of records. and the undotablespace is filling out and also the temp table space is filling out. The performance is very very poor if i use the create statement.
    Insert INTO TableA (select * FROM <BASETABLE> where pay_end_dt between '01-Jan-1999' and '31-Dec-2005')
    the above statement is also degrading the performance. I just need the synatx to move the partioned wise data to new table.

  • SQL query to find differences (changes) between tables (from one table) where field names are different

    Hi All,
    I am looking to create a view which returns new or modified data (differences) based on a comparison between two tables.
    The EMP_SOURCE table stores all employee data including duplicate staff numbers (STAFFNO):
    CREATE TABLE [dbo].[EMP_SOURCE](
    [FULLNAME] [varchar](255) NULL,
    [JOBTITLE] [varchar](255) NULL,
    [LOCATION] [varchar](255) NULL,
    [COUNTRY] [varchar](255) NULL,
    [STAFFNO] [varchar](255) NULL
    ) ON [PRIMARY]
    GO
    The EMP table stores unique staff numbers. This is the table used by the application.
    CREATE TABLE [dbo].[EMP](
    [EMP_ID] [int] NOT NULL,
    [EMP_NAME] [varchar](255) NULL,
    [EMP_TITLE] [varchar](255) NULL,
    [EMP_OFFICE] [varchar](255) NULL,
    [EMP_COUNTRY] [varchar](255) NULL,
    [EMP_NUMBER] [varchar](255) NULL,
    CONSTRAINT [PK_EMP] PRIMARY KEY CLUSTERED
    [EMP_ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    We are looking to migrate data from EMP_SOURCE to EMP but only records which are new in EMP_SOURCE and do not exist in EMP or records which are different in EMP_SOURCE from EMP.
    EMP_SOURCE:
    FULLNAME
    JOBTITLE
    LOCATION
    COUNTRY
    STAFFNO
    John Smith
    Manager
    London
    UK
    1087
    Beth King
    Analyst
    New York
    USA
    2095
    Karl Bent
    Manager
    Chicago
    USA
    1106
    Beth King
    Junior
    Washington
    USA
    2095
    Harry Kline
    Consultant
    Manchester
    UK
    2341
    EMP:
    EMP_ID
    EMP_NAME
    EMP_TITLE
    EMP_OFFICE
    EMP_COUNTRY
    EMP_NUMBER
    1
    John Smith
    Manager
    London
    UK
    1087
    2
    Beth King
    Analyst
    New York
    USA
    2095
    3
    Karl Bent
    Manager
    Washington
    USA
    1106
    Based on the above comparison, EMP_SOURCE table has the following differences:
    FULLNAME
    JOBTITLE
    LOCATION
    COUNTRY
    STAFFNO
    Harry Kline
    Consultant
    Manchester
    UK
    2341
    Karl Bent
    Manager
    Chicago
    USA
    1106
    Differences in red. Beth King should be completely ignored because of duplicate staff numbers (EMP_NUMBER).
    Any help to create a view which returns only the differences from EMP_SOURCE would be appreciated.
    INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
    VALUES (1, 'John Smith', 'Manager', 'London', 'UK', '1087');
    INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
    VALUES (2, 'Beth King', 'Analyst', 'New York', 'USA', '2095');
    INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
    VALUES (3, 'Karl Bent', 'Manager', 'Washington', 'USA', '1106');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
    VALUES ('John Smith', 'Manager', 'London', 'UK', '1087');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
    VALUES ('Beth King', 'Analyst', 'New York', 'USA', '2095');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
    VALUES ('Karl Bent', 'Manager', 'Chicago', 'USA', '1106');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
    VALUES ('Beth King', 'Junior', 'Washington', 'USA', '2095');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO) VALUES ('Harry Kline', 'Consultant', 'Manchester', 'UK', '2341');

    HI Manc !
    You may use the below code to get your desired output;
    CREATE TABLE [dbo].[EMP_SOURCE](
    [FULLNAME] [varchar](255) NULL,
    [JOBTITLE] [varchar](255) NULL,
    [LOCATION] [varchar](255) NULL,
    [COUNTRY] [varchar](255) NULL,
    [STAFFNO] [varchar](255) NULL
    GO
    CREATE TABLE [dbo].[EMP](
    [EMP_ID] [int] NOT NULL,
    [EMP_NAME] [varchar](255) NULL,
    [EMP_TITLE] [varchar](255) NULL,
    [EMP_OFFICE] [varchar](255) NULL,
    [EMP_COUNTRY] [varchar](255) NULL,
    [EMP_NUMBER] [varchar](255) NULL
    INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
    VALUES (1, 'John Smith', 'Manager', 'London', 'UK', '1087');
    INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
    VALUES (2, 'Beth King', 'Analyst', 'New York', 'USA', '2095');
    INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
    VALUES (3, 'Karl Bent', 'Manager', 'Washington', 'USA', '1106');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
    VALUES ('John Smith', 'Manager', 'London', 'UK', '1087');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
    VALUES ('Beth King', 'Analyst', 'New York', 'USA', '2095');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
    VALUES ('Karl Bent', 'Manager', 'Chicago', 'USA', '1106');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
    VALUES ('Beth King', 'Junior', 'Washington', 'USA', '2095');
    INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO) VALUES ('Harry Kline', 'Consultant', 'Manchester', 'UK', '2341');
    SELECT FULLNAME,JOBTITLE,LOCATION,COUNTRY,STAFFNO FROM EMP_SOURCE
    EXCEPT
    SELECT EMP_NAME,EMP_TITLE,EMP_OFFICE,EMP_COUNTRY,EMP_NUMBER FROM Emp
    Please let me know if this doesn’t work for you. Hope I have answered you correctly.
    Thanks,
    Hasham

  • Pass values to bind variales and execute VO query

    Hi All,
    I have a requirement to add validation to an appraisal page via OAF.
    As a part of testing I need to check, if the values in the query of VO is displayed in the page.
    VO - QuestAnsValuesVO
    EO - QuestAnswerValueEO, QuestFieldEO
    The VO query is
    SELECT * FROM (SELECT QuestAnswerValueEO.QUEST_ANSWER_VAL_ID, QuestAnswerValueEO.QUESTIONNAIRE_ANSWER_ID, QuestAnswerValueEO.FIELD_ID, QuestAnswerValueEO.OBJECT_VERSION_NUMBER, QuestAnswerValueEO.VALUE, QuestFieldEO.FIELD_ID AS QUEST_FIELD_ID, QuestFieldEO.NAME, QuestFieldEO.TYPE, QuestFieldEO.HTML_TEXT, rank() over (partition by QuestFieldEO.NAME order by QuestFieldEO.FIELD_ID) AS RANK, QuestAnswerValueEO.QUESTIONNAIRE_ANSWER_ID AS QUESTIONNAIRE_ANSWER_ID1 FROM HR_QUEST_ANSWER_VALUES QuestAnswerValueEO, HR_QUEST_FIELDS QuestFieldEO WHERE QuestFieldEO.QUESTIONNAIRE_TEMPLATE_ID(+) = :1 and QuestAnswerValueEO.QUESTIONNAIRE_ANSWER_ID(+) = :2 AND QuestFieldEO.FIELD_ID = QuestAnswerValueEO.FIELD_ID (+)) QRSLT ORDER BY QUEST_FIELD_ID
    I am trying to execute this query in the extended controller class so that i can get the values printed on the page. I am getting SQL exception saying - not all variables are bound.
    How do i pass values to bind variables :1 and :2 and execute this query?
    Please help.
    Thanks
    Geetha

    Geetha,
    Instead of :1 and :2 use a named bind variable as part of your VO and then set either a default value or set its value during runtime. See this example on how to create bind variable:
    http://formattc.wordpress.com/2010/04/02/custom-java-bind-variable-in-a-where-clause-of-an-adf-view-object/
    Once created, you can set its value during runtime either in ApplicationModuleImpl or in ViewObjectImpl class
    e.g.,
             ViewObjectImpl view = this.getEmpView();
            VariableValueManager vm = view.ensureVariableManager();
            vm.setVariableValue("empNo", value);
            view.executeQuery();regards,
    ~Krithika

  • How to pass pageFlowScope variable value as bind variable for VO

    Hi,
    I have one fixed lov (not based on datasource), if i select any value in that lov i want to pass this value to a pageFlowScope variable.
    After this i want to use this value as bind variable for VO. whenever the vo executes thereafter this bind variable should filter that vo results.
    My jdev version: 11.1.0.0
    Thanks in advance,
    SAN

    san-717,
    can you elaborate on the use case instead of the implementation you don't get done? I understand you have data displayed in a tree: so lets assume the tree structure is Locations, Departments and Employees according to the Oracle HR sample schema.
    1. What is the LOV supposed to do ?
    2. Where is the LOV located ?
    3. What values does the LOV show ?
    4. Is the LOV a select choice component or a real LOV (with search dialog)
    5. Where is the bind variable used ?
    To me it sounds like you want to filter the tree data based on the select choice value. However, you wont do this by passing the bind parameter to all View Objects involved as they may not have the attribute in their query. So your use case is important to answer the question
    Frank

  • Dynamically assign value to bind variable in a view object before pageload

    I found that it is extreamely hard to find an example to assign the bind variable in View object at runtime using a data attribute defined in Human task activity. Most of the available samples use a Literal value to do the assignment. In my case, I want to dynamically display the content by assigning the data attribute in Human task to the bind variable in view object before a pageload.
    I do not want to bind the view object to some command component to click a button or link in order to make it work (Unnecessary components in my page).
    The issue is how to access the data attribute in Human task in the java code of client interface in AppModule? or is there a way that I can access the data attribute in Groovy script expression of the bind variable? or if I can access the process data object defined in my BPM process to do the assignment at runtime?
    Really need help on the issue, and I cannot believe that it is so hard to accomplish.
    Thank you very much,

    chk this
    Passing default value to bind variable on page load.
    http://adfcodebits.blogspot.com/2010/03/bit-2-setting-bind-variable-value.html

  • Passing values to global variables while running job via management console

    Hi All,
    I have a requirement, where I have to use HANA view with input parameters as source. I am doing the same by placing the HANA query for view with input parameters, in SQL transform and assigning values to placeholders using global variables. This is working fine at the designer level.
    But where I am stuck is, it possible to pass values to global variables while running job in Management console or in a third party scheduler. Should I do any changes in the batch job to achieve the same ?
    Please help me with the same and also let me know whether my approach of using Global variables to assign values to input parameter of HANA view is right?
    Thanks,
    Deepa

    Select Batch > Batch Job Configuration > Add Schedule and Expand the Global Variables section in the Schedule Batch Job tab. You can then specify a value for all your global variables.
    Alternatively, work with control tables and assign values to the global variables in an initialisation script.

  • Passing Tables from one method to another method.

    Hi All,
    I'm creating a Web-Dynpro program in which I wouild like to passing an internal table from one method to another method within the same View. 
    Is this possible?  And if so, how can I set it up.
    Thank you.
    Paul

    Hi Paul ,
    I hope u wud be clear with passing table from one method to another now .U may also wish to see this WIKI
    Link: [Passing table parameters|https://wiki.sdn.sap.com/wiki/display/WDABAP/Passingtableparameterfromoneviewtoanotherview+locally]
    I hope it wud help u .
    regards,
    amit

  • Transferring data from one table to another table using a Keycolumn using SSIS row by row dynamically

    Hi All,
    I have a Store Procedure(SP) which has a output variable name "AcivityID" which is the key column. In this SP, transformation  of data is done from one table to insert data into other table. I have to execute the SP and insert row by row data
    using the output variable "ActivityID"  whose value will keep on changing. How can I do it?
    Thanks,
    Kallu

    Value changing on a row by row basis? Not quite sure what you mean, but it seems that you want to use the results of an insert into one table as input for another. If so then SSIS is not needed, inside the stored proc use the SQL that will do that and for
    all records as
    INSERT A INTO dbo.table1
    OUTPUT INSERTED.A INTO MyTable;
    Arthur My Blog

  • Move data from one table to another table

    Hi all,
    I  had a custom table called sales_data in that table there are  columns like JAn,FEB,upto DEC including other columns so in each month there is some data total data is  23000 count but each month has has specific data like JAn-2500,FEB-2000 like that it has total 23000 records
    My Requirement  is i have to move data from one table to another table that too if i will pass jan only jan data should move like that feb,march,.....
    in my table there is no month column i had get it from another table called gl_periods and by using cursor and case function i have written the code
    well while when i am inserting data am passing year,month as parameters but 23000 data is moving it should get like that.
    Please suggest me.its urgent
    Thank You

    Hi hamid,
                   Please go through the below procedure.
    CREATE OR REPLACE PROCEDURE APPS.copy_sales_to_forecast(p_fiscal_year varchar2,p_month number)
    IS
    CURSOR C1 IS select period_year,period_num,start_date,end_date from apps.gl_periods
                 where period_set_name='Accounting'
                 and   period_year=p_fiscal_year
                 and   period_num<=p_month;
    type type1 is table of xxc_forecast_data%rowtype;
    t1 type1;
    BEGIN
    FOR CREC IN C1 LOOP
    BEGIN
    DELETE FROM xxc_forecast2
    where fiscal_year = crec.period_year
      and attribute1='Copied From Sales to Forecast Table of Month '||crec.period_num;
    END;
    SELECT
      product_category           ,
      product_sub_category       ,
      product_line               ,
      product_style              ,
      item_number                ,
      item_description           ,
      customer_name              ,
      customer_number            ,
      sales_channel              ,
      null      ,
      CASE
        WHEN crec.period_num=1 THEN sales_amount_month1
        ELSE 0
      END Transaction_quantity_period1,
      CASE
        WHEN crec.period_num=1 THEN sales_cost_month1
        ELSE 0
      END item_cogs_period1,
      CASE
        WHEN crec.period_num=1 THEN sales_mtl_cost_month1
        ELSE 0
      END item_material_cogs_period1 ,
      CASE
        WHEN crec.period_num=1 THEN sales_mtl_ovhd_cost_month1
        ELSE 0
      END item_mtl_ovhd_cogs_period1,
      CASE
        WHEN crec.period_num=1 THEN sales_res_cost_month1
        ELSE 0
      END item_resource_cogs_period1,
      CASE
        WHEN crec.period_num=1 THEN sales_op_cost_month1
        ELSE 0
      END item_op_cogs_period1,
      CASE
        WHEN crec.period_num=1 THEN sales_ovhd_month1
        ELSE 0
      END item_ovhd_cogs_period1,
      CASE
        WHEN crec.period_num=1 THEN sales_units_month1
        ELSE 0
      END extended_amount_us_period1,
      CASE
        WHEN crec.period_num=2 THEN sales_amount_month2
        ELSE 0
      END Transaction_quantity_period2,
      CASE
        WHEN crec.period_num=2 THEN sales_mtl_cost_month2
        ELSE 0
      END item_material_cogs_period2,
      CASE
        WHEN crec.period_num=2 THEN sales_mtl_ovhd_cost_month2
        ELSE 0
      END item_mtl_ovhd_cogs_period2,
      CASE
        WHEN crec.period_num=2 THEN sales_res_cost_month2
        ELSE 0
      END item_resource_cogs_period2,
      CASE
        WHEN crec.period_num=2 THEN sales_op_cost_month2
        ELSE 0
      END item_op_cogs_period2,
      CASE
        WHEN crec.period_num=2 THEN sales_ovhd_month2
        ELSE 0
      END item_ovhd_cogs_period2,
       CASE
        WHEN crec.period_num=2 THEN sales_units_month2
        ELSE 0
      END extended_amount_us_period2,
      CASE
        WHEN crec.period_num=3 THEN sales_amount_month3
        ELSE 0
      END Transaction_quantity_period3,
      CASE
        WHEN crec.period_num=3 THEN sales_mtl_cost_month3
        ELSE 0
      END item_material_cogs_period3,
      CASE
        WHEN crec.period_num=3 THEN sales_mtl_ovhd_cost_month3
        ELSE 0
      END item_mtl_ovhd_cogs_period3,
      CASE
        WHEN crec.period_num=3 THEN sales_res_cost_month3
        ELSE 0
      END item_resource_cogs_period3,
      CASE
        WHEN crec.period_num=3 THEN sales_op_cost_month3
        ELSE 0
      END item_op_cogs_period3,
      CASE
        WHEN crec.period_num=3 THEN sales_ovhd_month3
        ELSE 0
      END item_ovhd_cogs_period3,
      CASE
        WHEN crec.period_num=3 THEN sales_units_month3
        ELSE 0
      END extended_amount_us_period3,
      CASE
        WHEN crec.period_num=4 THEN sales_amount_month4
        ELSE 0
      END Transaction_quantity_period4,
      CASE
        WHEN crec.period_num=4 THEN sales_mtl_cost_month4
        ELSE 0
      END item_material_cogs_period4,
      CASE
        WHEN crec.period_num=4 THEN sales_mtl_ovhd_cost_month4
        ELSE 0
      END item_mtl_ovhd_cogs_period4,
      CASE
        WHEN crec.period_num=4 THEN sales_res_cost_month4
        ELSE 0
      END item_resource_cogs_period4,
      CASE
        WHEN crec.period_num=4 THEN sales_op_cost_month4
        ELSE 0
      END item_op_cogs_period4,
      CASE
        WHEN crec.period_num=4 THEN sales_ovhd_month4
        ELSE 0
      END item_ovhd_cogs_period4,
      CASE
        WHEN crec.period_num=4 THEN sales_units_month4
        ELSE 0
      END extended_amount_us_period4,
      CASE
        WHEN crec.period_num=5 THEN sales_amount_month5
        ELSE 0
      END Transaction_quantity_period5,
      CASE
        WHEN crec.period_num=5 THEN sales_mtl_cost_month5
        ELSE 0
      END item_material_cogs_period5,
      CASE
        WHEN crec.period_num=5 THEN sales_mtl_ovhd_cost_month5
        ELSE 0
      END item_mtl_ovhd_cogs_period5,
      CASE
        WHEN crec.period_num=5 THEN sales_res_cost_month5
        ELSE 0
      END item_resource_cogs_period5,
      CASE
        WHEN crec.period_num=5 THEN sales_op_cost_month5
        ELSE 0
      END item_op_cogs_period5,
      CASE
        WHEN crec.period_num=5 THEN sales_ovhd_month5
        ELSE 0
      END item_ovhd_cogs_period5,
      CASE
        WHEN crec.period_num=5 THEN sales_units_month5
        ELSE 0
      END extended_amount_us_period5,
      CASE
        WHEN crec.period_num=6 THEN sales_amount_month6
        ELSE 0
      END Transaction_quantity_period6,
      CASE
        WHEN crec.period_num=6 THEN sales_mtl_cost_month6
        ELSE 0
      END item_material_cogs_period6,
      CASE
        WHEN crec.period_num=6 THEN sales_mtl_ovhd_cost_month6
        ELSE 0
      END item_mtl_ovhd_cogs_period6,
      CASE
        WHEN crec.period_num=6 THEN sales_res_cost_month6
        ELSE 0
      END item_resource_cogs_period6,
      CASE
        WHEN crec.period_num=6 THEN sales_op_cost_month6
        ELSE 0
      END item_op_cogs_period6,
      CASE
        WHEN crec.period_num=6 THEN sales_ovhd_month6
        ELSE 0
      END item_ovhd_cogs_period6,
       CASE
        WHEN crec.period_num=6 THEN sales_units_month6
        ELSE 0
      END extended_amount_us_period6,
      CASE
        WHEN crec.period_num=7 THEN sales_amount_month7
        ELSE 0
      END Transaction_quantity_period7,
      CASE
        WHEN crec.period_num=7 THEN sales_mtl_cost_month7
        ELSE 0
      END item_material_cogs_period7,
      CASE
        WHEN crec.period_num=7 THEN sales_mtl_ovhd_cost_month7
        ELSE 0
      END item_mtl_ovhd_cogs_period7,
      CASE
        WHEN crec.period_num=7 THEN sales_res_cost_month7
        ELSE 0
      END item_resource_cogs_period7,
      CASE
        WHEN crec.period_num=7 THEN sales_op_cost_month7
        ELSE 0
      END item_op_cogs_period7,
      CASE
        WHEN crec.period_num=7 THEN sales_ovhd_month7
        ELSE 0
      END item_ovhd_cogs_period7,
      CASE
        WHEN crec.period_num=7 THEN sales_units_month7
        ELSE 0
      END extended_amount_us_period7,
      CASE
        WHEN crec.period_num=8 THEN sales_amount_month8
        ELSE 0
      END Transaction_quantity_period8,
      CASE
        WHEN crec.period_num=8 THEN sales_mtl_cost_month8
        ELSE 0
      END item_material_cogs_period8,
      CASE
        WHEN crec.period_num=8 THEN sales_mtl_ovhd_cost_month8
        ELSE 0
      END item_mtl_ovhd_cogs_period8,
      CASE
        WHEN crec.period_num=8 THEN sales_res_cost_month8
        ELSE 0
      END item_resource_cogs_period7,
      CASE
        WHEN crec.period_num=8 THEN sales_op_cost_month8
        ELSE 0
      END item_op_cogs_period8,
      CASE
        WHEN crec.period_num=8 THEN sales_ovhd_month8
        ELSE 0
      END item_ovhd_cogs_period8,
      CASE
        WHEN crec.period_num=8 THEN sales_units_month8
        ELSE 0
      END extended_amount_us_period8,
      CASE
        WHEN crec.period_num=9 THEN sales_amount_month9
        ELSE 0
      END Transaction_quantity_period9,
      CASE
        WHEN crec.period_num=9 THEN sales_mtl_cost_month9
        ELSE 0
      END item_material_cogs_period9,
      CASE
        WHEN crec.period_num=9 THEN sales_mtl_ovhd_cost_month9
        ELSE 0
      END item_mtl_ovhd_cogs_period9,
      CASE
        WHEN crec.period_num=9 THEN sales_res_cost_month9
        ELSE 0
      END item_resource_cogs_period7,
      CASE
        WHEN crec.period_num=9 THEN sales_op_cost_month9
        ELSE 0
      END item_op_cogs_period9,
      CASE
        WHEN crec.period_num=9 THEN sales_ovhd_month9
        ELSE 0
      END item_ovhd_cogs_period9,
       CASE
        WHEN crec.period_num=9 THEN sales_units_month9
        ELSE 0
      END extended_amount_us_period9,
      CASE
        WHEN crec.period_num=10 THEN sales_amount_month10
        ELSE 0
      END Transaction_quantity_period10,
      CASE
        WHEN crec.period_num=10 THEN sales_mtl_cost_month10
        ELSE 0
      END item_material_cogs_period10,
      CASE
        WHEN crec.period_num=10 THEN sales_mtl_ovhd_cost_month10
        ELSE 0
      END item_mtl_ovhd_cogs_period10,
      CASE
        WHEN crec.period_num=10 THEN sales_res_cost_month10
        ELSE 0
      END item_resource_cogs_period10,
      CASE
        WHEN crec.period_num=10 THEN sales_op_cost_month10
        ELSE 0
      END item_op_cogs_period10,
      CASE
        WHEN crec.period_num=10 THEN sales_ovhd_month10
        ELSE 0
      END item_ovhd_cogs_period10,
      CASE
        WHEN crec.period_num=10 THEN sales_units_month10
        ELSE 0
      END extended_amount_us_period10,
      CASE
        WHEN crec.period_num=11 THEN sales_amount_month11
        ELSE 0
      END Transaction_quantity_period11,
      CASE
        WHEN crec.period_num=11 THEN sales_mtl_cost_month11
        ELSE 0
      END item_material_cogs_period11,
      CASE
        WHEN crec.period_num=11 THEN sales_mtl_ovhd_cost_month11
        ELSE 0
      END item_mtl_ovhd_cogs_period11,
      CASE
        WHEN crec.period_num=11 THEN sales_res_cost_month11
        ELSE 0
      END item_resource_cogs_period11,
      CASE
        WHEN crec.period_num=11 THEN sales_op_cost_month11
        ELSE 0
      END item_op_cogs_period11,
      CASE
        WHEN crec.period_num=11 THEN sales_ovhd_month11
        ELSE 0
      END item_ovhd_cogs_period11,
      CASE
        WHEN crec.period_num=11 THEN sales_units_month11
        ELSE 0
      END extended_amount_us_period11,
      CASE
        WHEN crec.period_num=12 THEN sales_amount_month12
        ELSE 0
      END Transaction_quantity_period12,
      CASE
        WHEN crec.period_num=12 THEN sales_mtl_cost_month12
        ELSE 0
      END item_material_cogs_period12,
      CASE
        WHEN crec.period_num=12 THEN sales_mtl_ovhd_cost_month12
        ELSE 0
      END item_mtl_ovhd_cogs_period12,
      CASE
        WHEN crec.period_num=12 THEN sales_res_cost_month12
        ELSE 0
      END item_resource_cogs_period12,
      CASE
        WHEN crec.period_num=12 THEN sales_op_cost_month12
        ELSE 0
      END item_op_cogs_period12,
      CASE
        WHEN crec.period_num=12 THEN sales_ovhd_month12
        ELSE 0
      END item_ovhd_cogs_period12,
        CASE
        WHEN crec.period_num=12 THEN sales_units_month12
        ELSE 0
      END extended_amount_us_period12,
      CASE
        WHEN crec.period_num=2 THEN sales_cost_month2
        ELSE 0
      END item_cogs_period2,
       CASE
        WHEN crec.period_num=3 THEN sales_cost_month3
        ELSE 0
      END item_cogs_period3,
       CASE
        WHEN crec.period_num=4 THEN sales_cost_month4
        ELSE 0
      END item_cogs_period4,
       CASE
        WHEN crec.period_num=5 THEN sales_cost_month5
        ELSE 0
      END item_cogs_period5,
      CASE
        WHEN crec.period_num=6 THEN sales_cost_month6
        ELSE 0
      END item_cogs_period6,
      CASE
        WHEN crec.period_num=7 THEN sales_cost_month7
        ELSE 0
      END item_cogs_period7,
       CASE
        WHEN crec.period_num=8 THEN sales_cost_month8
        ELSE 0
      END item_cogs_period8,
      CASE
        WHEN crec.period_num=9 THEN sales_cost_month9
        ELSE 0
      END item_cogs_period9,
       CASE
        WHEN crec.period_num=10 THEN sales_cost_month10
        ELSE 0
      END item_cogs_period10,
       CASE
        WHEN crec.period_num=11 THEN sales_cost_month11
        ELSE 0
      END item_cogs_period11,
      CASE
        WHEN crec.period_num=12 THEN sales_cost_month12
        ELSE 0
      END item_cogs_period12,
      a.fiscal_year   ,
      a.budget_entity  ,
      a.organization_code,
      a.customer_id  ,
      a.inventory_item_id ,
      NULL,
      NULL,
      a.created_by ,
      a.last_updated_by ,
      a.creation_date ,
      a.last_update_date ,
      'Copied From Sales to Forecast Table of Month '||crec.period_num,
      a.attribute2,
      a.attribute3 ,
      a.attribute4 ,
      a.attribute5 ,
      a.attribute6 ,
      a.attribute7 ,
      a.attribute8 ,
      a.attribute9 ,
      a.attribute10,
      a.attribute11,
      a.attribute12,
      a.attribute13,
      a.attribute14,
      a.attribute15
      bulk collect into t1
      FROM  xxc_sales_data a 
      where  a.fiscal_year          = crec.period_year
    having CASE
                 WHEN crec.period_num=1  THEN sum(sales_amount_month1)
                 WHEN crec.period_num=2  THEN sum(sales_amount_month2)
                 WHEN crec.period_num=3  THEN sum(sales_amount_month3)
                 WHEN crec.period_num=4  THEN sum(sales_amount_month4)
                 WHEN crec.period_num=5  THEN sum(sales_amount_month5)
                 WHEN crec.period_num=6  THEN sum(sales_amount_month6)
                 WHEN crec.period_num=7  THEN sum(sales_amount_month7)
                 WHEN crec.period_num=8  THEN sum(sales_amount_month8)
                 WHEN crec.period_num=9  THEN sum(sales_amount_month9)
                 WHEN crec.period_num=10 THEN sum(sales_amount_month10)
                 WHEN crec.period_num=11 THEN sum(sales_amount_month11)
                 WHEN crec.period_num=12 THEN sum(sales_amount_month12)
                END !=0;
      FORALL i IN t1.first .. t1.last
      INSERT INTO xxc_forecast2 VALUES t1(i);
    --commit;
    END LOOP;
    END;
    Thank You

  • Insert old missing data from one table to another(databaase trigger)

    Hello,
    i want to do two things
    1)I want to insert old missing data from one table to another through a database trigger but it can't be executed that way i don't know what should i do in case of replacing old data in table_1 into table_2
    2)what should i use :NEW. OR :OLD. instead.
    3) what should i do if i have records exising between the two dates
    i want to surpress the existing records.
    the following code is what i have but no effect occured.
    CREATE OR REPLACE TRIGGER ATTENDANCEE_FOLLOWS
    AFTER INSERT ON ACCESSLOG
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    V_COUNT       NUMBER(2);
    V_TIME_OUT    DATE;
    V_DATE_IN     DATE;
    V_DATE_OUT    DATE;
    V_TIME_IN     DATE;
    V_ATT_FLAG    VARCHAR2(3);
    V_EMP_ID      NUMBER(11);
    CURSOR EMP_FOLLOWS IS
    SELECT   EMPLOYEEID , LOGDATE , LOGTIME , INOUT
    FROM     ACCESSLOG
    WHERE    LOGDATE
    BETWEEN  TO_DATE('18/12/2008','dd/mm/rrrr') 
    AND      TO_DATE('19/12/2008','dd/mm/rrrr');
    BEGIN
    FOR EMP IN EMP_FOLLOWS LOOP
    SELECT COUNT(*)
    INTO  V_COUNT
    FROM  EMP_ATTENDANCEE
    WHERE EMP_ID    =  EMP.EMPLOYEEID
    AND    DATE_IN   =  EMP.LOGDATE
    AND    ATT_FLAG = 'I';
    IF V_COUNT = 0  THEN
    INSERT INTO EMP_ATTENDANCEE (EMP_ID, DATE_IN ,DATE_OUT
                                ,TIME_IN ,TIME_OUT,ATT_FLAG)
         VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
                 TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
                 NULL,
                 TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),      -- TIME_IN
                 NULL ,'I');
    ELSIF   V_COUNT > 0 THEN
    UPDATE  EMP_ATTENDANCEE
        SET DATE_OUT       =  TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'), -- DATE_OUT,
            TIME_OUT       =   TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'), -- TIME_OUT
            ATT_FLAG       =   'O'
            WHERE EMP_ID   =   TO_NUMBER(TO_CHAR(:NEW.employeeid,99999))
            AND   DATE_IN <=  (SELECT MAX (DATE_IN )
                               FROM EMP_ATTENDANCEE
                               WHERE EMP_ID = TO_NUMBER(TO_CHAR(:NEW.employeeid,99999))
                               AND   DATE_OUT IS NULL
                               AND   TIME_OUT IS NULL )
    AND   DATE_OUT  IS NULL
    AND   TIME_OUT IS NULL  ;
    END IF;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN RAISE;
    END ATTENDANCEE_FOLLOWS ;
                            Regards,
    Abdetu..

    INSERT INTO SALES_MASTER
       ( NO
       , Name
       , PINCODE )
       SELECT SALESMANNO
            , SALESMANNAME
            , PINCODE
         FROM SALESMAN_MASTER;Regards,
    Christian Balz

  • Loading data from one table to another table

    I need to load the data (data conversion) from one table to 3 different table.
    I have to load the data from Source table to following 3 target tables.
    So Consumer table has email pk and it has relationship with CONSUMER_RCV table and CONSUMER_RCV
    table has relationship with CONSUMER_ATTR table. I am doing right now with pl/sql but I am looking
    to use MULTI INSERT or SQL*LOADER or another efficient way.
    I tried with MultiInsert but it getting failed as it's violating Unique Constraints as source table might contains
    Duplicate emails.
    Could you please show me how I can load the data efficiently?
    Also I need to load in CONSUMER_ATTR table from CONTACT table which has ATTR1, ATTR2 columns.
    so My mapping will be ...
    Contact.email, first_name, last_name will go into Consumer table
    then in CONSUMER_RCV, I generate the id column value by sequence, load email and DATE_CREATEd from contact table
    And rest of the value is hard coded
    Then in CONSUMER_ATTR table I will generate the CONSUMER_ATTR_id through sequence, for ID, will use the same
    id column value which I have generated by sequence in CONSUMER_RCV, then put the attr_type = 'ATTR1' and for
    attr_value column I will insert the value from contact table's ATTR1 value,
    Then generate another CONSUMER_ATTR_ID, will use the same id column value which I have generated by sequence
    in CONSUMER_RCV, then put the attr_type = 'ATTR2' and for
    attr_value column I will insert the value from contact table's ATTR2 value,
    Please let me know if you need further explanation.
    I am using Oracle 9i R2.
    Please consider CONTACT is Source table, CONSUMER is a Target1, CONSUMER_RCV is a Target2 and CONSUMER_ATTR is a Target3
    to simplify the problem.
    Following is the Table structure
    =========================
    CREATE TABLE CONTACT (
    ID VARCHAR2 (40) NOT NULL, -- will go into Target1
    EMAIL VARCHAR2 (100) ,      -- might be duplicate and will go into Target1 and Target2
    FIRST_NAME VARCHAR2 (100) NOT NULL, -- will go into Target1
    LAST_NAME VARCHAR2 (100) NOT NULL, -- will go into Target1
    COUNTRY VARCHAR2 (40) NOT NULL, -- will go into Target1
    PHONE VARCHAR2 (100), -- will go into Target1
    NOTIFY VARCHAR2 (3), -- will go into Target2 table's RECEIVE_EMAIL column
    CREATE_DATE DATE ,               -- will go into Target1 and target2
    ATTR1 VARCHAR2 (400),           -- will go into Target3 as attr_type= ATTR1 and will load actual value in ATTR_VALUE
    ATTR2 VARCHAR2(100),          -- will go into Target3 as attr_type= ATTR2 and will load actual value in ATTR_VALUE
    ATTR2 VARCHAR2(100),          -- will go into Target3 as attr_type= ATTR1 and will load actual value in ATTR_VALUE
    CONSTRAINT CONTACT_PK
    PRIMARY KEY ( USER_ID ) ) ;
    CREATE TABLE CONSUMER(
    EMAIL VARCHAR2 (100) NOT NULL, -- PK
    TITLE VARCHAR2 (40),
    FIRST_NAME VARCHAR2 (40),
    LAST_NAME VARCHAR2 (40),
    ADDRESS1 VARCHAR2 (40),
    ADDRESS2 VARCHAR2 (40),
    CITY VARCHAR2 (30),
    STATE          VARCHAR2 (30),
    ZIP          VARCHAR2 (10),
    COUNTRY VARCHAR2 (40),
    PHONE VARCHAR2 (15),
    DATE_CREATED DATE NOT NULL,
    CONSTRAINT CONSUMER_PK
    PRIMARY KEY ( EMAIL ) ) ;
    CREATE TABLE CONSUMER_RCV (
    ID                VARCHAR2 (40) NOT NULL,-- PK
    EMAIL VARCHAR2 (100) NOT NULL,-- FK reference to Consumer
    SITE VARCHAR2 (100) NOT NULL, -- default website
    RECEIVE_EMAIL VARCHAR2 (1),
    CREATE_DATE DATE NOT NULL,
    CONSTRAINT CONSUMER_RCV_PK
    PRIMARY KEY (ID) ) ;
    ALTER TABLE CONSUMER_RCV ADD CONSTRAINT CONSUMER_RCV_FK
    FOREIGN KEY (EMAIL)
    REFERENCES CONSUMER (EMAIL) ;
    CREATE TABLE CONSUMER_ATTR (
    CONSUMER_ATTR_ID           VARCHAR2 (40) NOT NULL, -- PK
    ID                     VARCHAR2 (40) NOT NULL, -- FK reference to COnsumer_RCV
    ATTR_TYPE           VARCHAR2 (100) NOT NULL,
    ATTR_VALUE           VARCHAR2 (4000) NOT NULL,
    CONSTRAINT CONSUMER_ATTR_PK
    PRIMARY KEY ( CONSUMER_ATTR_ID ) ) ;
    ALTER TABLE CONSUMER_ATTR ADD CONSTRAINT CONSUMER_ATTR_FK
    FOREIGN KEY (CONSUMER_ATTR_ID)
    REFERENCES CONSUMER_RCV (ID) ;

    HI Hema,
      How are the entries related.. is it like for one entry in y table there are more than one entry in x table then you have to use loop with in loop , here are the both the conditions.
    1) For each entry in Y there are more than one entries in X
      sort y by quota trpid.
      sort x by quota trpid.
      loop at y.
      loop at x where quota eq y-quota
                            and trpid eq y-trpid.
      z-value = x-value.
      append z.
      endloop.
      endloop.
    2) For each y there is one entry in x table.
    sort y by quota trpid.
      sort x by quota trpid.
      loop at y.
      read table x with key quota = y-quota
                                trpid = y-trpid binary search.
    if sy-subrc eq 0.
      z-value = x-value.
      append z.
    Endif.
      endloop.
    Mahesh

  • Inserting data from one table into another table using PL/SQL

    HI,
    I am trying to insert values from one table into another using PL procedure, the values I want to retrieve from the table riverside1 are charac_id and charac_type and insert these values into another table called riverside2 , the stored procedure zorgs_gorfs(x,y) accepts two parameters which are 2 charac_id's of d characters in riverside1 then using insert statements inserts these characters from riverside1 into riverside2.
    CREATE OR REPLACE PROCEDURE zorgs_gorfs(x IN NUMBER, y IN NUMBER) AS
         BEGIN
              INSERT INTO riverside2
                   (charac_id)
              VALUES
                   (x);
    INSERT INTO riverside2
                   (charac_id)
              VALUES
                   (y);
          END zorgs_gorfs;
    /This works but the problem im having is that when I also try to insert the charac_type as well as the charac_id it doesnt work below is the code:
    CREATE OR REPLACE PROCEDURE zorgs_gorfs(x IN NUMBER, y IN NUMBER) AS
         BEGIN
              INSERT INTO riverside2
                   (charac_id,charac_tye)
              VALUES
                   (Select
                        charac_id,
                        charc_type
                   FROM
                        riverside1
                   WHERE
                        charac_id = x);
          END zorgs_gorfs;
    /can someone kindly sort me out

    modify this sql
    INSERT INTO riverside2
                   (charac_id,charac_tye)
              VALUES
                   (Select
                        charac_id,
                        charc_type
                   FROM
                        riverside1
                   WHERE
                        charac_id = x);as
    INSERT INTO riverside2
                   (charac_id,charac_tye)
              VALUES
                   (Select
                        charac_id,
                        charc_type
                   FROM
                        riverside1
                   WHERE
                        charac_id in ( x,y));But my suggestion would be consider revising your approach. It does not look that good.
    Thanks,
    karthick.

  • How do I move a table from one schema to another schema on Oracle XE?

    How do I move a table from one schema to another schema on Oracle XE?

    Hi,
    I tried to use the insert/select statement that you had given, it did not work.
    The error is ORA-00913: too many values.
    But finally what I did was, I went into the system schema where the table was and generated the DDL through the utilities and afterwards I imported them into the schema that I am currently working on. It solved the problem!
    However I am still curious to know why the insert/select statement did not work? Do you know any site/tutorial which gives a real time example?
    Thank you
    Skye

Maybe you are looking for

  • DEPOT Excise Invoice.

    Hi I am created  Depo SO-> Depot Delivery. Now i am doing J1IJ against Depot Delivery, i am not able to see the Excise duties for Excise Invoice. While MIGO Incoming excise invoice created & it has excise Duties. any config missing? Reg, Antaa21

  • Itunes and Windows 8.1 tablet

    I plan to buy an Asus tablet that runs Windows 8.1 and would like to know if I can download, install and use Itunes. Can someone let me know? thanks.

  • Grid in drawing

    Hello, i am testing Pages as a AppleWorks user. Where is in Pages the menu to make a grid of for example 1mm (rastering). This would be very helpfull when working with drawing objects. Thanks Achim Message was edited by: Achim Bernlöhr

  • Not taken to the last post...

    When I want to report spam, I use a bookmark that takes me to the first message in the Spam forum. If I click on the "Reply" button of this first message, I get the box for writing my report, but the "last" message above it is #49. not the #282 which

  • Very Odd PL/SQL Stored Procedure Behavior

    I'm writing a jsp/struts front-end for a legacy app that makes extensive use of stored procedures. I've sucessfully created a login page, a search page, and a master record detail/edit page. On the master record detail there are a series of subordina