Problems in 10g in the column of type date

Hello

I have a test_abc of the table in which I have a column event_date who picks up the sysdate for any removable on this table. Now, if I have 2 rows in the table with the same value for the event_date column in the table, and then on actually doing a:
Select * from test_abc by event_date;

The results are retrieved correctly in 9i, i.e. in the order in which they were inserted. However, in 10g, the results are not retrieved from absolute randomly. Here's the scenario:

create table test_abc (inv_id number event VARCHAR2 (3), date event_date, varchar2 (10)) remarks;

insert into test_abc values (7552, 'ADD', TO_DATE (' October 1, 2009 10:45:48 ',' MON-DD-YYYY HH24:MI:SS'), 'test1');

insert into test_abc values (7552, 'REL', TO_DATE (' October 1, 2009 10:45:48 ',' DD-MON-YYYY HH24:MI:SS'), "test2");

insert into test_abc values (7552, 'RTE', TO_DATE (' October 1, 2009 10:45:48 ',' DD-MON-YYYY HH24:MI:SS'), "test3");

insert into test_abc values (7552, 'SET', TO_DATE (' October 1, 2009 10:45:48 ',' MON-DD-YYYY HH24:MI:SS'), "test4");


Now about the conduct of a select * from test_abc by event_date, I get the following in 9i result:

INV_ID EVENT EVENT_DATE REMARKS
-------- -------- ---------------------------------- --------------
7552 ADD 01/10/2009 10:45:48 test1
7552 REL 01/10/2009 10:45:48 test2
7552 RTE 01/10/2009 10:45:48 test3
7552 SET 01/10/2009 10:45:48 test4

Whereas, in 10g, the output is:

INV_ID EVENT EVENT_DATE REMARKS
-------- -------- ---------------------------------- --------------
7552 ADD 01/10/2009 10:45:48 test1
7552 SET 01/10/2009 10:45:48 test4
7552 RTE 01/10/2009 10:45:48 test3
7552 REL 01/10/2009 10:45:48 test2

Could someone help me understand what could be the problem.

Thanks in advance.

The point is that Oracle does not guarantee that lines emerge in one order other than that covered by the order by clause.

In a statement, a game of results without an order by (or without enough order bys in your case) can change at any time.

Mainly because that the plan of the SQL and the inner workings of the CBO for this plan will determine the order and there are many factors that can cause this plan change.

If the INSERT command is important to you, you can use a sequence number, possibly peopled by a trigger, increase your order in event_date.

Tags: Database

