Add records to the physical table from Internal table

Hello,
I am trying to insert the records from IT table to physical table. But, its not inserting. Please let me know how do I add the records to the table zebp_iv_cf_log.
I have used only few fields for example *
After looping I get about 800 records in it_non_ebp tab *
loop at non_ebp_inv.
    it_non_ebp-zspgrv = non_ebp_inv-spgrv.
    it_non_ebp-zspgrq = non_ebp_inv-spgrq.
    it_non_ebp-zspgrs = non_ebp_inv-spgrs.
    it_non_ebp-inv_ref_num = non_ebp_inv-xblnr.
    it_non_ebp-zspgrc = non_ebp_inv-spgrc.
    it_non_ebp-zlifnr = non_ebp_inv-lifnr.
    append it_non_ebp.
    endloop.
    insert   zebp_iv_cf_log from table it_non_ebp[] accepting duplicate keys .
I also tried inserting one by one by putting insert syntex within a loop but, it takes keeps processing.
Shall appreciate the response.
Thks & Rgds,
Hemal
Edited by: hemalgandhi on Jun 12, 2009 6:27 PM

Hi,
for the internal table you are using for appending , you must declare it with the header line option
as
data it_non_ebp type table of zebp_iv_cf_log with HEADER LINE.
or else you can have a separate workarea of type zebp_iv_cf_log
as
data wa_zebp_iv_cf_log type zebp_iv_cf_log.
then the code should be like :
loop at non_ebp_inv.
wa_zebp_iv_cf_log -zspgrv = non_ebp_inv-spgrv.
wa_zebp_iv_cf_log -zspgrq = non_ebp_inv-spgrq.
wa_zebp_iv_cf_log -zspgrs = non_ebp_inv-spgrs.
wa_zebp_iv_cf_log -inv_ref_num = non_ebp_inv-xblnr.
wa_zebp_iv_cf_log -zspgrc = non_ebp_inv-spgrc.
wa_zebp_iv_cf_log -zlifnr = non_ebp_inv-lifnr.
append wa_zebp_iv_cf_log to it_non_ebp.
clear wa_zebp_iv_cf_log .
endloop.
and use 
   modify zebp_iv_cf_log from table it_non_ebp accepting duplicate keys .
instead of
   insert zebp_iv_cf_log from table it_non_ebp[] accepting duplicate keys .
Please try out and let me know of you face any problem

