How to insert or update multiple values into a records of diff fields

Hai All
I have to insert or update or multiple values into a single records of diff fields from one to another table.
Table1 has 3 fields
Barcode bardate bartime
0011 01-02-10 0815
0022 01-02-10 0820
0011 01-02-10 1130
0022 01-02-10 1145
0011 01-02-10 1230
0022 01-02-10 1235
0011 01-02-10 1645
0022 01-02-10 1650
these are the times that comes in at 0815 and goes break at 1130 and comes in at 1230 and goes home at 1645
from these table i have to insert into another table called table2
and the fields are barcode, date,timein intrin,introut,tiomout
And the output want to like this
barcode timein intrin introut timeout date
0011 0815 1130 1230 1645 01-02-10
0022 0820 1145 1235 1650 01-02-10
If any give some good answer it will be help full..
Thanks & Regards
Srikkanth.M

SQL> with table1 as (
  2  select '0011' Barcode,'01-02-10' bardate,'0815' bartime from dual union
  3  select '0022','01-02-10','0820' from dual union
  4  select '0011','01-02-10','1130' from dual union
  5  select '0022','01-02-10','1145' from dual union
  6  select '0011','01-02-10','1230' from dual union
  7  select '0022','01-02-10','1235' from dual union
  8  select '0011','01-02-10','1645' from dual union
  9  select '0022','01-02-10','1650' from dual
10  )
11  select barcode, bardate,
12         max(decode(rn,1,bartime,null)) timein,
13         max(decode(rn,2,bartime,null)) intrin,
14         max(decode(rn,3,bartime,null)) introut,
15         max(decode(rn,4,bartime,null)) timeout from (
16                          select barcode, bardate, bartime,
17                                 row_number() over (partition by barcode, bardate
18                                                    order by bartime) rn
19                            from table1)
20  group by barcode, bardate;
BARC BARDATE  TIME INTR INTR TIME
0011 01-02-10 0815 1130 1230 1645
0022 01-02-10 0820 1145 1235 1650Max
http://oracleitalia.wordpress.com