Similar Questions

  • Problem after 10g to the conversion of 11g with access ODBC application connection.

    We have recently updated one of our databases Oracle 10.2.0.4 on 11.2.0.4.0.  We used Data Pump export of database 10g and the new database 11g Data Pump import.  Everything went well.  We have several users who use an Access database with an ODBC connection to our Oracle database.  We installed 11g on their PC client and install the tnsnames file to point to the new database 11g.  We have a configuration read only account that everyone uses to connect to the Oracle11g database through the Access application.  We have a user who gets an error, even if this computer has been installed just like everyone elses.  She becomes an odbc error, that the account is locked.  I had the read-only account on our database 10g locked, so everyone would be forced to use the 11g database, because we could not completely stop the 10g database.  We have searched the c:\ drive and you can find 1 tnsnames file and it is directed to the new database 11g.  However when we unlock the account read-only on the 10g database, access works very well.  It is as if she is always directed to the 10g database, but we cannot find any link to it.  This user can also connect another pc that the ODBC connection to server 11g works with the access application and it does not work with them connected.  Any help would be appreciated!

    Our resolution is a slight reorganization of elements of Oracle in the Environment Variable Path in system settings Desktop/Properties/Advanced to ensure that the proper path containing the precise tnsnames.ora file was represented was just what he needed.

  • FRM-30187: size of the column of type CHAR in the record group must be between 1 and 2000.

    Hi, forms 6i, db 10g

    I created a lov based on this query

    select * from items_qty_vu -- database view
    

    and the view code is

    CREATE OR REPLACE FORCE VIEW items_qty_vu (serial, item_id, expiry_date, qty)
    AS
       WITH item_units_plus AS
            (SELECT item_id, unit_id, factor,
                    LEAD (factor, 1, 1e99) OVER (PARTITION BY item_id ORDER BY factor)
                                                                   AS next_factor,
                    ROW_NUMBER () OVER (PARTITION BY item_id ORDER BY factor DESC)
                                                                           AS rnk
               FROM item_units)
       SELECT     ID.serial, ID.item_id, ID.expiry_date,
                  SUBSTR
                     (SYS_CONNECT_BY_PATH (   TRUNC (  MOD ((  ID.qty
                                                             - ID.qty_allocated
                                                            ),
                                                            iup.next_factor
                                                           )
                                                     / iup.factor
                                                    )
                                           || ' '
                                           || u.unit_name,
                                           ', '
                                          ),
                      3
                     ) AS qty
             FROM item_detail ID JOIN items i ON i.item_id = ID.item_id
                  JOIN item_units_plus iup ON iup.item_id = ID.item_id
                  JOIN units u ON u.unit_code = iup.unit_id
            WHERE CONNECT_BY_ISLEAF = 1
       START WITH iup.rnk = 1
       CONNECT BY iup.rnk = PRIOR iup.rnk + 1 AND ID.serial = PRIOR ID.serial
         ORDER BY ID.serial;
    
    

    When I compile the form, I face the error FRM-30187,

    If I replace my query "select * from items_qty_view" with "select item_id, serial, expiry_date of items_qty_vu", it compiles successfully.

    As salamualikum, Salem,.

    You must follow my instructions carefully.

    1. Select the record group.

    2. go in the record group property

    3. Select and open the column specifications

    4. highlight the column and check the decrease of the length, the bellows of the size that you cross more than 2000 then 2000.

    Compilation of now and you're done.

    Wow. you did.

    Hamid

  • Length of the column of type 'text '.

    Hello. I get various data about the columns of a table using sp_column. Everything works as I expected, except for one thing. When I get the length of a column of data type 'text', it returns the number of 2147483647 when she is supposed to return 16. I played a bit with this issue, and I can't find any relationship, mainly because it is first. Is it possible that I can get the actual length of the table? Thank you.

    The text data type has a maximum length of (2 ^ 31)-1 = 2 147 483 647 characters. This should be what said you as the sp_columns. The DATALENGTH() function should return the length of a specific text, if that's what you're after.

  • Problem of masking and the columns in a datagrid

    Hello

    I noticed that the order in which the values are displayed gets reversed when I hide or show the column in the datagrid control. The robot to hide is triggered when the in button header that is rendered using headerRenderer.The see the feature is triggered when the value in the drop-down list with the name of the appropriate column is selected. If there is no solution to this help me. I tried various possilibilities, but none worked. I develop applications on Flex Builder 3.

    Thank you and best regards,
    Amar.

    Hello

    I thought that this issue was raised in reason to use itemRenderer for individual DatagridColumns. This has been fixed as soon as I use itemRenderer for the entire Datagrid rather than the individual columns.
    Thank you
    Amar

  • Create a join between a column of type DATE and DATETIME RPD

    Hello

    In my DR. I have a fact table with a DATE column, which also contains a component "hour". The physical layer shows this as a DATETIME column that to this DAY, I've changed since I'm only interested in the part of the date.

    When I join it an alias of my Date dimension, the generated sql physics is similar to:

    DIM_DATE. DATE = FACT_A.FINISH_DATE

    What I really want is:

    DIM_DATE. DATE = TRUNC (FACT_A.FINISH_DATE)


    How can I achieve this at the level of the RPD? Yes, I can add a new column to the table of DW with truncated value, but I want to know why even though I chose the DATE as the type of data to the RPD, the created join does not have a trunk.


    Thank you


    Manish

    The physical layer shows this as a DATETIME column that to DATE, I have changed since I was only interested in the part of date.

    N ° bad idea. The physical layer of the RPD should show what the physical source. So if it isn't a DATE, don't pretend OBIEE is it. For the exact reason that you now - tap you are pregnant OBIEE to write some SQL magic to cast the data type, without even say things which is the original type. OBIEE will not interrogate the metadata in order to check the data types in the source, it will rely on what you tell it in the physical layer.

    How can I achieve this at the level of the RPD?

    You could use an inline view in the physical layer and make your trunc here I guess. Better, as you've already identified, is to store the date as a date if this is going to be a key column to reach.

    I want to know why even though I chose the DATE as the type of data to the RPD, the created join is not a trunk.

    See above. OBIEE does not know it is a DATETIME value, then why would he do a TRUNK?

  • How to add events at the bean of type Date

    Hello

    I created two date items - start date and end date.

    now, I want to add the event in these points?

    How can I add event at the bean type date?

    Pls help...

    Thank you
    Amit

    Hello

    Try code below

    Import oracle.cabo.ui.action.FirePartialAction;

    FireAction firePartialAction = new FirePartialAction ("updatedate");
    StartDateBean.setAttributeValue (PRIMARY_CLIENT_ACTION_ATTR, firePartialAction);

    Thank you
    Pratap

  • How to download all the images in the folder to the column of type BLOB (problem of area to create BLOB)

    Hello

    I use JDeveloper 11.1.2.3 version, I need to download all the images in my local folder to the database at a time table. The problem I face is to create BLOBDomain for each of them?

    Best regards,

    Julien

    If you can access the files, that only works if they are on the server, you can read the file and create the domain of the BLOB in the file directly. The technique is the same as in the blob. Only difference is that you pass the file to the method and open the input stream of the file instead of the UploadedFile.

    Timo

  • update the column of type char to stem after insert or update the same column

    I have the table "people":

    DESC PEOPLE
    Name Null? Type
    ------------------------------- -------- ------------
    ID NOT NULL NUMBER
    NAME VARCHAR2 (25) NOT NULL

    and I need to make sure that the NAME column is always in uppercase letters, so I did as he illustrated in this link:
    http://asktom.Oracle.com/tkyte/mutate/

    I did this: -.
    ==================================
    CREATE OR REPLACE TRIGGER parent_bi
    BEFORE THE INSERT OR UPDATE
    ON people
    BEGIN
    state_pkg.newrows: = state_pkg.empty;
    END;
    /
    -----------------------------------------------------------------
    CREATE OR REPLACE TRIGGER parent_aifer
    AFTER INSERT OR UPDATE
    ON PEOPLE
    FOR EACH LINE
    BEGIN
    state_pkg.newrows (state_pkg.newrows.COUNT + 1): =: NEW. ROWID;
    END;
    /
    ------------------------------------------------------------------
    CREATE OR REPLACE TRIGGER HR. PARENT_AI
    AFTER INSERT OR UPDATE
    ON HUMAN RESOURCES. PEOPLE
    REFERRING AGAIN AS NINE OLD AND OLD
    FOR EACH LINE
    BEGIN
    BECAUSE me in 1... state_pkg.newrows.count
    LOOP
    UPDATE of the people
    NAME = UPPER (NAME)
    People WHERE. ROWID = state_pkg.newrows (i);
    END LOOP;
    END;
    /
    ======================================

    but nothing is coming, as the same that these triggers do not exist.

    So, what is wrong?
    and how I workaround to make this statement:-
    Setting a DAY people SET NAME = UPPER (NAME);
    whenever I update or insert in the name column.

    It is much simpler that that - you just need a BEFORE INSERT trigger

    CREATE OR REPLACE TRIGGER your_trigger_name
      BEFORE INSERT OR UPDATE ON persons
      FOR EACH ROW
    BEGIN
      :new.name := UPPER( :new.name);
    END;
    /
    

    As you can see from this example, which will force all uppercase

    SQL> create table persons (
      2    name varchar2(10)
      3  );
    
    Table created.
    
    SQL> CREATE OR REPLACE TRIGGER your_trigger_name
      2    BEFORE INSERT OR UPDATE ON persons
      3    FOR EACH ROW
      4  BEGIN
      5    :new.name := UPPER( :new.name);
      6  END;
      7  /
    
    Trigger created.
    
    SQL> insert into persons values( 'justin' );
    
    1 row created.
    
    SQL> insert into persons select lower(ename) from emp;
    
    14 rows created.
    
    SQL> select * from persons;
    
    NAME
    ----------
    JUSTIN
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    
    15 rows selected.
    

    Also, you generally want to add a check constraint to ensure that NAME = UPPER (NAME).

    Justin

  • Store an Image in the column of type BLOB of a Table

    It is about saving an Image file, a temp_photo table.

    UNDER LINUX, I created the Directory object.
    Step # 1
    SQL > create directory MSGS3 as ' / home/HD/om4000/I_MESSAGES ";
    Created directory.

    Step 2: set up the temp_photo Table.

    SQL > create table temp_photo
    (
    ID NUMBER (3) NOT NULL,
    PHOTO_NAME VARCHAR2 (50).
    PHOTO BLOB
    );
    Table created.

    Step: 3 this is the procedure that I have created to load the file from the file system of the database.

    create or replace PROCEDURE load_file)
    number of P_ID,
    p_photo_name in varchar2) IS
    src_file BFILE.
    dst_file BLOB;
    lgh_file directory.
    BEGIN
    src_file: = bfilename ('MSGS3', p_photo_name);
    -Insert a NULL record to lock
    INSERT INTO temp_photo
    (id, photo_name, photo)
    VALUES
    (p_id, p_photo_name, EMPTY_BLOB())
    RETURN photo INTO dst_file;
    -lock the folder
    SELECT photo
    IN dst_file
    OF temp_photo
    ID WHERE p_id =
    AND photo_name = p_photo_name
    UPDATE;
    -Open the file
    DBMS_LOB. FileOpen (src_file, dbms_lob.file_readonly);
    -determine the length
    lgh_file: = dbms_lob.getlength (src_file);
    -Read the file
    DBMS_LOB. LoadFromFile (dst_file, src_file, lgh_file);
    -update the blob field
    UPDATE temp_photo
    Photo SET dst_file =
    ID WHERE p_id =
    AND photo_name = p_photo_name;
    -close file
    DBMS_LOB. FileClose (src_file);
    END load_file;
    /


    Step 4: when I test it by running the procedure in the following assistance:
    SQL > execute load_file (1, 'Omega5000.jpg');

    I get the following error:

    Error from line 5 in order:
    run load_file(1,'Omega5000.gif')
    Error report:
    ORA-22288: file or LOB FILEOPEN operation failed
    No such file or directory
    ORA-06512: at "SYS." DBMS_LOB", line 805
    ORA-06512: at "HD. Load_file", line 23
    ORA-06512: at line 1
    22288 00000 - "file or LOB operation %s failed\n%s".
    * Cause: Failure of the attempted operation on the file or the LOB.
    * Action: See the following error message in the more detailed error stack
    information. In addition, make sure that the file or LOB exists and that
    privileges are set for the specified operation. If
    the error continues, report the error to the user DBA.

    He said: no such file or directory, but I double checked that the file is located in the same directory and directory is it physically (for which I created the above directory object.)
    Can someone help me where I'm doing something wrong. This is the first time I use the BLOB in my table. Can anyone suggest what's not here.

    >
    He said: no such file or directory, but I double checked that the file is located in the same directory and directory is it physically (for which I created the above directory object.)
    >
    Oracle is disagreeing with you.

    Post your proof that the file exists in the path you provided.

    See this example Oracle-base
    http://www.Oracle-base.com/articles/Misc/HTML-with-embedded-images-from-plsql.php
    >
    CONN / AS SYSDBA
    CREATE or REPLACE DIRECTORY of images AS "/ host /";
    GRANT READ, WRITE on DIRECTORY images TO test;
    >
    Write down everything you missed? Tip: Look at the last character of the DIRECTORY string. Second Tip: See the grant?

    SQL>create directory MSGS3 as '/home/mh/om4000/I_MESSAGES' ;
    
  • Help in the data in the column of row data conversion

    Hi Oracle experts

    I have an output of the table that need to reformat. I want the output to be in an as columns show the OUTPUT REQUIRED article I know someone might have fact/accomplished before too, I tried in the open but could not find one.

    I would be grateful if someone answer this question or guide me how to start or direct me to the thread where this type of question is Huckleberry. I tried to do the rotation but could not get the success.

    Thank you

    Rajesh


    INPUT DATA

    YEAR OF THE SSN
    A1111111 2001
    A1111111 2002
    A1111111 2003
    A1111111 2004
    A1111111 2005
    B2222222 2005
    B2222222 2007
    B2222222 2008
    C3333333 2005
    C3333333 2006

    The REQUIRED POWER

    A1111111 (2001,2002,2003,2004,2005)
    B2222222 (2005,2007,2008)
    C3333333 (2005, 2006)

    Maybe this,.

    SQL> With t As
      2  (
      3  SELECT 'A1111111' SSN, 2001 "YEAR" From Dual Union All
      4  SELECT 'A1111111' SSN, 2002 "YEAR" From Dual Union All
      5  SELECT 'A1111111' SSN, 2003 "YEAR" From Dual Union All
      6  SELECT 'A1111111' SSN, 2004 "YEAR" From Dual Union All
      7  SELECT 'A1111111' SSN, 2005 "YEAR" From Dual Union All
      8  SELECT 'B2222222' SSN, 2005 "YEAR" From Dual Union All
      9  SELECT 'B2222222' SSN, 2007 "YEAR" From Dual Union All
     10  SELECT 'B2222222' SSN, 2008 "YEAR" From Dual Union All
     11  SELECT 'C3333333' SSN, 2005 "YEAR" From Dual Union All
     12  SELECT 'C3333333' SSN, 2006 "YEAR" From Dual
     13  )
     14  SELECT SSN
     15       , '(' || Rtrim(xmlagg(xmlelement(y,"YEAR" || ',').Extract('//text()')),',') || ')' "YEAR"
     16    FROM t
     17   Group BY SSN;
    
    SSN      YEAR
    -------- --------------------------------------------------------------------------------
    A1111111 (2001,2002,2003,2005,2004)
    B2222222 (2005,2007,2008)
    C3333333 (2005,2006)
    

    Kind regards
    Christian Balz

  • value of the column in my data base

    Hi Master,

    I'm running the query to find the value of a column in my diagram below. But when I change user_tab_columns in all_tab_columns, I get the error message.

    I use 11.2.0.1 Oracle version. without the help of xml, we can get the desired result? Please help me.

    Select table_name, column_name

    (select rownum, table_name, column_name,

    dbms_xmlgen. GetXml ('select 1 from "'|") table_name | " » où « ' || column_name |' ("=" & val "') x

    from all_tab_columns where data_type = "VARCHAR2".

    ) where length (x)! = 0 ;

    ORA-19202: an error has occurred in the processing of XML

    ORA-00942: table or view does not exist

    ORA-06512: at "SYS." DBMS_XMLGEN", line 176

    ORA-06512: at line 1.

    How to avoid this error? and how do I get the power requested by the query above? Please notify.

    Concerning

    AR

    Unable to reproduce this scenario, give it a try with this and check if works...

    SELECT owner, table_name, column_name
      FROM (SELECT ROWNUM,
                   owner,
                   table_name,
                   column_name,
                   CONVERT (
                      DBMS_XMLGEN.getxml (
                            'select 1 from "'
                         || owner
                         || '"."'
                         || table_name
                         || '" where "'
                         || column_name
                         || '" =''&val'''),
                      'UTF8',
                      'WE8MSWIN1252')
                      AS x
              FROM all_tab_columns
             WHERE data_type = 'VARCHAR2' AND owner ='SCOTT')
    WHERE LENGTH (X) != 0;
    

    See you soon,.

    Manik.

  • How can I add padding between or in the columns of table data?

    Hello.

    I just updated my Web site.

    http://www.neilsnape.com

    I took all the Flash scrolling tables and put in a table with 1 row and cells (columns) in the form of images.

    I tried to add a class for td to add 3px of padding 3 px margin and a white background. He added space in the design view window, but browsers ignore the fill and or margins.

    .imageTable td {}

    padding-right: 3px;

    background-color: #FFF;

    right margin: 3px;

    }

    I noticed that if I insert blank columns there is a small space, but it looks like there must be something I'm missing.  I can't add cell space in the capable tag, it goes beyond the images.
    What I want to do, it's just having a little white separating the images in the table.
    Thanks in advance.

    Try to put this in your main css file:

    TD > img {margin right: 25px ;}}

    Which will put a margin 25px right of each image that sits in atag.

  • The column by order Date

    How can order us a day column a table like that.



    JAN-2008
    JAN-2009
    FEB-2008
    FEB-2009
    MARCH-2008
    MARCH-2009
    APR-2008
    APR-2009
    MAY-2008
    MAY-2009
    JUNE-2008
    JUN-2009
    JUL-2008
    JUL-2009
    AUGUST-2008
    AUG-2009
    SEVEN.-2008
    SEP-2009
    OCT-2008
    OCT-2009
    NOV-2008
    NOV-2009
    DEC-2008
    DEC-2009

    Try this

    order by to_number(to_char(date_col, 'mm')), to_number(to_char(date_col,'yyyy'))
    
  • How can I permanently get rid of the column "type" in Windows Explorer to optimize my preview of file space

    In order to maximize my preview of the file space, I want to get rid of the column "type". I can tell what kind of file it is. The only thing I need is the update and the file size. Everytime I open a window of Windows Explorer I go to display, add columns and remove types. Everytime I open a new Windows Explorer window, the 'Type' column is back. How can I change the settings to permanently get rid of it?

    Cookjv

    Right-click on an empty space at the top of the column > uncheck type.

    Detached works here.

