How to select odd/even rows from table....

How to select odd/even rows from a table?
Please help.
Edited by: vaibhav on May 7, 2012 5:30 AM

just don't expect the results to come out in the sequence odd, even, odd, even .....
The answer you have marked correct needs two order by clauses to guarantee that.
The inner select will return rows in a random order, potentially different each time you run it. The outer select may not return rows in the same order as the inner one.

Similar Messages

  • How to select all the rows of table control in BDC

    Hi All,
    While I am doing BDC for Transaction Code MC88, After the first screen I will get another screen with tabble control, Here I need to select all the rows of table control, I am assignng the 'X' to the first field of Table Control which is the indicator for selection.
    Here I am getting message called Indicator field is not in program and screen.
    While doing Recording I am not able to record the indicator, Please any one let me know how to record the Entire table control selection.
    Thanks in advance..

    Sorry about that lakshmi. Here is my code.
        PERFORM dynpro USING : 'X'   'SAPMMCP6'          '0105',
                               ' '   'RMCP2-MATNR'       t_matnr,
                               ' '   'RMCP2-WERKS'       t_werks,
                               ' '   'BDC_OKCODE'        '=AKTV'.
        PERFORM dynpro USING : 'X'   'SAPLMCPA'          '0707',
                               ' '   'BDC_OKCODE'        '=MRKE'.
        PERFORM dynpro USING : 'X'   'SAPLMCPA'          '0707',
                               ' '   'BDC_OKCODE'        '=GRAO

  • Selecting a single row from table control of standard transaction via repor

    Hi Experts,
    I have a requirement of selecting a single row from standard trasaction via ineractive report.
    For eg. for a given document number & item number, how can i select the specified item from transaction VA03.
    I am using call transaction to naviagate to the screen but unable to select the specified item.
    thanks in adavance for your Help.

    You mean selecting the item via BDC?
    Have you tried something like:
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSNR(01)'.
    perform bdc_field       using 'RV45A-VBAP_SELKZ(01)'
                                  'X'.
    or whatever your dynpro is to select the first row?

  • How to select x numbered row from two tables

    Hi,
    I have one performance problem...
    Here is sample scenario...
    TableA
    A1 A2 A3
    a1     a12     a13
    a2     a22     a23
    a3     a32     a33
    TableB
    B1     B2     B3
    b1     b12     b13
    b2     b22     b23
    I want result like
    A1     B1     A2     B2
    a1     b1     a12     b12
    a2     b2     a22     b22
    I have written it like
    select
    A1,
    B1,
    A2,
    B2
    from
    (select A1, A2, rownum rnA from TableA) a,
    (select B1, B2, rownum rnB from TableB) b
    where rnA = rnB
    but suppose TableA has 2500000 rows and
    TableB has 500 rows then for 500 rows I have to
    wait for all 2500000 rows scanning.
    Is there any smart solution..?
    I have created indexes for on columns A1, (A1,A2,A3), B1, (B1,B2,B3).
    Curious:)
    Rushang Kansara
    Message was edited by:
    Rushang Kansara

    Here is explain plan
    SELECT STATEMENT, GOAL = FIRST_ROWS               Cost=5     Cardinality=67     Bytes=3618
    HASH JOIN               Cost=5     Cardinality=67     Bytes=3618
    VIEW     Object owner=SFMFG          Cost=2     Cardinality=82     Bytes=2214
    COUNT                         
    TABLE ACCESS FULL     Object owner=SFMFG     Object name=TABLEA     Cost=2     Cardinality=82     Bytes=1148
    VIEW     Object owner=SFMFG          Cost=2     Cardinality=82     Bytes=2214
    COUNT                         
    TABLE ACCESS FULL     Object owner=SFMFG     Object name=TABLEB     Cost=2     Cardinality=82     Bytes=1148
    New to sql tunning Here why cardinality goes to 67 and cost to 5???
    Thank you for your time.. :)

  • How to filter parent & child rows from tables while export usingData export

    Hi,
    I have a requirement of export schema. Assume there is a account details table and account transactions table under schema.They have parent child relation exist. if i filter accounts from account details the corresponding transactions in account transactions table should be filterd.How to achieve this?
    Regards,
    Venkat Vadlamudi
    Mobile:9850499800

    Not sure if this is a SQL and PL/SQL question or whether it's an Oracle Apps type question or a Database General.
    Whatever, you've posted in the wrong forum (http://forums.oracle.com/forums/ann.jspa?annID=599)
    You should post in a more appropriate forum e.g.
    PL/SQL
    General Database Discussions
    etc.
    locking this thread

  • Retrieving Odd numbered rows from a table.

    In one recent interview I have been asked to write a SQL query to retreive Odd numbered rows from any table. At first I am confused on how to say whther a perticular row is odd or even. If it is based on rownum then rownum is not dynamic and every time the rownum changes for a perticular row. I finally used rowid for this puprpose, as you all of you know rowid is alphanumeric its not worked.
    Can you please posta query to retrive odd numbered rows if its possible.

    Mallik wrote:
    In one recent interview I have been asked to write a SQL query to retreive Odd numbered rows from any table. At first I am confused on how to say whther a perticular row is odd or even. If it is based on rownum then rownum is not dynamic and every time the rownum changes for a perticular row. I finally used rowid for this puprpose, as you all of you know rowid is alphanumeric its not worked.
    Can you please posta query to retrive odd numbered rows if its possible.As you say, if there's nothing in the data itself to offer a distinction as to what is "odd" and "even" then the closest thing is the rownum.
    SQL> select * from (select rownum rn, emp.* from emp) where mod(rn,2) = 1;
            RN      EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
             1       7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
             3       7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
             5       7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
             7       7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
             9       7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
            11       7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
            13       7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
    7 rows selected.Anything else is making an assumption as to what is "odd" and "even". If it were me, the answer would be to do the above and also explain that, without any definition of what constitutes "odd" and "even" this is the closest possible, but not an accurate science as there is no guarantee as to the order of the records.

  • How to delete the committed row from a table from its VOImpl class ??

    I am new to ADF and I have problem to solve. To perform roll back I am using fetching key before roll back and setting it after undo operation, so that I can stay back in the currently selected row. But in my case I am using application model commit for one LOV attribute selection in the row. So when ever I am performing roll back operation after inserting a row, the values other than this committed LOV attribute gets roll backed, but I need remove the entire row from table. Does there any option to remove a row based on the attribute values of a row from VO's row implementation or from bean class in a performance optimized way ?
    Thanks in advance..........

    http://java.sun.com/javase/6/docs/api/javax/swing/table/DefaultTableModel.html#removeRow(int)
    Why did you mark it answered but gave no dukes to finalight? That's not how it works.
    You should mark his answer as correct and give him at least one duke, for the effort!

  • How can I change the background color of odd/even rows in a panelCollection

    Hi everyone.
    I'm using a panelCollection and I need to change the backgroung color for odd/even rows in the table,
    how can I do this, using a stylesheet, is there a special selector or property for this?
    globalResultCollection (UIPanelCollection object) , is a collection of UITable elements, and it's working fine.
    I just want to change the defaul background color for rows.
    Thanks
    <af:panelCollection id="GLOBAL_RESULT_COLLECTION"
    binding="#{admin.view.globalResultCollection}"
    styleClass="globalResultCollectionRegion"
    clientComponent="true">
    <f:facet name="menus">
    <af:menu id="GLOBAL_OPERATION_MENU"
    binding="#{admin.view.globalOperationMenu}" />
    </f:facet>
    <f:facet name="toolbar">
    <af:toolbar inlineStyle="width:100%"
    binding="#{admin.view.globalOperationToolbar}"
    id="OPERATION_TOOLBAR"/>
    </f:facet>
    </af:panelCollection>

    Hi,
    use this:
    af|table::data-row af|column::data-cell { background-color: #CCCCFF; }
    af|table::data-row af|column::banded-data-cell { background-color: #FFCCCC; }
    Regards,
    s o v i e t

  • How to return the entire row from a table

    Hi guys,
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100),
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    Now how can i return the entire row from table A with the datatype and its length.
    Any help would be appreciated ?
    Here is the query I wrote but it how to take the datatype and its length..
    create or replace procedure disp_table_data
    as
    type r_cursor is REF CURSOR;
    c_A r_cursor;
    er A%rowtype;
    begin
    open c_A for select * from A;
    loop
    fetch c_A into er;
    exit when c_A%notfound;
    dbms_output.put_line(er.FirstName||'--'||er.Age);
    end loop;
    close c_A;
    END;
    /

    Guys,
    I want column value from table A and its corresponding data_type and length from table B. I think I cant do it through joins.
    Any idea would be appreciated ?.
    Example ..
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100)
    insert into A values('John',24,'Boston');
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    insert into B values('FirstName','varchar2',10); -- this is coming from table A.
    Output should be like this...
    John,Varchar2,10
    Here (John is the FirstName - coming from table A, Varchar2 is a Datatype and 10 is the Length which are coming from table B ). Only column values are coming from table A , corresponding datatype and length are coming from B.
    Any idea would be appreciated ?
    Thanks.

  • Selecting duplicate rows from table

    Hi all,
    How to select the duplicates rows present in the table...

    SQL> select * from customer;
    CUST_ID CUST_NAME LOC
    1 Jeff Miami
    2 Andrew Michigan
    3 Julia Chicago
    1 Linda Miami
    1 Martha Miami
    3 Randy Chicago
    3 John Chicago
    7 rows selected.
    SQL> select * from customer where rowid != (select min(rowid) from customer C where C.cust_id = customer.cust_id);
    CUST_ID CUST_NAME LOC
    1 Linda Miami
    1 Martha Miami
    3 Randy Chicago
    3 John Chicago
    SQL>

  • How to list all the rows from the table VBAK

    Friends ,
    How to list all the rows from the table VBAK.select query and the output list is appreciated.

    Hi,
    IF you want to select all the rows for VBAK-
    Write-
    Data:itab type table of VBAK,
           wa like line of itab.
    SELECT * FROM VBAK into table itab.
    Itab is the internal table with type VBAK.
    Loop at itab into wa.
    Write: wa-field1,
    endloop.

  • How to update duplicate row from table

    Hi,
    how to update duplicate row from table?
    First to find duplicate row then update duplicate row with no to that duplicate row in oracle.
    can you give me suggestion on it?
    Thanks in advance.
    your early response is appreciated...

    In order to find a duplicate row, see:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004
    (or search this forum, your question has been asked before)
    In order to update it, just create and use an Oracle sequence, have it start and increment at a value that doesn't exist in your table.
    If that doesn't get you going, post some CREATE TABLE + INSERT INTO statements, and the results you want from them, in other words: a complete testcase.

  • Anyone know how to select only even or odd numbered files in lightroom?

    Anyone know how to select only even or odd numbered files in lightroom? I need to reduce the quantity of images in my timelapse sequence and this would help me greatly since there are 8250 images and doing this maually would be tediuos and make me want to kill myself.... : )

    Do this.
    If they are jpegs, use .jpg instead of CR2
    Be sure to save this as a preset, as you WILL need it again. Mine is named "select even CR2", that is why it says that in the upper right.

  • How to select first several records from a database table by using select?

    Hi,
       I want to select first 100 records from a database table by using select clause. How to write it?
       Thanks a lot!

    hai long!
                 well select statement is used to retrive
    records from the database.
    following is the syntax to be used.
    1) select *  into corresponding fields of itab from basetable where condition.
    endselect.
      ex: select * into corresponding fields of itab from mara
                where matnr >= '1' and  matnr <= '100'.
           append itab.
          endselect.
    select * is a loop statement.it will execute till matnr is less than or equal to 100.
    note: you can also mention the required field names in the select statement otherwise it will select all the field from table mara.
    note: itab means your internal table name.
    hope you got the required thing.if it really solved u r problem then award me the suitable points.<b></b>

  • How do I insert multiple rows from a single form ...

    How do I insert multiple rows from a single form?
    This form is organised by a table. (just as in an excel format)
    I have 20 items on a form each row item has five field
    +++++++++++ FORM AREA+++++++++++++++++++++++++++++++++++++++++++++++++++++
    +Product| qty In | Qty Out | Balance | Date +
    +------------------------------------------------------------------------+
    +Item1 | textbox1 | textbox2 | textbox3 | date +
    + |value = $qty_in1|value= &qty_out1|value=$balance1|value=$date1 +
    +------------------------------------------------------------------------+
    +Item 2 | textbox1 | textbox2 | textbox4 | date +
    + |value = $qty_in2|value= $qty_out1|value=$balance2|value=$date2 +
    +------------------------------------------------------------------------+
    + Item3 | textbox1 | textbox2 | textbox3 | date +
    +------------------------------------------------------------------------+
    + contd | | | +
    +------------------------------------------------------------------------+
    + item20| | | | +
    +------------------------------------------------------------------------+
    + + + SUBMIT + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Database Structure
    +++++++++++++++++
    + Stock_tabe +
    +---------------+
    + refid +
    +---------------+
    + item +
    +---------------+
    + Qty In +
    +---------------+
    + Qty Out +
    +---------------+
    + Balance +
    +---------------+
    + Date +
    +++++++++++++++++
    Let's say for example user have to the use the form to enter all 10 items or few like 5 on their stock form into 4 different textbox field each lines of your form, however these items go into a "Stock_table" under Single insert transaction query when submit button is pressed.
    Please anyone help me out, on how to get this concept started.

    Hello,
    I have a way to do this, but it would take some hand coding on your part. If you feel comfortable hand writing php code and doing manual database calls, specificaly database INSERT calls you should be fine.
    Create a custom form using the ADDT Custom Form Wizard that has all the rows and fields you need. This may take a bit if you are adding the ability for up to 20 rows, as per your diagram of the form area. The nice thing about using ADDT to create the form is that you can setup the form validation at the same time. Leave the last step in the Custom Form Wizard blank. You can add a custom database call here, but I would leave it blank.
    Next, under ADDT's Forms Server Behaviors, select Custom Trigger. At the Basic tab, you enter your custom php code that will be executed. Here you are going to want to put your code that will check if a value has been entered in the form and then do a database INSERT operation on the Stock_table with that row. The advanced tab lets you set the order of operations and the name of the Custom Trigger. By default, it is set to AFTER. This means that the Custom Trigger will get executed AFTER the form data is processed by the Custom Form Transaction.
    I usually just enter TEST into the "Basic" tab of the Custom Trigger. Then set my order of operations in the "Advanced" tab and close the Custom Trigger. Then I go to the code view for that page in Dreamweaver and find the Custom Trigger function and edit the code manually. It's much easier this way because the Custom Trigger wizard does not show you formatting on the code, and you don't have to keep opening the Wizard to edit and test your code.
    Your going to have to have the Custom Trigger fuction do a test on the submitted form data. If data is present, then INSERT into database. Here's a basic example of what you need to do:
    In your code view, the Custom Trigger will look something like this:
    function Trigger_Custom(&$tNG) {
    if($tNG->getColumnValue("Item_1")) {
    $item1 = $tNG->getColumnValue("Item_1");
    $textbox1_1 = $tNG->getColumnValue("Textbox_1");
    $textbox1_2 = $tNG->getColumnValue("Textbox_2");
    $textbox1_3 = $tNG->getColumnValue("Textbox_3");
    $date1 = $tNG->getColumnValue("Textbox_3");
    $queryAdd = "INSERT INTO Stock_table
    (item, Qty_In, Qty_Out, Balance, Date) VALUES($item1, $textbox1_1, $textbox1_2, $textbox1_3, $date1)"
    $result = mysql_query($queryAdd) or die(mysql_error());
    This code checks to see if the form input field named Item_1 is set. If so, then get the rest of the values for the first item and insert them into the database. You would need to do this for each row in your form. So the if you let the customer add 20 rows, you would need to check 20 times to see if the data is there or write the code so that it stops once it encounters an empty Item field. To exit a Custom Trigger, you can return NULL; and it will jump out of the function. You can also throw custom error message out of triggers, but this post is already way to long to get into that.
    $tNG->getColumnValue("Item_1") is used to retrieve the value that was set by the form input field named Item_1. This field is named by the Custom Form Wizard when you create your form. You can see what all the input filed names are by looking in the code view for something like:
    // Add columns
    $customTransaction->addColumn("Item_1", "STRING_TYPE", "POST", "Item_1");
    There will be one for each field you created with the Custom Form Wizard.
    Unfortunately, I don't have an easy way to do what you need. Maybe there is a way, but since none of the experts have responded, I thought I would point you in a direction. You should read all you can about Custom Triggers in the ADDT documentation/help pdf to give you more detailed information about how Custom Triggers work.
    Hope this helps.
    Shane

Maybe you are looking for

  • How can we append data in existing flat file

    how can we append data to a existing flat file (Text file).

  • Oracle EBSuite 12i - Are the apps available for Windows 64 bit machine?

    Hello, Can anyone help please? I am looking for Oracle EBSuite V 12i on eDelivery site. But the only Apps available for download is for Windows 32bit systems. Does anyone know if it is available for 64bit systems, given that most systems one buys now

  • Can't Activate ADOBE PHOTOSHOP CS4 UPG

    Hello, I have been using Photoshop ever since version 7 (having switched over from Corel's software, used previously for about 10 years) and had success with it. I upgraded to ADOBE CREATIVE SUITE when it became available through the Adobe upgrade op

  • Export Aperture library objects to Finder folders

    Inspired by the posted message by user http://discussions.apple.com/profile.jspa?userID=616539 I wrote a script that will do the following: 1. Sync Folders/SubFolders/Albums/Projects..etc hierarchy tree from Aperture to a Finder folders tree 2. At ru

  • How to activate siri on apd 2

    i just turn on to ios 6, and i was expecting to be able to use siri on my ipad 2, with this upgrade its sir supuose to be able for my ipad 2? or htere is a trick to activated,?