Similar Messages

  • How to insert the image or logo into the table as a field in webdynpro abap

    Hi Friends,
    Please tell me how to insert the image or logo into the table as a field in webdynpro abap.........

    Hi Alagappan ,
          In your view layout you take table UI element and then you bind it with some context nodes.
    The attributes of your nodes comes as a field.
    Now in these fields you can set various properties and image is one of them.
    Go to ->
    1. View Layout -> Right Click on ROOTUIELEMENTCONTAINER -> INSERT ELEMENT -> TABLE
    2. Right click on table -> Create Binding.
       Here you have to bind it with the appropriate context node.
    You will get two properties here
    a- Standard Cell Editor :- ( make it image )
    b- Standard properties :- ( If required set image properties ).
    3. If you want put image from out side then import it as a mime object and set the source of your table field ( used as a image )
    also have a look :-
    [Image Properties|http://help.sap.com/saphelp_nw04/helpdata/en/f3/1a61a9dc7f2e4199458e964e76b4ba/content.htm]
    Hope this will solve your problem.
    Reply if any case of any issue.
    Thanks & Regards,
    Monishankar C

  • How to insert or update comparing values  with two or more table

    Hai All
    I have three or four table in my database.
    Table 1 Dailattend is the main table here i need to insert or update my data and the fieds are
    Emplcode number,attdate date, intime date,intrin date ,introut date, outtime date are the fields
    Table 2 acclempbarcode the fields are
    emplcode number ,barcode number ....etc
    so now my data is in text format and i have broke the date like this
    0011221100112200100320100815
    First 16 is barcode and next 8 is date and 4 is time and i have created a temp table and store the date and move to main table
    My problem is the main table dailattend has no barcode so when i am going to insert or update i need to check whether the barcode is match with the emplcode in the main table
    How can i write insert or update statement
    The data is like this
    00110022 is barcode,10-03-2010 is my date and 0815 is time so i need to insert into dailattend table so now i have emplcode in dailattend table so i need to compare the barcode belong the emplcode in the another table and i need to insert in the dailattend table
    Pls give me some solution with example
    Regards
    Srikkanth.M

    try somthing like this
    create table t1
    as
    select '0011221100112200' barcode,to_date('100320100815','ddmmyyyyhh24mi') dt
    from dual
      create table barcodetbl
      emplcode varchar2(2000)
      barcode varchar2(2000)
      datetime date
    merge into barcodetbl bc
    using( select  * from  t1) x
    on
    (bc.barcode = x.barcode)
    when matched
    then update
    set datetime = x.dt
    when not matched
    then
    insert (emplcode,barcode,datetime)
    values(1,x.barcode,x.dt)
    /didn't realize that barcode is not in the main table.
    something along the lines
    Table 1 Dailattend is the main table here i need to insert or update my data and the fieds are
    Emplcode number,attdate date, intime date,intrin date ,introut date, outtime date are the fields
    Table 2 acclempbarcode the fields are
    emplcode number ,barcode number ....etc
    merge into dailattend bc
    using( select  * from  t1, acclempbarcode ac where t1.barcode = ac.barcode) x
    on
    (bc.emplcode = x.emplcode)
    when matched
    then update
    set datetime = x.dt
    when not matched
    then
    insert (emplcode,datetime)
    values(1,x.dt)
    /Alvinder
    Edited by: alvinder on Mar 23, 2010 3:50 PM

  • How to insert various number of values into a table

    Hi
    Im devoloping application using swing components..How can i insert values from JTextField to table if the form contains number of textfield(more than 30) and JRadioButtons(Radio Buttons are in button group).
    thanks in advance.

    Hi
    i designed a form with 58 Textfields. i want to get data from those fields and i have to store those into a database table. how can i do that .is there any simple way to do that?. do you have any example code? pls give me...

  • Store multiple values into a variable

    I was wondering if it was possible to store multiple values into one varaible. Something along the lines of...
    Oracle: 10g
    --Table xSample (this is obviously a dumbed down version of the table for the sake of showing what I want to accomplish
    S_ID   YEAR
    1         2009
    2         2009
    3         2009
    4         2009
    --Query
    select     s_id
    into       pID
    from      xSample
    where    year = 2009;Basically the reason I was trying to figure out how to store multiple values into a variable is b/c I was going to use that variable (pID) as a parameter and have it's values passed dynamically when the proc was called. The values would go into a query that would look something like:
    select *
    from cust_data
    where person_id in (pID)
    aka
    select *
    from cust_data
    where person_id in (1,2,3,4)Not sure if this is possible, but if anyone knows of a way I could accomplish this that would be great.
    Edited by: user652714 on Dec 23, 2009 9:37 AM

    Here's a basic idea building a comma seperated list, then consuming it in another query (taking the in list approach from Tom's post, linked earlier).
    create table xsample (s_id number not null, year number);
    insert into xsample select level, 2009 from dual connect by level <=4;
    commit;
    declare
       --4000 should be lots ... hopefully?
       v_parameter_list varchar2(4000);
    begin
      --create the comma seperated list
      select
        substr(max(sys_connect_by_path(s_id, ',') ), 2, 4000)
      into
        v_parameter_list
      from
        select s_id, row_number() over(order by 1) as rn
        from xsample
        where year = 2009
      start with rn = 1
      connect by prior rn = rn - 1;
      --consume the comma seperated list
      for x in
        with data as
          select
            trim( substr (txt,
            instr (txt, ',', 1, level  ) + 1,
            instr (txt, ',', 1, level+1)
            - instr (txt, ',', 1, level) -1 ) ) as token
          from
            select ','||v_parameter_list||',' txt
            from dual
          connect by level <= length(v_parameter_list)-length(replace(v_parameter_list,',',''))+1
        select *
        from xsample
        where s_id in (select * from data) 
      loop
        dbms_output.put_line('next item = ' || x.s_id);
      end loop;
    end;
    /

  • How to copy one column BLOB value into another column of another database.

    How to copy one column BLOB value into another column of another database.
    BLOB value contains word document.
    I thought of copy the BLOB value into a text file and then update the new column value by the same text in textfile. Will this work?
    Is there any other better way to do this?

    You're welcome
    BLOB fields contains binary data. I don't think you can do this
    Also if I view the BLOB as text. Can I copy it and insert into the new database.
    I think your options are as I said. Datapump or CTAS
    Best Regards

  • How to read and update the value of property file

    Hi,
    I am not able read the values from property file.
    Please tell me how to read and update the values from property file using Properties class
    This is my property file : - Config.properties its located in D:\newfolder
    Values
    SMTP = localhost
    Now i need to change the value of the SMTP
    New value :
    SMTP =10.60.1.9
    Pls Help me
    Thanks
    Merlin Rosina,

    Post a small (<1 page) example program that forum members can copy and run that demonstrates your problem.

  • How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi
    Can anyone tell me.
    How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi Mithlesh,
    javascript runs on client side and you cannot assign the value to a Page attribute directly.
    As a workaround,you can use an Inputfield,hidden if required,and set the value using javascript.Then the form will have to be submit to be able to read the value in onInputProcessing and then can be assigned to any variable.
    In Layout
    <head>
    <script language="javascript">
    function pass()
       txt1 = document.getElementById("ip_mrf");
       txt.value = "hello" ;
    </script>
    </head>
    <htmlb:inputField  id="ip_mrf"
                               value="<%=mrf_number%>"
                               visible="FALSE"/>
    in onInputProcessing
    cha1 = request->get_form_field( 'ip_mrf' ).
    where cha1 is the page attribute
    hope this helps,
    Regards,
    Siddhartha
    Message was edited by: Siddhartha Jain

  • How do I filter on multiple values / labels within a Pivot Table which points to a Power Pivot Model

    Hi,
    How do I filter on multiple values / labels within a large data set within a Pivot Table which points to a Power Pivot Model. I am current using Excel 2010 64 bit. I intend to empower users to achieve this by simply using the Excel user interface, not by
    using Excel formula or DAX. Please find the attached screen shot as a worked example, also in my real life example not all the values are available in the drop down. You can't use a slicer for the same reason as you can't use a drop down. I guess what I was
    hoping for is for the user to be able to enter AND or OR within the associated dialog box. Is there any way around this?
    Kind Regards,
    Kieran.
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Hi
    This is the forum to discuss questions about Microsoft Excel develop (VBA, Automation). For your question is more about pivot table features  for Excel, I will move
    this thread to the TechNet forum for Excel.
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share
    their knowledge or learn from your interaction with us.
    Thank you for your understanding.
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Storing and retrieving multiple values into one cookie.

    Hi Everyone,
    I am wondering if anybody knows of any good tutorials involving storing multiple values into one cookie. Any URLs will be greatly apprecated. Thanks heaps.
    Regards
    Davo

    These are normally delimted in HTTP by a semicolon. You can concatenate the string yourself and on the reverse trip use StringTokenizer to get the values back out.
    - Saish

  • How can i get this variable value into second page IN BSP

    Hi friends
    I have variable wk_matnr value 'ABC' in first page of BSP.
    How can i get this variable value into second page.
    Moosa

    Hi,
    you can define variable (page attribiue) on the second page with the same name. You can realise the Navigation with Button ther started onInputProcesing routine. In onInputProcesing you have to call navigation->set_parameter with attribut name as parameter and then starting the navigation. If you have checked the auto property on the variable on second page and varable have same name, the value of variable should be transported.
    [See this tutorial|http://help.sap.com/saphelp_erp2005/helpdata/DE/1a/c5133a62983c0ae10000000a114084/frameset.htm]
    Best regards
    Bogdan

  • How can we include the property value into the News RSS?

    We have defined object property u201CDepartmentu201D that is used in News XML creating form. How can we include the property value into the News RSS (set value of the particular RSS XML tag)?

    We have solved the issue with NWDS

  • How to get BW-BPS variable value into Visual Basic?

    Hello,
    Scenario:
    Time characteristic 0FISCYEAR has a variable ZVFYEAR. In layout this time characteristic is defined as DATA COLUMN. When user changes VFYEAR variable’s value i want to get the value of variable into Visual Basic and to format header for table in the layout.
    How to get BW-BPS variable value into Visual Basic?
    Could you help me?
    Thanks in advance.
    Best Regards,
    Arunas Stonys

    Hi,
    If i understand your requirments correctly ,you need to read the value of the Variable and Put it on the layout. Here is how  i would solve this,
    Read the value of the variable using an ABAP program.The logic for this would be to read the variable value and post it on the layout on a cell.You can do this by calling the ABAP program on opening the layout.this can be done using LB_EXIT_FM  T-code. Now using the  SAP delivered SAPAfterDataPut  macro, read the cell in which you have placed the variable values and assign it to the necessary values you want to on the layout.All this will be done before the layout opens.
    Hope this helps.
    regards
    Sai Vishnubhatla

  • How to fulfill the virtual characteristic value into report

    Hi Experts,
          I am working on one reporting requirement that needs to add reference date (virtual characteristic) field to report.
          I have added reference date field to query and able to display the field in report.But I am not able to display reference date field runtime data in to report output.
        Could someone please help me on this how to display this virtual characteristic values into report.where the runtime variable values are stored.How to fill the data etc.
    Thanks in advance.
    Best Regards,
    Hari.
    Edited by: k hari on Jan 29, 2008 6:22 AM
    Edited by: k hari on Jan 29, 2008 6:24 AM

    You can achieve this using Customer Exit or BADI. Check the folllowing link.
    http://help.sap.com/saphelp_nw70/helpdata/en/ac/ef1f43daac9a448f0150a02e3a7aba/content.htm
    If you are using BADI
    You can create Virtual CHAR in BADI using transaction SE19
    In this transaction you can create a new or display the existing BADI.
    There you can see two tabs
    The Attribute Tab we need to give the name of the Multiprovider on which the query with the virtual char is getting executed.
    The Inerface Tab has three following sections. Need to write the ABAP code for all the three.
    Define : Defind all the characteristics and virtual char that will be used for populating virtual char
    Initialize : Initialize them
    Compute : Here you will have to write the logic for populating the virtual char.
    Once the logic is written then you can use this char in your query .
    Hope this helps.

  • How to insert the select query result into table?

    How to insert the select query result into table?
    SELECT  top 20 creation_time  
            ,last_execution_time 
            ,total_physical_reads
            ,total_logical_reads  
            ,total_logical_writes
            , execution_count 
            , total_worker_time
            , total_elapsed_time 
            , total_elapsed_time / execution_count avg_elapsed_time
            ,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
             ((CASE statement_end_offset 
              WHEN -1 THEN DATALENGTH(st.text)
              ELSE qs.statement_end_offset END 
                - qs.statement_start_offset)/2) + 1) AS statement_text
    FROM sys.dm_exec_query_stats AS qs
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
    ORDER BY total_elapsed_time / execution_count DESC;
    Thanks,
    Tirumala

    1. SELECT INTO
    Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
    Use AdventureWorks2008R2;
    Go
    ---Insert data using SELECT INTO
    SELECT AddressLine1, City
    INTO BothellAddresses
    FROM Person.Address
    where City = 'Bothell';
    GO
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    2. INSERT INTO SELECT
    Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
    another table.
    Use AdventureWorks2008R2;
    Go
    ---Create Table
    CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
    ---Insert into above table using SELECT
    INSERT INTO BothellAddresses(AddressLine1, City)
    SELECT AddressLine1, City
    FROM Person.Address
    where City = 'Bothell';
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    Regards,
    Vishal Patel
    Blog: http://vspatel.co.uk
    Site: http://lehrity.com

Maybe you are looking for

  • Business area wise Balance

    How can i get report of Vendor balance depending on business area? Moderator: Please, avoid asking basic questions

  • Mac Pro restarting spontaneously

    Within a few minutes of starting the Mac Pro up it shut it self down and restarted. It's done this before but some times restarts by itself a couple of times before settling. A previous time it restated but with the fans flat out. This restarting pro

  • Several browsers perfect, Navigator shows only top 1/3 of page

    Opera, Firefox, Safari, Seamonkey, Camino and IE all displpay iWeb-=created pages perfectly, but Netscape shows only the top third of pages. Somehow, too, the "Made on a Mac" logo appears at the bottom of the pat that IS diaplayed (i.e., it's "shifte

  • Validating Input fields in Interactive Adobe Forms with Webdynpro ABAP

    Dear Friends, Am new to Interactive Adobe forms with Webdynpro Abap, My scenario is, I have few Input fields, i need to handle the Messages when am not entering values in any of the Input Field, and raise the message when i click on Save Button. I ha

  • Incomplete import from OE in XP. Not all folders imported, and no messages imported.

    I have OE installed in WindowsXP. Installed Tbird. Tried import tool to import everything from OE. Only a few of the folders showed up, and no messages were imported. Tried uninstall and re-install of TBird...no help. Any assistance will be greatly a