Maybe you are looking for

  • Satellite C670 - Strange "popping" noise

    Hello I just got a Satellite C670. Overall, I'm happy with it, but it makes a strange noise 'dry' every 5 minutes or so. It seems to come from the right under the keypad.It doesn't seem to affect performance. Any ideas? Thank you Stuart

  • Re: Satelite C850-B516: copy data drive HARD recovery after changing the partitions

    Hello Forum need help once again I split single partition came with my laptop to have data in a separate partition. I wasn't aware that it will affect. I have not created any backup CD. No, when I run HARD drive recovery media creator I get error "NO

  • lost audio beats

    Have a HP Pavilion dv6 running Win 7.  Listen to Pandora in Firefox - went to Beats Audio to adjust sound.  On the Volume screen, I clicked on the white box at the bottom right of the third speaker volume control.  Its order and I can't get it back.

  • Why my windows xp cannot run cs6 portable potoshop?

    Dear Webmasters... After Reinstalling windows xp 2002, I can't run new portable potoshop cs6 and other applications, such as applications that are required to use the .NET framework. And I got the chance to download .NET Framework 3.1, but the applic

  • I would like an answer final re: Defrag in safe mode

    Question: Defrag of can be done in Mode safe?Besides, can 3rd party defragmentation program operate in Mode safe? Such as Auslogics. I think I understand: Yes it can. (I confess that I never did in safe mode.)I would like to have a final response, if