SELECT records larger than date specified in sub query

Dear All
Thank you for your attention.
I would like to select records larger than date specified in sub query
query should be something like the following
SELECT my_order_number, my_date, my_task
FROM MYTB
WHERE my_order_number IN order_no AND my_date > date (SELECT order_no, date FROM MySubQueryResult)
 (it is incorrect)
Sub query result:
order_no | date
A1    | 2014-12-21 09:06:00
A2    | 2014-12-20 09:07:00
A3    | 2014-12-20 08:53:00
A4    | 2014-12-20 08:57:00
MYTB:
my_order_number | my_task | my_date
A1  |  T1  |  2014-12-21 09:06:00
A1  |  T2  |  2014-12-22 10:01:00
A2  |  T1  |  2014-12-20 09:07:00
A3  |  T2  |  2014-12-20 08:53:00
A3  |  T4  |  2014-12-21 09:30:00
A3  |  T8  |  2014-12-23 20:32:00
A4  |  T6  |  2014-12-20 08:57:00
expected result:
my_order_number |  my_task | my_date
A1  |  T2  |  2014-12-22 10:01:00
A3  |  T4  |  2014-12-21 09:30:00
A3  |  T8  |  2014-12-23 20:32:00
Any ideas?  Thanks.
swivan

Hi,
try this
SELECT my_order_number, my_date, my_task
FROM MYTB
WHERE my_order_number IN (SELECT order_no FROM MySubQueryResult)
AND my_date > (SELECT date FROM MySubQueryResult)
Alternatively, you can also make use of joins to achieve the same.
Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
Praveen Dsa | MCITP - Database Administrator 2008 |
My Blog | My Page
Dear Praveen Dsa
Thanks for your reply, but order_no and date are paired and related, cannot separate.
each order have its own date, so it is not working
Best Regards
swivan