Similar Messages

  • Logical table with data restrictions from the physical table

    Hello, I have a question about the relationships between the Logical Tables in Business Model and Mapping and The Physical table in the physical layer. The problem is the next one:
    I have a Physical Table named T1 that contains the attributes: Id, DateChangeState, State,…
    T1
    DateChangeState| ID |State     | Other columns….
    01/01/2011 | 1 | 03 |     …
    02/01/2011 | 1 |     11 |     …
    03/01/2011 | 1 |     02 |     …
    02/02/2011 | 2 |     01 |     …
    03/02/2011 | 2 |     02 |     …
    I need filter this table and extract only one row per ID. The row that I need is the row who contains the Max(DateChangeState) per ID. I don’t know how extract only the rows selected from the physical table to the Logical Table.
    I need that the logical table contains the next rows:
    T1_Logical
    DateChangeState |ID |     State     Other columns….
    03/01/2011 | 1 | 02 |     …
    03/02/2011 | 2 | 02 |     …
    How can I extract only the rows with the Max(DateChangeState) grouped by ID in the BMM?
    I thought put this condition in the column mapping (CASE WHEN DateChangeState=Max(DateChangeState)) but the Max(DateChangeState) was not grouped by ID.
    Any idea about how solve this problem?
    I can not use the group by in the answer and I can not change the physical layer.
    Thank you,
    Best Regards.

    Hi Rajeevagrl your solution is very good but I dont´t know why obiee is applying twice the max condition, The select is the next one:
    select distinct D1.c1 as c1,
    D1.c2 as c2,
    D1.c1 as c3
    from
    (select D1.c1 as c1,
    D1.c2 as c2
    from
    (select D1.c1 as c1,
    D1.c2 as c2,
    max(D1.c3) over () as c3
    from
    (select T379.ID as c1,
    T379.DATE as c2,
    max(T379.DATE) as c3
    from
    T1 T379
    group by T379.ID, T379.DATE
    ) D1
    ) D1
    where ( D1.c2 = D1.c3 )
    ) D1
    order by c2
    Edited by: 848497 on 14-abr-2011 3:58

  • Inserting one table records to the another table

    Hi There
    Though i don't close the Result set , My program throws the following Exception
    java.sql.SQLException: ResultSet is ClosedBecause of this my program Inserts only one record in the another table
    My code is this
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.DefaultComboBoxModel.*;
    import javax.swing.table.*;
    import java.sql.*;
    import java.util.*;
    public class SearchBook extends JDialog implements ActionListener
         private JComboBox comboCategory,comboAuthor;
         private JSplitPane splitpane;
         private JTable table;
         private JToolBar toolBar;
         private JButton btnclose, btncancel;
         private JPanel panel1,panel2,panel3,panel4;
         private JLabel lblCategory,lblAuthor;
         private Container c;
         //DefaultTableModel model;
         Statement st;
         ResultSet rs;
         Vector v = new Vector();
         public SearchBook (Connection con)
              // Property for JDialog
              setTitle("Search Books");
              setLocation(40,110);
              setModal(true);
              setSize(750,450);
              // Creating ToolBar Button
              btnclose = new JButton(new ImageIcon("Images/export.gif"));
              btnclose.addActionListener(this);
              // Creating Tool Bar
              toolBar = new JToolBar();
              toolBar.add(btnclose);
              try
                   st=con.createStatement();
                   rs =st.executeQuery("SELECT BCat from Books Group By Books.BCat");
                   while(rs.next())
                        v.add(rs.getString(1));
              catch(SQLException ex)
                   System.out.println("Error");
              panel1= new JPanel();
              panel1.setLayout(new GridBagLayout());
              GridBagConstraints c = new GridBagConstraints();
              c.fill = GridBagConstraints.HORIZONTAL;
              lblCategory = new JLabel("Category:");
              lblCategory.setHorizontalAlignment (JTextField.CENTER);
              c.gridx=2;
              c.gridy=2;
              panel1.add(lblCategory,c);
              comboCategory = new JComboBox(v);
              comboCategory.addActionListener(this);
              c.ipadx=20;
              c.gridx=3;
              c.gridwidth=1;
              c.gridy=2;
              panel1.add(comboCategory,c);
              lblAuthor = new JLabel("Author/Publisher:");
              c.gridwidth=2;
              c.gridx=1;
              c.gridy=4;
              panel1.add(lblAuthor,c);
              lblAuthor.setHorizontalAlignment (JTextField.LEFT);
              comboAuthor = new JComboBox();
              comboAuthor.addActionListener(this);
              c.insets= new Insets(20,0,0,0);
              c.ipadx=20;
              c.gridx=3;
              c.gridy=4;
              panel1.add(comboAuthor,c);
              comboAuthor.setBounds (125, 165, 175, 25);
              table = new JTable();
              JScrollPane scrollpane = new JScrollPane(table);
              //panel2 = new JPanel();
              //panel2.add(scrollpane);
              splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,panel1,scrollpane);
              splitpane.setDividerSize(15);
              splitpane.setDividerLocation(190);
              getContentPane().add(toolBar,BorderLayout.NORTH);
              getContentPane().add(splitpane);
         public void actionPerformed(ActionEvent ae)
              Object obj= ae.getSource();
              if(obj==comboCategory)
                   String selecteditem = (String)comboCategory.getSelectedItem();
                   displayAuthor(selecteditem);
                   System.out.println("Selected Item"+selecteditem);
              else if(obj==btnclose)
                   dispose();     
              else if(obj==comboAuthor)
                   String selecteditem1 = (String)comboAuthor.getSelectedItem();
                   displayavailablity(selecteditem1);
                   //System.out.println("Selected Item"+selecteditem1);
                   System.out.println("Selected Author"+selecteditem1);
         private void displayAuthor(String selecteditem)
              try
              {     Vector data = new Vector();
                   rs= st.executeQuery("SELECT BAuthorandPublisher FROM Books where BCat='" + selecteditem + "' Group By Books.BAuthorandPublisher");
                   System.out.println("Executing");
                   while(rs.next())
                        data.add(rs.getString(1));
                   //((DefaultComboBoxModel)comboAuthor.getModel()).setVectorData(data);
                   comboAuthor.setModel(new DefaultComboBoxModel(data));
                   //rs.close();
              catch(SQLException ex)
                   System.out.println("ERROR");
         private void displayavailablity(String selecteditem1)
                   try
                        Vector columnNames = new Vector();
                        Vector data1 = new Vector();
                        String bname,bauthor,bcategory,bref1,bavail,bid;
                        int bref,mid,num;
                        rs = st.executeQuery("SELECT * FROM Books where BAuthorandPublisher='" + selecteditem1 +"'");     
                        while(rs.next())
                             bname = rs.getString("BName");                         
                             bauthor = rs.getString("BAuthorandPublisher");
                             bcategory = rs.getString("BCat");
                             bref = rs.getInt("BRef");
                             if(bref==1)bref1="Yes";
                             else bref1 = "No";
                             mid = rs.getInt("Mid");
                             if(mid==0)bavail="Available";
                             else bavail="Issued To:"+mid;
                             bid = rs.getString("BId");
                             System.out.println("Book Name is::"+bname);
                             System.out.println("Book Availabilty::"+bavail);
                             num = st.executeUpdate("insert into BSearch Values('"+bid+"','"+bname+"','"+bcategory+"','"+bauthor+"','"+bavail+"','"+bref1+",')");
                             System.out.println("Inseted in the table");
                        /**ResultSetMetaData md= rs.getMetaData();
                        int columns =md.getColumnCount();
                        String booktblheading[]={"Book ID","Book NAME","BOOK AUTHOR/PUBLISHER","REFRENCE","CATEGORY"};
                        for(int i=1; i<= booktblheading.length;i++)
                             columnNames.addElement(booktblheading[i-1]);
                        while(rs.next())
                             Vector row = new Vector(columns);
                             for(int i=1;i<=columns;i++)
                                  row.addElement(rs.getObject(i));
                             data1.addElement(row);
                             //System.out.println("data is:"+data);
                        ((DefaultTableModel)table.getModel()).setDataVector(data1,columnNames);
                        //DefaultTableModel model = new DefaultTableModel(data1,columnNames);
                        //table.setModel(model);
                        //rs.close();
                        //st.close(); */
                   catch(SQLException ex)
                        ex.printStackTrace();
    }Please help me Friends. I am very new to java. otherwise give me some suggestion to implement this idea in effective manner.
    Thank you for your service
    Cheers

    Hi
    Here i am Posting My programs code
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.DefaultComboBoxModel.*;
    import javax.swing.table.*;
    import java.sql.*;
    import java.util.*;
    public class SearchBook extends JDialog implements ActionListener
         private JComboBox comboCategory,comboAuthor;
         private JSplitPane splitpane;
         private JTable table;
         private JToolBar toolBar;
         private JButton btnclose, btncancel;
         private JPanel panel1,panel2,panel3,panel4;
         private JLabel lblCategory,lblAuthor;
         private Container c;
         //DefaultTableModel model;
         Statement st,st1;
         ResultSet rs,rs1,rs2;
         Vector v = new Vector();
         public SearchBook (Connection con)
              // Property for JDialog
              setTitle("Search Books");
              setLocation(40,110);
              setModal(true);
              setSize(750,450);
              // Creating ToolBar Button
              btnclose = new JButton(new ImageIcon("Images/export.gif"));
              btnclose.addActionListener(this);
              // Creating Tool Bar
              toolBar = new JToolBar();
              toolBar.add(btnclose);
              try
                   st=con.createStatement();
                   rs =st.executeQuery("SELECT BCat from Books Group By Books.BCat");
                   while(rs.next())
                        v.add(rs.getString(1));
              catch(SQLException ex)
                   System.out.println("Error");
              panel1= new JPanel();
              panel1.setLayout(new GridBagLayout());
              GridBagConstraints c = new GridBagConstraints();
              c.fill = GridBagConstraints.HORIZONTAL;
              lblCategory = new JLabel("Category:");
              lblCategory.setHorizontalAlignment (JTextField.CENTER);
              c.gridx=2;
              c.gridy=2;
              panel1.add(lblCategory,c);
              comboCategory = new JComboBox(v);
              comboCategory.addActionListener(this);
              c.ipadx=20;
              c.gridx=3;
              c.gridwidth=1;
              c.gridy=2;
              panel1.add(comboCategory,c);
              lblAuthor = new JLabel("Author/Publisher:");
              c.gridwidth=2;
              c.gridx=1;
              c.gridy=4;
              panel1.add(lblAuthor,c);
              lblAuthor.setHorizontalAlignment (JTextField.LEFT);
              comboAuthor = new JComboBox();
              comboAuthor.addActionListener(this);
              c.insets= new Insets(20,0,0,0);
              c.ipadx=20;
              c.gridx=3;
              c.gridy=4;
              panel1.add(comboAuthor,c);
              comboAuthor.setBounds (125, 165, 175, 25);
              table = new JTable();
              JScrollPane scrollpane = new JScrollPane(table);
              //panel2 = new JPanel();
              //panel2.add(scrollpane);
              splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,panel1,scrollpane);
              splitpane.setDividerSize(15);
              splitpane.setDividerLocation(190);
              getContentPane().add(toolBar,BorderLayout.NORTH);
              getContentPane().add(splitpane);
         public void actionPerformed(ActionEvent ae)
              Object obj= ae.getSource();
              if(obj==comboCategory)
                   String selecteditem = (String)comboCategory.getSelectedItem();
                   displayAuthor(selecteditem);
                   System.out.println("Selected Item"+selecteditem);
              else if(obj==btnclose)
                   dispose();     
              else if(obj==comboAuthor)
                   String selecteditem1 = (String)comboAuthor.getSelectedItem();
                   displayavailablity(selecteditem1);
                   //System.out.println("Selected Item"+selecteditem1);
                   System.out.println("Selected Author"+selecteditem1);
         private void displayAuthor(String selecteditem)
              try
              {     Vector data = new Vector();
                   rs1= st.executeQuery("SELECT BAuthorandPublisher FROM Books where BCat='" + selecteditem + "' Group By Books.BAuthorandPublisher");
                   System.out.println("Executing");
                   while(rs1.next())
                        data.add(rs1.getString(1));
                   //((DefaultComboBoxModel)comboAuthor.getModel()).setVectorData(data);
                   comboAuthor.setModel(new DefaultComboBoxModel(data));
              catch(SQLException ex)
                   System.out.println("ERROR");
         private void displayavailablity(String selecteditem1)
                   try
                        Vector columnNames = new Vector();
                        Vector data1 = new Vector();
                        String bname,bauthor,bcategory,bref1,bavail,bid;
                        int bref,mid,num;
                        //rs2.Open();
                        rs = st.executeQuery("SELECT * FROM Books where BAuthorandPublisher='" + selecteditem1 +"'");     
                        boolean tr=true;
                        while(rs.next())
                             if(true)
                                  bname = rs.getString("BName");                         
                                  bauthor = rs.getString("BAuthorandPublisher");
                                  bcategory = rs.getString("BCat");
                                  bref = rs.getInt("BRef");
                                  if(bref==1)bref1="Yes";
                                  else bref1 = "No";
                                  mid = rs.getInt("Mid");
                                  if(mid==0)bavail="Available";
                                  else bavail="Issued To:"+mid;
                                  bid = rs.getString("BId");
                                  System.out.println("Book Name is::"+bname);
                                  System.out.println("Book Availabilty::"+bavail);
                             num = st1.executeUpdate("insert into BSearch Values('"+bid+"','"+bname+"','"+bcategory+"','"+bauthor+"','"+bavail+"','"+bref1+",')");
                             System.out.println("Inseted in the table");
                   catch(SQLException ex)
                        ex.printStackTrace();
    }Thank you for your service

  • Howcan we add records in fields in table"CRMD_PERS_LIST"and"CRMC_LISTCOLC"?

    Hi frnds,
    I have a problem in account application of our PCUI portal.
    In PCUI we personalize the fields that are returned in the search functionality by clicking the "Personalize" Tab under Accounts.
    In our case one of the user is getting differrent optons in the personalize popup than other , i debugged the class "CL_CRM_BSP_LIST_PERS" and found that the column list is comming from table "CRMD_PERS_LIST".
    If there is no records present in this table for a pirticular user it is picking form table "CRMC_LISTCOLC.
    The records from these table are fetched using the user name,View & Field group.
    Can any body tell me how we can add records in the table "CRMD_PERS_LIST" and  "CRMC_LISTCOLC" for pirticular user.
    Do we have any kind of customization ( in spro or blueprint) for maintaining data in these tables.
    Regards,
    Sandipan jena

    resolved my self

  • How to process each records in the derived table which i created using cte table using sql server

    I want to process each row from the CTE table I created, how can I traverse from first row to second row and so on....
    how to process each records in the derived table which i created using  cte table using sql server

    Ideally you would be doing a set based processing rather than traversing row by row as thats more efficient. To answer it specific to your scenario we may need more info. Can you explain with some sample data your exact requirement?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Duplicate records in the same table

    Hello.
    I want to duplicate records in the same table, changing just two date fields and id. Id is changed with sequence.
    Example:
    id name start_date end_date
    1 record_1 01.01.04 31.12.04
    2 record_2 01.01.03 31.12.03
    I want to duplicate record with the start_date year 04 and the duplicated record would change that start_date into year 05.
    After duplicate it should look like:
    1 record_1 01.01.04 31.12.04
    2 record_2 01.01.03 31.12.03
    3 record_1 01.01.05 31.12.05
    How should my insert look like?
    Thanks

    create sequence A_SEQ
       start with 3
       nocache
    insert into tableA
            (ID, name, start_date end_date)
       select
               A_SEQ.nextval   
              ,NAME
              ,start_date + add_months (12)
              ,end_date   + add_months (12)
         from
               tableA
        where
               start_date >= to_date('01.01.2004','dd.mm.yyyy')
          and  start_date <= to_date('01.01.2004','dd.mm.yyyy')

  • Unable to find the deleted record in the child table

    Hi,
    I have two tables and a trigger:
    CREATE TABLE parent (a INTEGER, b CHAR(10));
    CREATE TABLE child (c CHAR(10), d INTEGER);
    CREATE TRIGGER parent_trigger
    AFTER INSERT OR DELETE OR UPDATE ON parent
    REFERENCING NEW AS newRow
    FOR EACH ROW
    BEGIN
    INSERT INTO child VALUES(:newRow.b, :newRow.a);
    END parent_trigger;
    Now my point is , after insertion or updation of the records in the parent table, the records are created successfully in child table...
    BUT.. on deleting a record the record is deleted successfully from parent table..but the record is not displayed in the child table.
    SQL> delete from parent where A=2;
    1 row deleted.
    SQL> select * from parent;
    no rows selected
    SQL> set feedback on
    SQL> select * from child;
    C D
    a 1
    a 2
    3 rows selected.
    Please help.

    What's the value of :NEW variables after deletion? NULL! What gets inserted into your child table? You guess it... :)

  • Master and Detail records in the same table

    Hi Steve,
    I have master and detail address records in the same table (self-reference). The master addresses are used as templates for detail addresses. Master addresses do not have any masters. Detail addresses have three masters: a master address, a calendar reference and a department. Addresses change from time to time and every department has its own email-account, but they refer to the same master to pre-fill some common values.
    Now I need to edit the master and detail address records on the same web page simultaneously.
    My question is: Can I implement a Master-View and Detail-View which refer to the same Entity-Object? Or should I implement a second Entity-Object? Or can it be done in a single Master-Detail-View?
    Thanks a lot.
    Kai.

    At a high level, wouldn't this be similar to an Emp entity based on the familiar EMP table that has an association from Emp to itself for the Emp.Mgr attribute?
    You can definitely build a view object that references two entity usages of the same entity like this to show, say, an employee's ENAME and at the same time their manager's ENAME.
    If there are multiple details for a given master, you can also do that with separate VO's both based on the same entity, sure. Again, just like a VO that shows a manager, and a view-linked VO of all the employees that report to him/her.

  • To count the records in the database table...

    I want to count the number of records in the database table (infotypes PA0000)
    is it possible to count ?
    Any function module is there?
    Thanks in advance..

    Hi dhavamani ponnusamy,
    SELECT COUNT(*) FROM <DB TABLE NAME> WHERE <CONDITION>.
    or
    SY-DBCNT Will have total no of records satisfying the given criteria in where clause.
    See below sample..
    Data: itab like mara occurs 0 with header line.
    Select * from mara into table mara.
    write:/ sy-dbcnt.
    Hope it will solve your problem...
    Reward points if useful..
    Thanks & Regards
    ilesh 24x7

  • Nsert/Update and Add Column at the same Table and at the "same" Time

    Hello,
    I want Insert/Update and Add Column at the same Table and at the "same" Time but in different sessions.
    Example:
    At first the "insert/update" statement:
    Insert into TestTable (Testid,Value) values (1,5105);
    After that the "add" statement:
    Alter table TestTable add TestColumn number;
    - sadly now I get the message: ORA-00054: resource busy and acquire with NOWAIT specified
    "insert/update" statement:
    Insert into TestTable (Testid,Value) values (2,1135);
    After that the execute commit.
    I don't know when the first session set the commit statement so I want that the DB the "Alter Table..." statement execute if it's possible.
    If it's possible I want to save a repeat loop with the "Alter Table..." statemtent.
    Thanks for ideas

    Well I want to walk in the rain without and umbrella and still stay dry, but it ain't gonna happen.
    You can't run a DDL statement against a table with transactions pending. Session 2 has to wait until session commits or rollbacks (or until the session is killed). That's just the way it is.
    This makes sense if you think about it. The data dictionary has to be consistent across all sessions. If session 2 was allowed to change the table structure whilst session 1 has a pending transaction then the database is in an inconsistent state. This is easier to see if you consider the reverse situation - the ALTER TABLE statement run by session 2 does a DROP COLUMN TESTID rather than adding a column: now what should happen to session 1's INSERT statement? You have retrospectively invalidated a statement that was perfectly legal when it was executed.
    If it's possible I want to save a repeat loop with the "Alter Table..." statemtent.Fnord.
    Cheers, APC

  • Dynamic name for the physical table

    Hi Guys,
    How to setup dynamic names for the physical table? Where it is useful?*
    Pls help me out on this.
    thanks

    Check this similar post which might be of help dynamic physical table source schema
    Cheers,
    KK

  • How to mark the physical tables as cacheable

    Hi All,
    Can someone please tell me how to mark the physical tables as cacheable.
    Thnaks a lot

    Hi,
    by default they are cacheable...
    You can see it on repository, physical layer, right clik on table, properties, on general tab, check cacheable...
    You can specify peristence time...
    See this article, you will find an image with table properties:
    http://obieeblog.wordpress.com/2009/01/19/obiee-cache-is-enabled-but-why-is-the-query-not-cached/
    Regards
    Nicoale
    Edited by: Nicolae Ancuta on 26.05.2010 09:15

  • TS1382 I want to add multiples of the same song from different playlists to my ipod but iTunes wont let me. How can I override this so that I get the songs I want on my ipod?

    I want to add multiples of the same song from different playlists to my ipod but iTunes wont let me. How can I override this so that I get the songs I want on my ipod?

    You can sync those different playlists to the iPod, and the song appears on each playlist.  However, the song is stored on the iPod once.  What is the practical reason for wanting to store the same song file multiple times (and waste storage space) on the iPod?

  • Add records in the beginning of the table

    Hi,
    Is that possible to add or append the records in the beginning of the table.
    For example,
       CREATE TABLE app_test (n NUMBER, n1 VARCHAR2(200));
       and inserting new records
      INSERT INTO app_test
         VALUES (1, 'test');
      INSERT INTO app_test
         VALUES (2, 'test');
      INSERT INTO app_test
         VALUES (3, 'test');
      select * from app_test;
    N     N1
    1     test
    2     test
    3     test
      Is that possible to add the records like below. Appending newly inserted rows in the beginning of the table.
    N     N1
    3     test
    2     test
    1     test
      Thanks
    Radha K

    hI,
    Radha K wrote:
    To get achieve sorting order, i have done the following, but the when i
    query the record, its not showing the order which i created in the index.
    CREATE TABLE iot_app_test (
    n NUMBER,
    n1 VARCHAR2(10),
    n2 TIMESTAMP);
    CREATE INDEX
    iot_app_test_indx
    ON
    iot_app_test
    SUBSTR(n2,1,9) DESC, SUBSTR(n2,11) ASC);
    INSERT INTO iot_app_test
    VALUES (1, 'test', SYSDATE);
    INSERT INTO iot_app_test
    VALUES (2, 'test', SYSDATE);
    INSERT INTO iot_app_test
    VALUES (3, 'test', SYSDATE);
    INSERT INTO iot_app_test
    VALUES (1, 'test', SYSDATE + 1);
    INSERT INTO iot_app_test
    VALUES (2, 'test', SYSDATE + 1);
    INSERT INTO iot_app_test
    VALUES (3, 'test', SYSDATE + 1);
    INSERT INTO iot_app_test
    VALUES (1, 'test', SYSDATE + 2);
    INSERT INTO iot_app_test
    VALUES (2, 'test', SYSDATE + 2);
    INSERT INTO iot_app_test
    VALUES (3, 'test', SYSDATE + 2);
    SELECT *
    FROM iot_app_test
    WHERE n2 <> SYSDATE + 3
    N     N1     N2
    1     test     4/28/2010 1:59:26.000000 PM
    2     test     4/28/2010 1:59:30.000000 PM
    3     test     4/28/2010 1:59:33.000000 PM
    1     test     4/29/2010 1:59:38.000000 PM
    2     test     4/29/2010 1:59:41.000000 PM
    3     test     4/29/2010 1:59:44.000000 PM
    1     test     4/30/2010 1:59:48.000000 PM
    2     test     4/30/2010 1:59:51.000000 PM
    3     test     4/30/2010 1:59:53.000000 PM
    The query doesn't have an ORDER BY clause, so the results could be in any order. In fact, you can run the exact same query with the exact same data seconds apart, and get a different order every time.
    The index doesn't change that. Someone above mentioned an Index Organized Table (which is not merely a table with an index), where you can control the order in which rows are stored (as if you wanted to). There is still no guarantee that, absent an ORDER BY clause, output will be in any particular order.
    But when i use the same function in order by clause, its showing the correct result.To repeat what others have said already, the only way to get output in any particular order is to use an ORDER BY clause.
    (CONNECT BY queries are the only exception of which I know. There is a partial ordering in CONNECT BY output, even if you don't use ORDER BY or ORDER SUBLINGS BY.)
    >
    SELECT   *
    FROM iot_app_test
    ORDER BY SUBSTR (n2, 1, 9) DESC, SUBSTR (n2, 11) ASC;
    N     N1     N2
    1     test     4/30/2010 1:59:48.000000 PM
    2     test     4/30/2010 1:59:51.000000 PM
    3     test     4/30/2010 1:59:53.000000 PM
    1     test     4/29/2010 1:59:38.000000 PM
    2     test     4/29/2010 1:59:41.000000 PM
    3     test     4/29/2010 1:59:44.000000 PM
    1     test     4/28/2010 1:59:26.000000 PM
    2     test     4/28/2010 1:59:30.000000 PM
    3     test     4/28/2010 1:59:33.000000 PMCan anyone tell me what's wrong with this.Nothing is wrong.
    You're getting the correct output, in the correct order. Why do you think anything is wrong?

  • Conditionaly select the physical table based on selection from prompt.

    Hi expert.
    we have one logical table with two LTS(LTS A and LTS B). LTS A is at day level and LTS B is at week level.
    So i have created a dashboard prompt which returns as day and week in drop down(SQL Result).
    So when we select Day it should run from the day table and when we select Week it should run from week table.
    How to do that...

    Amotoj,
    This scenario is exactly what the Cascade parent is meant for.   You would define your screen to have multiple fields where if you select a value in field 1, field 2 will be automatically filtered based on the first selection.
    You will need the appropriate indexes on the Complex Table to support it but it is fairly straight forward.
    If there a reason you don't want to use multiple fields?
    --Bill

Maybe you are looking for

  • Ipad won't sync, tried everything

    After installing IOS 7 AND the latest version of iTunes, my iPad stopped syncing with my computer. I get the "Your iPad did not sync because the sync session failed to start" message. I also get a "A required iTunes component is not installed. Please

  • Cannot view movies in iphoto gallery

    Hi, Using iLife '08, i have published some movies and pictures on my web gallery. All my friends and family can view the movies with no problems on their computers. If i try to view my gallery via Safari or another web browser i get a message that sa

  • New system won't boot

    I installed a athlon 64 in a k8t neo  board. The fan starts on the cpu but the monitor and the computer does not boot. It shows all 4 LEDS on the D bracket which says the cpu is the problem. I am tring to determine if it is the cpu or motherboard . I

  • Red Eye Woes

    The red eye in iPhoto has does some strange things for me. It always had an issue where sometimes (seemingly randomly) it would apply redeye to an ENTIRE photo (red shirts, lips, face and all). This is obviously a useless feature and it takes a good

  • Need to test for a Hashtable key in JSTL

    What I am trying to accomplish is to test a Hashtable for a specific key and if it is there run some HTML. This is my code but it obviously wrong since JSTL yells at me when I try to execute it. <c:set var="hash" scope="page" value="${UpdateStatusDat