Interchange of data between two rows.

I have a table Test. In it there are 2 rows.Primary key of first row is A and primary key of second row is B.
I want to interchange the data.
I mean data of A in B and data of B in A.
Pls help..

Hi,
I would write a stored procedure in pl/sql that takes in input the two Id issues two select and create a record of type and use the local variable as swap area.
something like
create table cod_test(id varchar2(10), value varchar2(20));
create or replace procedure swap(id_1 in varchar2, id_2 in varchar2) is
       rec_1 cod_test%rowtype;
       rec_2 cod_test%rowtype;
       rec_swap cod_test%rowtype;
begin
  select * into rec_1 from cod_test where id=id_1;
  select * into rec_2 from cod_test where id=id_2;
  rec_swap.id:=rec_1.id;
  rec_swap.value:=rec_1.value;
  update cod_test set value=rec_2.value where id=id_1;
  update cod_test set value=rec_swap.value where id=id_2;
end swap;
insert into cod_test (id,value) values('1','one');
insert into cod_test (id,value) values('2','two');
exec swap('1','2');
select * from cod_test;it's a simple test, take it as a starting point (add exception management for example).
ciao,
Giovanni

Similar Messages

  • Add space between two rows

    Hello,
    I need to add space between rows. Please let me know how to go about.
    I have a messgeComponentLayout Region, i am trying to create a space between two rows.
    Presently it is as follows:
    Vacation Plan
    Sick Plan
    I need as follows:
    Vacation Plan
    Sick Plan
    Please let me know how to go about.
    Thanks!

    The foll. is the region, how do i incorporate the rowLayout as suggested in the discussion. Please let me know.
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!-- dbdrv: exec java oracle/jrad/tools/xml/importer XMLImporter.class java &phase=dat+24 checkfile:~PROD:~PATH:~FILE &fullpath:~PROD:~PATH:~FILE -username &un_apps -password &pw_apps -dbconnection &jdbc_db_addr -userId "1" -rootPackage /oracle/apps/~PROD -rootdir &fullpath:~PROD:mds:directory -->
    <oa:header version="9.0.3.8.12_1330" xml:lang="en-US" xmlns:oa="http://xmlns.oracle.com/oa" xmlns:jrad="http://xmlns.oracle.com/jrad" xmlns:ui="http://xmlns.oracle.com/uix/ui" xmlns:user="http://xmlns.oracle.com/jrad/user" xmlns="http://xmlns.oracle.com/jrad" file-version="$Header$" text="Year to Date Accruals and Time Taken (total hrs.):" amDefName="xbol.oracle.apps.xbol.selfservice.loa.server.YtdAM">
    <ui:contents>
    <oa:messageComponentLayout controllerClass="xbol.oracle.apps.xbol.selfservice.loa.webui.MainRNCO" rows="7" columns="2" amDefName="xbol.oracle.apps.xbol.selfservice.loa.server.YtdAM" id="Main">
    <ui:contents>
    <oa:messageStyledText id="VaPlCo" prompt="US Vacation Carry Over" viewName="VacPlAcVO1" viewAttr="VacationCarryOver" styleClass="OraDataText"/>
    <oa:messageStyledText id="VaPlAc" prompt="US Vacation Plan Accrual" viewName="VacPlAcVO1" viewAttr="UsVacationPlan" styleClass="OraDataText"/>
    <oa:messageStyledText id="VaTk" prompt="Vacation Taken" viewName="VacPlAcVO1" viewAttr="VacationPlan" styleClass="OraDataText"/>
    <oa:messageStyledText id="FlPlAc" prompt="US Floating Holiday Plan Accrual" viewName="VacPlAcVO1" viewAttr="UsFloatingHolidayPlan" styleClass="OraDataText"/>
    <oa:messageStyledText id="FlTk" prompt="Floating Holiday Taken" viewName="VacPlAcVO1" viewAttr="FloatingHolidayPlan" styleClass="OraDataText"/>
    <oa:messageStyledText id="AcBaTk" prompt="Accrual Bank Taken" viewName="VacPlAcVO1" viewAttr="AccrualBankPlan" styleClass="OraDataText"/>
    <oa:messageStyledText id="item2"/>
    <oa:messageStyledText id="SiPlCo" prompt="US Sick Plan Carry Over" viewName="VacPlAcVO1" viewAttr="SickCarryOver" styleClass="OraDataText"/>
    <oa:messageStyledText id="SiPlAc" prompt="US Sick Plan Accrual" viewName="VacPlAcVO1" viewAttr="UsSickPlan" styleClass="OraDataText"/>
    <oa:messageStyledText id="SiTk" prompt="Sick Taken" viewName="VacPlAcVO1" viewAttr="SickPlan" styleClass="OraDataText"/>
    <oa:messageStyledText id="item1" rendered="true"/>
    <oa:messageStyledText id="PePlAc" prompt="US Personal Leave Plan Accrual" viewName="VacPlAcVO1" viewAttr="UsPersonalLeavePlan" styleClass="OraDataText"/>
    <oa:messageStyledText id="PeTk" prompt="Personal Taken" viewName="VacPlAcVO1" viewAttr="PersonalLeavePlan" styleClass="OraDataText"/>
    </ui:contents>
    </oa:messageComponentLayout>
    </ui:contents>
    </oa:header>

  • Query the data between two tables

    Need help for query the data between two tables
    Table 1: Time sheet
    P.ID      P.Name EmpID HoursSpend DateTime
    c12234  Test      25        4                06/12/2013
    c12234  Test      25        7                06/13/2013
    c12234  Test      25        8                06/15/2013
    c12234  Test      5          3                06/21/2013
    c12234  Test      2          5                07/15/2013
    c12234  Test      25        4                07/21/2013
    Table 2: cost table
    EmpID  FromDate       ToDate         Rate
    25         05/01/2013    06/30/2013    250
    2         04/01/2013    05/31/2013      150
    25         07/01/2013     09/30/2013    300 
    Output
    P.ID      P.Name EmpID HoursSpend DateTime       Rate   Total (HoursSond x Rate)
    c12234  Test      25        4                06/12/2013    250     1000 (4*250)
    c12234  Test      25        7                06/13/2013    250      1750
    c12234  Test      25        8                06/15/2013    250      
    2000
    c12234  Test      25        4              07/21/2013     300       
    1200
    c12234  Test      2          5              07/15/2013    150          
    750
    ===========================================     
    Total                           28                                                 
    6700
    ============================================
    Here EmpID =2 don't have rate in the cost table on july month should be pick from last entry from cost table.

    Hi Gopal,
    According to your description, it seems that the output needn’t include the row when EmpID=2. Because the DateTime for it in Table1 doesn’t included between FromDate column and ToDate column. After testing the issue in my environment, we can refer to the
    query like below to achieve your requirement:
    SELECT time.*,cost.EmpID,cost.Rate,(time.HoursSpend * cost.Rate)as [Total (HoursSond x Rate)]
    FROM [Time sheet] as time
    INNER JOIN
    [cost table]as cost
    ON time.EmpID = cost.EmpID
    AND time.DateTime BETWEEN cost.FromDate AND cost.ToDate
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Two Application in One EVDRE - check data between two application.

    Dear Sap Expert,
    We want to check data between two applications.
    For example, we have in C_ACCT= 100000000  Amount 5000 in Legal Application, we want to check what amount is in that C_ACCT in ICMatching application.
    Problem is that we can't get data from two application with one EVDRE.
    If we will make it using two EVDRE, problem when we retrieve data, rows doesn't match.
    Our question : is it possible to link to two applilcation using one EVDRE? (Just like dimension? For example for first column it will be Legal, for the next ICMatching.)
    If no, how we can solve our needs?
                                 Legal |ICMatching | Difference
    C_ACCT               5000 | 2000           |  3000
    For example      
    (100000000)

    Thanks for answer.
    Does it mean that for example if i just want to check C_ACCT=100000000 between two application(Legal and ICMatching) i should build TWO EVDRE, and i can't solve this problem by one EVDRE. (Or with two EVGET)
    Our aim that we need to check all BASMEMBERS data between two application, it's huge data, so we want supress all zero data(SUPRESS="Y").
    So if we build first evdre for LEGAL, for example it will have, 500 rows.
    Second evdre for ICmatching, for example, will have 953 rows.
    How we can check data and show difference between them?
    Best solution for us, if in one evdre we can retrieve data from two application, so rows will match and we also can supress data.
    Thanks,
    Kadraliyev Yerlan

  • How do you find the average value of all the data between two points on a single channel

    I am tring to calculate the average value of all the data points on a single plot between two seperate points
    I have attahced an illustration.
    Tim
    Solved!
    Go to Solution.
    Attachments:
    plot.jpg ‏173 KB

    Hey smoothdurban,
    I've seen Brad's code, and trust me, it's worth the effort to let him help you get it up and running - it's definitely the most ideal way to solve this problem.  However, as Brad said, there are multiple ways to tackle this - both interactive and programmatic - so in the meantime, I'll take a second to detail one of the interactive and sure-fire ways to find the average of data between two points on a single channel.
    We'll use"Flags."  Set up your VIEW graph exactly as you did on your original screenshot, using Band Cursors to approximate the beginning and ending X-values representing the range you want to examine.  Next:
    1. Click the "Set Flags" button () that is a part of your 2D Axis System.  Note that you can hold down the Shift button if you ever decide you want to do this on more than a single curve at one time.
    2. Select the "Flags: Copy Data Points" button that enables after Flags are set.
    3. This creates new channel(s) in the default (bold) group in the Data Portal that contains only the Flagged data.
    4. Select DIAdem ANALYSIS.
    5. Select Statistics » Descriptive Statistics.
    6. In the Channels input, select the newly created channel containing your Flagged Y-Data.
    7. Ensure that the Arithmetic Mean parameter is set.  You can preview the data and the result in the dialog before pressing OK to execute the calculation. 
    You may have noticed that in the Descriptive Statistics calculation, one of the parameters that you can set is the range of channel rows to operate on - so, if you know the row numbers of your beginning and ending X-values, you could just simply run the Descriptive Statistics calculation and use this parameter to operate on a row subset of your original channel instead of the entire channel.
    Derrick S.
    Product Manager
    NI DIAdem
    National Instruments

  • Calculate the variance between two row

    Post Author: jane
    CA Forum: WebIntelligence Reporting
    Hi,
    I'm new to BO and wondering whether there is a way to calculate the variance between two rows. I'm working on a report which requires to display the change of two day's data. For instance, I have a table in a format as
    Date
    Sales Amount
    3/12/2008
    2300.00
    2/12/2008
    1280.00
    Changed
    1020.00
    I'd like to display the "Changed" column. Is there a way to do that in BO InfoView? In Excel, you can use the formular by identify the two cells.
    Thanks!

    Post Author: Vinl
    CA Forum: WebIntelligence Reporting
    I am having the same problem and am steping outside of the box and cannot progress.
    Seems to me that you are kind of saying that the only way to get around this is to create an individual object in Designer? I cannot find a way of cementing values as a variable in order for a variance to be created.
    I am trying to do it at column level mind you, which should not make that much difference....
    Simple SQL database. I have created an object called "Year" which takes a date and converts it to a year. I then have another object created "Total sales", put the 2 in a table get the right results...try and create a year on year variance from that...no chance...
    Used to work ok...?

  • How can I share data between two forms on different lists

    Using a custom content type, I created two lists that I want to share the same data - one is a calendar.  Our employees complete a form from the "Out of Office Request" list that has workflow functionality that sends an email to that person's
    manager.  If the manager approves the request, the item automatically populates the "Out of Office Calendar."  The problem is that the only information from the request list that populates the calendar is the Title field and date/time fields. 
    I need the manager name in order to create a view for each manager.  
    How can I connect the other information in the request list to the calendar list.  It seems to me that if the title and date fields carry over the information, there should be a way to connect the other information.  I'm using Designer.
    I've tried to connect the two lists' webparts with the wizard, but when I get to the page that maps the two lists, there are no column names and the "Next >" button is grayed out.  This seems like the logical place to connect the two lists,
    but it isn't working.

    Hi,
    According to your post, my understanding is that you wanted share data between two forms on different lists.
    To show external  information on the calendar event, there are two methods: Calculated column, workflow. You can refer to:
    A Simple Guide to Show More Information on a Calendar Event
    I recommend to use workflow to achieve what you want. But you need to create a people column to display the manager.
    You can create a workflow associated to the "Out of Office Request" list, add action to Start Approve Process. If the manager approves the request, you can create a item in the calendar, and then update the people column and the title column.
    Then the calendar will display the Title, date/time and the manager.
    To create a view for each manager, you need to modify the Filter. You can use the people column is equal to the manager name or the Title contains the manager name.
    Thank you for your understanding.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Add new row in table between two rows - OATableBean

    Hi,
    I have a requirement where I need to add a new row between two rows. Lets say I have a table with 5 rows. I am envisioning having an icon (table switcher) on the row #1, which when clicked will insert/create a new row between rows #1 and #2 like #1.5, something that can be achieved in core forms. In core forms, when we click the add button, it immediately creates a new row before the current row ( and pushes other rows down). Is that possible with OATableBean. Please let me know if you have any ideas.
    Thanks,
    Ravi.

    Hi,
    I used following code to insert the row in the end
    public void createNewRow()
    XXEGASRLinesVOImpl vo =getXXEGASRLinesVO1();
    Row row1 ;
    int i;
    Row row[] = vo.getAllRowsInRange();
    row1 = vo.createRow(); //vo.createRowSet("10");
    vo.insertRowAtRangeIndex(row.length,row1);//.insertRow();
    row1.setNewRowState(Row.STATUS_INITIALIZED);
    Check if it works for you, you have to modify it to meet your requirement.
    Regards,
    Reetesh Sharma

  • Different ways to copy data between two schemas in one instance

    Hi there,
    I am searching a good way to copy data between two schemas in the same instance.
    Both schemas have an identical structure such as triggers, tables, views and so on. The only difference is the purpose: one is the productivity system and one is for development.
    I looked at datapump but I do not explicit want to export / import. I want to keep the data in the productivity schema as well as copy it to the other schema. Any ideas? I found out there is a copy statement but I dont't know how that works.
    Thank you so far,
    Jörn

    Thank you for your replies!
    I also thought of creating a second instance for development and move the dev - schema to it. I just don't know whether our server can handle both (performance?). Anyway the idea is to have a possibility to quickly rebuild the data inside a schema without indixes or triggers, just pure data. I thought the easiest way would be to copy the data between the schemas as they are exactly the same. However if you tell me DataPunp is the best solution i won't deny using it :).
    When you export data a file is created. does that also mean that the exported data is deleted inside the schema?
    best regards
    Jörn
    Ps: Guido, you are following me, aren' t you? ;-)

  • I need to retrieve the a set of rows in between two rows from a table.

    consider employees table and primary key employee_id.
    With out using EMPLOYEE_ID column in the where clause or between clause, I need to get the records between 104 and 116 or a set of records between two rows.
    Can any one help me in this... i know this is simple but am just a fresher to oracle development... help me grow....
    Thanks,
    Arun

    ya at last i got the out put... thank guys for thinking with me....
    SELECT rownum, employee_id FROM (SELECT rownum, employee_id FROM employees ORDER BY employee_id)
    WHERE ROWNUM <=8
    MINUS
    SELECT rownum, employee_id FROM (SELECT rownum, employee_id FROM employees ORDER BY employee_id) WHERE ROWNUM <= 4

  • How can I get extract the data between two cursors on an XY graph

    How can I get extract the data between two cursors on an XY graph

    Well, you say xy graph, so this might be a more complicated problem.
    For a waveform graph it's trivial. Simply get the two cursor indices (property: cursor index) and apply them to array subset of the data. Is that all you need?
    Here's how the above code would look like. using cursor.index instead of cursor.x elimnates the need to include scaling information.
    For an xy graph, there could be multiple segments (e.g. imagine a spiral that passes the desired x range multiple times from both sides). This would neeed significantly more code for a general solution.
    Message Edited by altenbach on 11-24-2009 07:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    cursorsubset.png ‏17 KB

  • How to compare data between two tables?

    Hi,
    My team is trying to develop a SAP data migration tool (DMT) using ABAP.
    One of the functionalities in the DMT is to validate the data in the staging area against the loaded SAP data.
    The tables in the stagin area are customer tables (i.e. user-defined tables starting with Y, Z).
    How do I compare the data in the staging area against data that are loaded into SAP tables? Are there some built-in SAP functions to do this? Or, are there some better ways of doing this (e.g. instead of comparing against data in the SAP tables, we compare with some INTERNAL tables)?
    Any help would be greatly appreciated, thanks!

    Hi Kian,
    Use <b>SCMP</b> transaction to compare data between two tables and you can not use this for comparing internal tables.
    Thanks,
    Vinay

  • Dont want to show the divided line between two rows in a Grid.

    Hello Friends,
    I want a Grid in which I want multiple rows but i dont want to show the divided line between two rows.
    It is just like a grid on Territories form(Administrator->SetUp->General->Territories)
    Thanks.

    Mithun,
    The component you're talking about is not a grid, and that component is not exposed by the UI API so you cannot use it.
    Regards,
    Vítor Vieira

  • Hide values in URL, passing data between two webdynpro(ABAP) applications.

    Hi
       When transferring the data between two webdynpro applications,  How to hide the values in URL.
    Example : First application is using for login
                    Second application is for some transactional screens.
    Based on first application login data second application should trigger. When passing the user id and password thru URL every one can see the user name and password at internet explorer, so how to hide that user name and password in URL.
    Thanks
    Murali Papana.

    Hi Lekha,
        Thanks for your reply, but I could not find parameter like visibility, andi found HAS_TOOLBAR but no use.
    I set it like
    CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW
      EXPORTING
        URL            = 'http://*****:8000/sap/bc/webdynpro/sap/Y1app1/?sap-language=EN&sap-client=200&sap-user=1104&sap-password=abcd'
        MODAL          = ABAP_FALSE
        HAS_MENUBAR    = ABAP_TRUE
        IS_RESIZABLE   = ABAP_TRUE
        HAS_SCROLLBARS = ABAP_TRUE
        HAS_STATUSBAR  = ABAP_TRUE
        HAS_TOOLBAR    = ABAP_FALSE
        HAS_LOCATION   = ABAP_TRUE
      RECEIVING
        WINDOW         = lo_window.
    Thanks
    Murali Papana.

  • SQL - Can u print all the dates between two given dates (Without PL/SQL)

    Hi Friends,
    I want to know if u can print all the dates between two given dates without using pl/sql.
    date1,date2 are given
    write a sql statement to display all the dates lying between those two dates.
    An earlier will be appreciated.
    Thanks in Advance
    Sriram
    null

    Sriram,
    Try this....
    select to_date('01-JAN-00')+to_number(rownum)
    from all_tables
    where rownum < to_date('10-JAN-00')-to_date('01-JAN-00')
    TO_DATE('
    02-JAN-00
    03-JAN-00
    04-JAN-00
    05-JAN-00
    06-JAN-00
    07-JAN-00
    08-JAN-00
    09-JAN-00

Maybe you are looking for

  • Fade to Black: Getting a weird colour distortion.

    Question for the gurus: I'm on CS3 at the moment and working on some projects involving space scenes (stars and stuff). I have a black rectangle as my bottom-most layer and change the fill to a simple black and white radial gradient effect and the bl

  • Check print cartridge error

    I installed a new black cartridge in my HP PSC 1410 All-in-One.  It printed a sheet to align the cartridges, but it won't scan, and I can't find HP Utilities or Scan or Toolbox on my MAC.   I tried taking one cartridge out, then the other.  That did

  • Video card VRAM changing

    Here's a wacky one. I have a 867 TiBook that is in great shape, hardly used. But the display is wacky. It goes all funky and distorted but will eventually, if I restart a few times, be fine. So it was fine today, I had taken it apart to check the con

  • O/p of alv grid

    hi all, i want the o/p of one alv report as the o/p of tcode MBLB. how can i assign the fields like that. PLZ explain me with simple coding. regards Nilabichi

  • Unable to set site master page and system master page separetly in SP 2013

    hi, How to set site master page and system master page separetly in SP 2013,even setting different master pages through code or UI.Always only  single custom master page is getting applied for both. Thanks & Regards, Krishna