Similar Messages

  • Selecting records from multiple dates but specific time

    Hi:
    I've to select records of multiple dates but the time should be 00:00:00 to 06:00:00 (i.e. 12 AM - 6 AM)
    For date part this can be done:
    WHERE
    START_TIME BETWEEN TO_DATE('04-01-2012', 'MM-DD-YYYY') AND TO_DATE('04-05-2012', 'MM-DD-YYYY')
    But how can I fix the time mentioed above.
    Please let me know.
    Thanks/Tanvir

    WHERE
    START_TIME BETWEEN TO_DATE('04-01-2012', 'MM-DD-YYYY') AND TO_DATE('04-05-2012', 'MM-DD-YYYY')
    and start_time - trunc(start_time) between 0 and 6/24start_time - trunc(start_time) will give you the fraction of a day. So 6/24 means 06:00.
    (When you use to_char(trunc(sysdate,'hh'),'hh24') between 0 and 6 you will also retrieve records with start_time 06:01 for example. So this would not meet your requirements as far as I understood.)
    Edited by: hm on 10.04.2012 01:26

  • Select Records between Begin Date/Time and End Date/Time

    Hi, I need to select records from table GLPCA where the CPUDT and CPUTM are between a START DATE/TIME and END DATE/TIME. 
    I have the below logic from an SAP Solution, but it doesn't seem to be working right in my opinion.  It is picking up records earlier than the date ranges.  Can anyone tell me how I might be able to accomplish this?  I'm hoping this is an easy one for the ABAPPERs... 
    Thanks,
    START DATE 20091022
    START TIME 125736
    END DATE 20091022
    END TIME 135044
    CPUDT 20091022
    CPUTM 100257
          SELECT * FROM GLPCA
             WHERE ( CPUDT >= STARTDATE AND ( CPUTM >= STARTTIME OR ( CPUDT <= ENDDATE AND CPUTM <= ENDTIME ) ) ).

    Thank you all!  I ended up using the following:
    SELECT * FROM GLPCA
              WHERE RYEAR IN L_R_RYEAR
                AND ( ( CPUDT = STARTDATE AND CPUTM >= STARTTIME ) OR CPUDT > STARTDATE )
                AND ( ( CPUDT = ENDDATE   AND CPUTM <= ENDTIME )   OR CPUDT < ENDDATE ).
    This child was born from the following thread that was found:
    update date and time of client record

  • Customizing Drop Downs, Selection Widths larger than drop down box.

    I have a drop down menu that needs to be a certain width and, in the end, needs to contain a 5 digit value. But, that value is bound to a description, and I want the users to be able to select based on description.
    It's a data drop down, so it has the premade Javascript already and it has display and value bindings to an SQL database, so most of it is set up already, I just need two things:
    How can the selection list that appears be larger than the actual drop down box, so that it accomodates the descriptions instead of the numeric values?
    Can I cause the box to fill with the "value" instead of the "display text" after the description selection has been made?

    The width of the DD is set at design time. Not sure if you can change the width after the form has been rendered. If you can it will be complicated to cycle through each item in the list to get the right length.
    You can have the DropDown display description but submit or report the numeric values. Once that is set it cannot be changed. You can get either value back programatically but once it is set you cannte change it dynamically.

  • Select records with a date greater than today

    Hi,
    I have a table that lists leases, and each lease has an expiration date (stored in three fields; EXPYR, EXPMN, EXPDA).
    I want to create a report that selects just those records that have an expiration date later than the date when the report is run.
    Any ideas?

    Jon,
    I'm assuming that the 3 fields are Year, Month & Day...
    Create a formula...
    Date(EXPYR, EXPMN, EXPDA)
    Then, for your record selection, create the following formula...
    {@DateFormula} > CurrentDate
    HTH,
    Jason

  • Selecting values between 2 dates for an SQL query report region

    I have a region where im selecting between 2 dates
    select hp.NAME, hp.VALUE, hp.UPDATEDATE, hp.DESCRIPTION, hp.UPDATE_COMMENT, hp.HASH, hp.IDCATEGORY
    from HIST_REPORT hr, HIST_PARAM hp
    where hp.dbid = hr.dbid and hr.id = :P7_ID and hp.UPDATEDATE between :P7_BDATE and :P7_EDATE
    The problem is that if I have a row thats dated today (april 1) and if I set the beginning date (BDATE) to april 1 as well as the ending date (EDATE), no rows show and I would like the april 1 row to show. How can I modify my query to fix this?

    and hp.UPDATEDATE between :P7_BDATE
        and decode(:P7_EDATE,:P7_BDATE,:P7_EDATE+1,:P7_EDATE)This assumes, though, that the time component of your items is implicitly 00:00.
    Joel

  • Max (date) in sub-query

    I have an issue with a big view and several queries running on it where the max (date) is required in the sub-select (example below). When I run traces and explain, the perf problem is when the where cluase is evaluated, the view is pulled second time - so I basically use this view twice. The fact that the date in the underlined table is indexed did not help.
    I tried to use "ROW_NUMBER() OVER (ORDER BY date ASC) AS row_number, " rather to select the max(date) in teh sub query but I get only 1 records returned by the query instead the expected about 25,000.
    Need help on how to correct the max(date) to perform better and also to understand how to correct the ROW_NUMBER() not to limit me to 1 row.
    Thanks a lot for the help, Tom
    create view test_date as select * from user_objects;
    select * --(I have specific columns in the real query)
    from test_date t1
    where LAST_DDL_TIME in
    (select max(LAST_DDL_TIME)
    from test_date t2
    where t1.OBJECT_ID=t2.OBJECT_ID --(more clauses to limit the result but not reflecting the problem)
    and t1.OBJECT_NAME =t2.OBJECT_NAME
    and OBJECT_TYPE not in('TABLE')
    group by t2.OBJECT_ID , t2.OBJECT_NAME )

    I got the query to run - with dense ranck and row-Number I get the same results. My partition by cluse was wrong. But the perfromance is not much better.
    Any other idea on how to optimize a query that uses pattern like below and needs to return all rows from a table that have the max enter date.
    Thanks a lot, tom
    Example:
    col1 col2 col3
    1 sysdate 'I need this record'
    2 sysdate 'I need this record'
    3 sysdate 'I need this record'
    4 sysdate 'I do NOT need this record'
    5 sysdate 'I do NOT need this record'
    5 sysdate+3 'I need this record'
    5 sysdate+2 'I do NOT need this record'
    4 sysdate+3 'I need this record'
    4 sysdate+2 'I do NOT need this record'
    4 sysdate+1 'I do NOT need this record'
    My query corrently is using the following construcion:
    select col1, col2 , col3
    from test_table t
    where 1,2,3
    and col3 = (select max(col3) from test_table t2 where t2.col1 = t.col1) group by t2.col1

  • Number of Execution of Sub-Query

    Hi,
    Let suppose we have a SQL which has a sub-query in the filter NOT IN clause as shown below. I wish to know that whether for each record from Table_1 (T1),
    the inner/filter SQL will execute
    or
    It will execute only once for that session (All the records from T1).
    Meaning: Let suppose Table_1 has 5 Million records. So whether the filter/sub-query will be executed 5 Million times by Oracle Engine or It will be executed only once.
    SQL:
    SELECT T1.C1, T1.C2, T2.C3 FROM Table_1 T1
    INNER JOIN
    Table_2 T2
    ON T1.C1=T2.C1
    WHERE T1.C2 = 0 AND
    T1.C4 NOT IN(SELECT DISTINCT COLUMN_12 FROM TABLE_3 WHERE COLUMN_13 = 'VALUE');
    Best Regards,
    Mayur

    It depends on the execution plan. NOT IN can be converted to NOT EXISTS, it can be converted to an ANTI-JOIN.
    If it's converted to a hash (or merge) ANTI-JOIN the subquery is (effectively) executed once, if it's converted to a nested loop anti-join it's (effectively) executed once per row in the driving rowsource. If it's converted to a NOT EXISTS filter subquery it may be executed as much as once per row in the driving row source, it may be executed as little as once per distinct value in the driving row source. (See http://jonathanlewis.wordpress.com/2006/11/06/filter-subqueries/ for an example of the FILTER subquery count
    Regards
    Jonathan Lewis

  • Calculation based on sub query

    Is it possible to base a calculation on a sub query whereby both the calculation sheet and sub query sheet reside on same discoverer workbook?
    This is possible in MS Excel whereby information from one tab can be used in another tab. I am using Discoverer 3.1.44

    Hi
    I'm afraid that Discoverer's use of sub queries is restricted to only using a sub query as a means of further controlling the data that is pulled back.
    It is not possible to use data from a sub query in a calculation, only in a condition. It also makes no difference which version of Discoverer you have because this mode of operation remains the same no matter what version you have (even 10g!!)
    Hope this helps
    Regards
    Michael

  • INI: XOQ-01600: OLAP DML Error "ORA-01438: value larger than specified prec

    I have created a Time dimension in AWM 11.1.0.7.0B.
    I have added two Hierarchies to it. One Hierarchy has All Years, Year, Week, day. The second hierarchy has All Years, Year, Quarter.
    When I maintain the dimension, the following error occurs:
    An error has occurred on the server
    Error class: Express Failure
    Server error descriptions:
    INI: Error creating a definition manager, Generic at TxsOqConnection::generic<BuildProcess>
    INI: XOQ-01600: OLAP DML Error "ORA-01438: value larger than specified precision allowed for this column
    " while executing DML "SYS.AWXML!R11_LOAD_DIM('TIME.ALL_GREGORIAN_YEARS.LEVEL' SYS.AWXML!___R11_LONG_ARG_VALUE(SYS.AWXML!___R11_LONG_ARG_DIM 1) 'TIME.END_DATE.ATTRIBUTE' 'TIME.TIME_SPAN.ATTRIBUTE' 'TIME.LONG_DESCRIPTION.ATTRIBUTE' 'TIME.SHORT_DESCRIPTION.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_END_DATE.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_LONG_DES.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_SHORT_DE.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA1.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA2.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA3.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_LONG_DES1.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_SHORT_DE1.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA4.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_LONG_DES2.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_SHORT_DE2.ATTRIBUTE' 'TIME.GREGORIAN_QUARTER_END_DATE.ATTRIBUTE' 'TIME.GREGORIAN_QUARTER_TIME_SPAN.ATTRIBUTE' 'TIME.GREGORIAN_QUAOLAP DML Error "%(1)s" while executing DML "%(2)s", Generic at TxsOqStdFormCommand::execute
    at oracle.olapi.data.source.DataProvider.callGeneric(Unknown Source)
    at oracle.olapi.data.source.DataProvider.callGeneric(Unknown Source)
    at oracle.olapi.data.source.DataProvider.executeBuild(Unknown Source)
    at oracle.olap.awm.wizard.awbuild.UBuildWizardHelper$1.construct(Unknown Source)
    at oracle.olap.awm.ui.SwingWorker$2.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:595)

    The most likely explanation is that you have a numeric attribute whose data type precision is less than that of the column it is mapped to. For example if you had an attribute with data type NUMBER(2) and you mapped it to a column with data type NUMBER(5), then you could get this error on load. Note that some of the attributes may not be visible in AWM. The offending SQL statement should be in the OUTPUT column of the CUBE_BUILD_LOG, but you may be able to fix this by just describing the view associated with the dimension. For example, here is the description of a TIME view created in 11.2..
      Name                            Null?    Type
    DIM_KEY                             VARCHAR2(60)
    LEVEL_NAME                             VARCHAR2(30)
    MEMBER_TYPE                             VARCHAR2(1)
    DIM_ORDER                             NUMBER
    END_DATE                             DATE
    TIME_SPAN                             NUMBER
    LONG_DESCRIPTION                        VARCHAR2(60 CHAR)
    SHORT_DESCRIPTION                        VARCHAR2(60 CHAR)
    MONTH_END_DATE                         DATE
    MONTH_TIME_SPAN                        NUMBER(5)
    MONTH_LONG_DESCRIPTION                    VARCHAR2(60 CHAR)
    MONTH_SHORT_DESCRIPTION                   VARCHAR2(60 CHAR)
    FISCAL_QUARTER_END_DATE                   DATE
    FISCAL_QUARTER_TIME_SPAN                   NUMBER(5)
    FISCAL_QUARTER_LONG_DESC                   VARCHAR2(60 CHAR)
    FISCAL_QUARTER_SHORT_DES                   VARCHAR2(60 CHAR)
    FISCAL_YEAR_END_DATE                        DATE
    FISCAL_YEAR_TIME_SPAN                        NUMBER(5)
    FISCAL_YEAR_LONG_DESCRIP                   VARCHAR2(60 CHAR)
    FISCAL_YEAR_SHORT_DESCRI                   VARCHAR2(60 CHAR)
    CALENDAR_QUARTER_END_DAT                   DATE
    CALENDAR_QUARTER_TIME_SP                   NUMBER(5)
    CALENDAR_QUARTER_LONG_DE                   VARCHAR2(60 CHAR)
    CALENDAR_QUARTER_SHORT_D                   VARCHAR2(60 CHAR)
    CALENDAR_YEAR_END_DATE                    DATE
    CALENDAR_YEAR_TIME_SPAN                   NUMBER(5)
    CALENDAR_YEAR_LONG_DESCR                   VARCHAR2(60 CHAR)
    CALENDAR_YEAR_SHORT_DESC                   VARCHAR2(60 CHAR)You can get the same information from user_cube_attributes
    SQL> select attribute_name, data_precision from user_cube_attributes where dimension_name = 'TIME' and data_type = 'NUMBER';
    ATTRIBUTE_NAME                 DATA_PRECISION
    TIME_SPAN
    MONTH_TIME_SPAN                    5
    FISCAL_QUARTER_TIME_SPAN              5
    FISCAL_YEAR_TIME_SPAN                   5
    CALENDAR_QUARTER_TIME_SPAN              5
    CALENDAR_YEAR_TIME_SPAN               5

  • Dump with ORA-01438: value larger than specified prec

    Hello All,
    I am getting a dump in production with the above said error and the ST22 gives me further analysis that
    "If the error occurred in Open SQL, there is probably an inconsistency
    between the NAMETAB and the ABAP/4 Dictionary.                      
    Compare the length specifications of the fields in the NAMETAB with 
    those in the ABAP/4 Dictionary and contact someone who is able to   
    perform a consistency check and eliminate the problem.              
    In most cases, this person will be your SAP consultant.             
    Please make a note of the actions and input which caused the error. 
    Please make a note of the actions and input which caused the error. 
    To resolve the problem, contact your                                
    SAP system administrator.                                                                               
    Choose "Print" for a hard coopy of the termination message. You can 
    display and adminster short dump messages using Transaction ST22.                                                                               
    Error analysis                                                                               
    The problem has arisen because, within the database interface,      
    one of the data buffers made available for the INSERT (UPDATE)      
    is longer than the maximum defined in the database.                 
    On the other hand, it may be that the length in the NAMETAB         
    does not match the maximum length defined in the database.          
    (In this case, the length in the NAMETAB is longer.)                 "
    First time it gave me one record so I dropped that record and again executed the program but next time it gave me other record.
    So I am not sure it is related to data error or database error. I can not debug the program in production and dev also as it is difficult to repeat the data in dev.
    Any clues on this ?
    Thanks in advance
    Sameer

    Looks like a precision error:
    ORA-01438: value larger than specified precision allowed for this column
    Cause: When inserting or updating records, a numeric value was entered that exceeded the precision defined for the column.
    Action: Enter a value that complies with the numeric column's precision, or use the MODIFY option with the ALTER TABLE command to expand the precision.
    Rob

  • Strange ORA-01438: value larger than specified precision...error

    When i issue a query like
    SELECT * FROM shp_dtls WHERE shp_locn='AL';
    i get the error
    ORA-01438: value larger than specified precision allowed for this columnWhy do i get an error like this for a SELECT query. Isn't this an INSERT related error?

    Normally this error happens on INSERT or UPDATE statement. There are 2 possibilities I think for it to happen on SELECT:
    1) your FGA policy defined on select for this table that inserts data into wrong column (you should also be getting the violating procedure name in your error message);
    2) wrong data has been inserted into table using OCI (in which case Oracle does not verify data correctness) or corrupted export file was impored.

  • ORA-01438: value larger than specified precisio

    Hi All,
    I have a problem when using OCCI.
    Oracle DB table A has one column, data type is NUMBER(10,0).
    c++ code>>
    Query from table
    rs = stmt->executeQuery(...select * from A...);
    long long n = (long long)(long double)rs->getNumber(1);
    Insert to table-
    Number nVal= Number((long double)n);               
    stmt->setNumber(1, nVal);
    --Error: ORA-01438: value larger than specified precisio
    How shall I do this insert(c++ data type is long long, DB column data type is NUMBER(10, 0))?
    Message was edited by:
    user591149

    Try to convert __int64 to std::string, then
    Number num = 0;
    num.fromText(env, strNumber, '999999999999');
    and use this occi Number in your statement.

  • CDC Failed with Error ORA-01438: value larger than specified precision

    Hi,
    I have created Asynchronous Distributed Change Data Capture Set-up as per the Guildines from Oracle.
    Now My Change Set has become Invalid with error: ORA-01438: value larger than specified precision allowed for this column.
    I Compared Change Table Structures with Source Table on Source Database and the structure is matching.
    Now I am trying to Run below script:
    Begin
    dbms_cdc_publish.alter_change_set (Change_Set_name =><<Change Set Name>>,
    recover_after_error => 'Y'
    End;
    I am getting the below error:
    ORA-01438: value larger than specified precision allowed for this column
    ORA-06512: at "SYS.DBMS_APPLY_ERROR", line 147
    ORA-06512: at "SYS.DBMS_APPLY_ERROR", line 301
    ORA-06512: at "SYS.DBMS_APPLY_ADM", line 490
    ORA-06512: at line 1
    ORA-06512: at "SYS.DBMS_CDC_PUBLISH", line 580
    ORA-06512: at line 2
    Still the error is existing, I couldn't find any issues with Change Table structure as it is in Line with Source Table Structure.
    Can anyone please help me on this.
    Staging Database details:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    TNS for Linux: Version 10.2.0.4.0 - Production
    Source Database details:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    TNS for HPUX: Version 10.2.0.4.0 - Production
    Also Can anyone let me know if it is possible to run CDC Set-up without DBA Privileges. i,e once the CDC Set-up is done, if we revoke the DBA Privilege will the Capture work properly. I know that for creating Change Table, Set and Source we require DBA Access. But once the set-up is done, do we really require DBA Privileges?
    Thanks,
    Shashi
    Edited by: user8254952 on 09-Mar-2010 05:57
    Edited by: user8254952 on 09-Mar-2010 06:00

    Hi Shashi,
    As CDC is built on top of Oracle streams framework, for better responses you can post this ques under {forum:id=70} category.
    "ORA-01438: value larger than specified precision allowed for this column" is usually encountered for NUMBER datatype columns. At what level did you check the datatypes? Please confirm if the precision(for NUMBER datatype) are also similar.
    Please attach output for the following queries:
    select error_message from dba_capture;
    select error_number, error_message from dba_apply_error;Please re-validate the data types and then run the same API with remove_ddl = 'Y' option, like this:
    exec DBMS_CDC_PUBLISH.ALTER_CHANGE_SET(change_set_name=>'CHANGE_SET_NAME' , recover_after_error=>'Y' , remove_ddl=>'Y');
    Hope it helps!
    Cheers,
    AA

  • Selecting records which are greater than or of current week

    Hi I have a table having table structure
    CREATE TABLE OMPPRODUCTION
    LOCATIONID VARCHAR2(200 BYTE) NOT NULL ,
    IPC VARCHAR2(200 BYTE) NOT NULL ,
    PRODUCTIONWEEK VARCHAR2(200 BYTE) NOT NULL ,
    QUANTITY VARCHAR2(2000 BYTE) ,
    PRODUCTIONCODE VARCHAR2(2000 BYTE) ,
    MOULDQUANTITY VARCHAR2(2000 BYTE) ,
    SOURCE VARCHAR2(2000 BYTE) ,
    APPLICATION VARCHAR2(2000 BYTE) ,
    COMMENTS VARCHAR2(2000 BYTE) ,
    TLM DATE ,
    ADSTAT CHAR(1 BYTE) ,
    SID NUMBER(10, 0) ,
    SECURITYLEVEL VARCHAR2(100 BYTE) ,
    CONSTRAINT OMPPRODUCTION_PK PRIMARY KEY ( LOCATIONID , IPC , PRODUCTIONWEEK ) ENABLE
    It has field PRODUCTIONWEEK which is having data as YYYYMMDD.
    I want to select records which are starting from current week(Monday as starting Day).
    eg Current Day is 20120210 so i would select rows having date more than or equal to 20120206.
    Can anyone guide me how it can be achieved ?
    Edited by: MaheshGx on Feb 6, 2012 4:16 PM

    Hi,
    Boneist wrote:
    ... Wow, why so complicated? ...
    So, taking account of the fact your column isn't DATE datatype, this would be more efficient for you;
    select *
    from   ompproduction
    where  trunc(to_date(productionweek,'yyyymmdd'), 'iw') >= trunc(sysdate, 'iw');
    This will be even less complicated and more efficient:
    select *
    from   ompproduction
    where  to_date(productionweek,'yyyymmdd') >= trunc(sysdate, 'iw');However, given that OP is stuck with a VARCHAR2 column, I would suggest:
    SELECT *
    FROM   ompproduction
    WHERE  productionweek     >= TO_CHAR ( TRUNC (SYSDATE, 'IW')
                                     , 'yyyymmdd'
    ;Instead of calling TO_DATE for every row in the table, this calls TO_CHAR only once.
    Also, when there is invalid data (which is very likely when using a VARCHAR2 column to store dates), this will not raise an error.
    OP: Note that this only works because the sort order of your VARCHAR2 column corresponds to the sort order you want. If February 6, 2012 were stored as '02/06/2012' or '06-FEB-2012', then you'd have to use TO_DATE on every row.
    Boneist's main point is right.
    Dates belong in DATE columns. If you're getting the data from a file, convert the strings to DATEs when the table is populated.

Maybe you are looking for