Oracle To_Date

Hello everyone,
I am issuing the following sql statement inside my java program:
insert into area_reqs(c_h, ar_date, status, ar_id, time)
values('p', to_date('2001-09-25', 'yyyy-mm-dd'), 'p', 1078, '12:39:25');
I get the exception ORA-00911 : invalid Character
Could anyone point out why this sql will not work? I have imported oracle.sql.driver.* in my program.
I have been breaking my head over this simple thing. I would really appreciate it if anyone could shed any light.
Thanks,
Dave

It would be helpful to see a code snipet. Off the cuff, I wonder if you are trying to include the ";" in the SQL text. Make sure to use the "[ c o d e ]" and "[ / c o d e ]" (without spaces) around your code when posting it.

Similar Messages

  • Why oracle "to_date" accepts Date-parameters

    I tested out function "to_date" as you see below and I see that Oracle allows me to give to that function parameter with textual data type and also allows to parameter's datatype to be Date.
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    SQL>
    SQL> select to_date(sysdate) as s from dual;--21.10.2010
    S
    21.10.2010
    SQL> select to_date(sysdate, 'DD.MM.YYYY') as s from dual;--21.10.2010
    S
    21.10.2010
    SQL> select to_date('21.10.2010', 'DD.MM.YYYY') as s from dual;--21.10.2010
    S
    21.10.2010
    SQL> select to_date(to_date('21.10.2010', 'DD.MM.YYYY')) as s from dual;--21.10.2010
    S
    21.10.2010
    SQL> I entered into Search engine "http://www.lycos.com/" phrase "oracle to_date function" and it gave me link to documentation of that function:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions183.htm
    and the documentation says:
    >
    Purpose
    TO_DATE converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to a value of DATE datatype.
    >
    My question is: why the function accepts Date data types? what occures behind curtains when Date is passed in? Or what explanation there is, that documentation seems to lie?
    Also, have you too noticed that the forum has been oftenly down near past days?

    Any function that accepts a VARCHAR2 can be passed a DATE. Oracle will simply implicitly cast the DATE to a VARCHAR2 (using the session's NLS_DATE_FORMAT). The same way that it would implicitly cast a NUMBER to a VARCHAR2.
    Of course, if the implicit conversion of the date to a string doesn't match the explicit format mask passed to TO_DATE, you'll have a problem. If your session's NLS_DATE_FORMAT was 'MM.DD.YYYY', for example, the TO_DATE would fail because Oracle would implicitly cast the date to a string in the format MM.DD.YYYY and then try to convert that to a date using the format mast DD.MM.YYYY.
    Justin

  • ** How to use TO_DATE function in Stored Proc. for JDBC in ABAP-XSL mapping

    Hi friends,
    I use ABAP-XSL mapping to insert records in Oracle table. My Sender is File and receiver is JDBC. We use Oracle 10g database. All fields in table are VARCHAR2 except one field; this is having type 'DATE'.
    I use Stored procedure to update the records in table. I have converted my string into date using the Oracle TO_DATE function. But, when I use this format, it throws an error in the Receiver CC. (But, the message is processed successfully in SXMB_MONI).
    The input format I formed like below:
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">
    Value in Payload is like below.
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">TO_DATE('18-11-1991','DD-MM-YYYY')</X_EMP_START_DT>
    Error in CC comes as below:
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_EMP_DETAILS' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('18"
    Friends, I have tried, but unable to find the correct solution to insert.
    Kindly help me to solve this issue.
    Kind Regards,
    Jegathees P.
    (But, the same is working fine if we use direct method in ABAP-XSL ie. not thru Stored Procedure)

    Hi Sinha,
    Thanks for your reply.
    I used the syntax
    <xsl:call-template name="date:format-date">
       <xsl:with-param name="date-time" select="string" />
       <xsl:with-param name="pattern" select="string" />
    </xsl:call-template>
    in my Abap XSL.  But, its not working correctly. The problem is 'href' function to import "date.xsl" in my XSLT is not able to do that. The system throws an error. Moreover, it is not able to write the command 'extension-element-prefixes' in my <xsl:stylesheet namespace>
    May be I am not able to understand how to use this.
    Anyway, I solved this problem by handling date conversion inside Oracle Stored Procedure. Now, its working fine.
    Thank you.

  • Query output based on date - Oracle 8i

    I am trying to write a very simple query to output data based
    on date ranges, but I keep encountering an error.
    When I do this statement:
    select * from my.table
    where startdate > '2008-01-01'
    I get this error:
    [ODBC][Ora]ORA-01861: literal does not match format string
    When I format the select statement this way:
    select * from my.table
    where startdate > #2008-01-01#
    i get this error:
    [ODBC][Ora]ORA-00932: inconsistent datatypes: expected DATE
    got NUMBER
    Currently using CF8, and what I believe is Oracle 8i. I have
    tried formatting this data in many other ways, but can't get it to
    work. I know that when I query the database via access, it has no
    problem returning results with the SQL date formatted like
    #01/01/2008#

    You can use the Oracle to_date() function to convert your
    string to a date/time object:
    select * from my.table
    where startdate > to_date('2008-01-01', 'YYYY-MM-DD')
    Or, since you are using an ODBC connection to Oracle, you can
    try using the ColdFusion CreateODBCDate() function:
    select * from my.table
    where startdate > #CreateODBCDate("2008-01-01")#
    Or, as already suggested, use cfqueryparam with the
    appropriate CFSQLType, such as
    CF_SQL_TIMESTAMP instead of CF_SQL_INTEGER like you are
    attempting to do.
    You can't use a "string" date value against a date/time
    column in an Oracle query, as it won't perform an implicit type
    conversion.
    Phil

  • Passing a CHAR type variable to to_date

    I am loading and transforming some legacy main frame data that stores dates in a Julian format number field, roughly an Oracle RRDDD date format. Some date between 2000 and 2009 drop the leading 0s, for example in 2009, giving a data like 931, which could be Jan 1, 1993 or  Jan 31, 2009. I can stuff a leading zero(s) on the number field to give me '0931' in a char field, which my Oracle top_date will interpret as Jan 31 2009 with the correct mask 'RRDDD." BUT, I cannot find a way to pass my character sting '0931' which is a variable to my my Oracle to_date, which seems to want the enclosing single quotes, even from a character variable:
    Thus
    my_Julian_date = 345  --  Is February14  ,2003, leading 0's not available from legacy source |
                                                                                                                                                        |
    SELECT TO_DATE('00345', 'RRDDD') FROM DUAL    returns 14-FEB-03    OK                     |
    SELECT TO_DATE(345, 'RRDDD')      FROM DUAL    returns 14_FEB-03    OK too              |
                                                                                                                                                        |
    but if I put my date as character into a variable,                                                                        |
    DECLARE my_date VARCHAR2(5);                                                                                         |
    BEGIN                                                                                                                                       |
        my_date   := '00345' ;                                                                                                           |
        SELECT TO_DATE(   my_date, "RRDDD') ... fail to read my_date                                     |          /* please ignore that this select from DUAL won't work */
        SELECT TO_DATE('|| my_date||', "RRDDD') ...                                                                  |            /* with the my_date variable, The issue is to_date accepting a variable value */
    How can a pass a varchar2 or char VARIABLE  with a VALUE like '00345' to TO_DATE?

    Thanks,
    but maybe I wasn't good at my description. My source file has a field cit_dte which is a numeric 5 digit representation of a Julian year of form RRDDD. It drops leading zeros for years 2000 to 2009 and would have a value lke  332 for February 1, 2003, or 4365 for 04365, thus resolving to incorrectlly to 65th day of 1943 or 365th day of 2004 with the leading 0,
    I need to pass a string like 0421  as a char variable value, my_date, rather than a hard coded string, to to_date like ...
                       TO_DATE(my_char_date,'RRDDD')
    rather than TO_DATE('0421','RRDDD')
    In your example, you are hard coding the '00345' into to the my_date VARCHAR2 (5) variable but I have to load my_date from a function call IN variable of numbere type, after converting the IN parameter number type to the my_date varchar2 (5) variable.
    My flow is  (1.)    NUMBER --> (into function ny_date()  as a number type)
                      (2.)  --> convert parameter IN number type to my_date VARCHAR2(5) variable with leading 0s added as needed (in a case statement)
                      (3.) --> pass variable my_date [character string] to  TO _DATE()
    BUT, TO_DATE only seems to accept hard coded character strings. likle '0421' an not a varchar2 variale with a value of 0421. I tried prepedning the parameter into to_date with
    ...to_date:'||my_date||' , RRDDD) to wrap some single quotes aroudnt he my_date variable value, but that does not work.

  • Can we use Evaluate function in Prompt

    Hi all
    Can we use Evaluate Function in Dashboard Prompt?
    I need some exposure on how to use it.
    I am working on a HRMS-OLTP Source where I need to work with Oracle Functions from OBIEE.
    IF somebody can tell me that, It will be a favour for me....
    ThanQ
    Anand V

    Hi All,
    Here's an example of how to use evaluate. This use calls the Oracle TO_DATE function: EVALUATE('TO_DATE(%1,%2)' as DATE, '03/03/2009', 'MM/DD/YYYY')
    Here's how it works: EVALUATE( '<FUNC>' AS <DATATYPE>, VALUE1,VALUE2,etc)
    FUNC) Is the syntax for the function you are calling. Any parameters have to be replaced by %<number>, where number refers to the order in which you specify your parameters.
    DATATYPE) The datatype that the function will evaluate to. In this case, DATE.
    VALUE1) The latter part of the formula is a comma separated list of all the parameters used in the function. In this case, it's the date I want to cast
    VALUE2) This is the second parameter. You need as many as you referenced in your function. In this case, it's the date format.
    Good luck and if you found this post useful, please award points!
    Best regards,
    -Joe

  • How do I use setWhereClauseParam for a date parameter?

    Hello -
    I have a view object with a query like this:
    SELECT column1, column2
    FROM my_table
    WHERE some_date_column = :1
    In the code where I set it I have the date supplied (input from the user from a web page) as a String - "09/17/2004".
    What kind of Date object should I use to pass to setWhereClauseParam? java.util.Date? java.sql.Date? oracle.jbo.domain.Date?
    (Or would it be better to just change the VO query to something like this and just pass the string?
    SELECT column1, column2
    FROM my_table
    WHERE some_date_column = TO_DATE(:1, 'MM/DD/YYYY')
    Thanks

    Scott,
    I have used the addWhereClause directly with no parameters. I'm sure you could also do this with parameters. I choose to "expose" the where clause with the following method which I added to the ViewObjectImpl. The main function is to format the date from the java.util.Date to the Oracle TO_DATE function.
    public void setApprovedDate(Date approvedDate) {
    // add where clause with java.util.date formatted to Oracle to_date format
    SimpleDateFormat sdf = new SimpleDateFormat ("yyyy MM dd HH:mm:ss");
    addWhereClause("WPoliCosts.APPROVED_DATE<=TO_DATE('"+sdf.format(approvedDate)+ "', 'yyyy mm dd hh24:mi:ss')");
    executeQuery();
    }

  • Sort Alphanumeric string in OBIEE answers

    Hi...
    I have a time slot column in my table. I holds data as follows,
    10AM-12PM
    9AM-11AM
    11AM-1PM
    How to sort the report with these column. If i sort it, it was showing data as follows.
    10AM-12PM
    11AM-1PM
    9AM-11AM
    Can u please help to reslove the issue

    If you are specifically trying to use a string function to resolve your issue, then you can try below.
    Pull another slot column in your Answers request and use evaluate function, to derive a timestamp (using oracle to_date funtion) column. Then you can sort this column and hide it in your report.
    Something like below can be used derive timestamp from say '10AM-11AM':
    select to_date(substr('10AM-11AM',1,instr('10AM-11AM','-')-1),'HHAM') from dual --Output 2011-09-01 10:00:00
    Similarly,
    select to_date(substr('10PM-11PM',1,instr('10PM-11PM','-')-1),'HHAM') from dual --Output 2011-09-01 22:00:00
    See if it suits your requirement.
    Thanks

  • Set Query Window default date format to full date

    When I run a query form the the Query Window in Visuial Studios 2012 all the date fields truncated to 'mm/dd/yyyy', but i need the full date returned. I am able to get full date from  TO_char(MyDateField, 'yyyy-mm-dd hh24:mi:ss'), but if I do TO_DATE(MyDateField, 'yyyy-mm-dd hh24:mi:ss')  it only returns  'mm/dd/yyyy'. I'm sure this is a simple setting in Visual studios but I cant find it to save my life. Is there there a way to have the full date returned by default? Thanks!

    San,
    could you be more precise about what do you want to do? If you want to save the date from the form in you database you need to convert it to DATE datatype inside the insert statement in you java code(using oracle to_date function). If you want to save current date/time you can use SYSDATE function in you sql insert statement.
    what do you mean by "automatically fills up the same field in database"? There must be SQL Insert statement inside your java code that does the insert - can you post it here?
    Mike

  • ORA-01858 Convert datetime via Import

    I have tried many format masks to convert a SYBASE datetime to Oracle by using (to_timestamp(field1,'Mon dd yyyy hh:mi:ss:ff3AM')). Can someone give me the correct format.
    Thank you,
    Vito Addotta.

    Hi HarshDhami,
    That error is an Oracle error, not a SQL Server error.  That indicates Date Time Parameter is not a valid date. 
    About Oracle TO_DATE function
    Below shows the TO_DATE function along with the arguments it takes:
    to_date(string)
    to_date(string, date_format)
    to_date(string, date_format, options)
    Please also try the following code,
    select * from work_table where created_date beween to_date('9/18/2015','MM/DD/YYYY') and to_date('03/29/2015','MM/DD/YYYY')
    Actually, your case related to Oracle, if you still cannot resolve, please consider to post in their official site. Thanks for your understanding.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Possible Defect with Crystal and date formating

    Crystal 2008 Oracle 11.1
    I am building functionality to override dates within my Crystal/SP by passing a String as a IN/OUT Parameter from Crystal.
    I have 2 Functions in use that have been tested. The first parses the string and returns a number of database parameters with any overrides passed in the string. The second is a date function that will return a Start date and calculate the End date based on a Frequency Parameter value passed from the first function. (Daily, Monthly,Quarterly) or pass the END date from the string back.
    We are using the Default Oracle Date format of dd-MON-yy (22-SEP-10)
    I am casting my string using the ORACLE To_Date(parsed String value) function and loading it into the array of DATE types that I am passing to the driver SP. In here I am moving the occurane of my array to a LV_Sdate and LV_Edate fields that are defined as DATE.
    Data
    Oracle Dates  copied from the Oracle Table -
    CURR_DT - 23-SEP-10    PREV_DT- 21-SEP-10     OLD_DT - 20-SEP-10
    Using Table Date - PREV_DT Calculating END by Moving Date to Second Array Position returns:
      PRFL_NB_TX       CO_NM               CNTC_NM                        Start Date                 End Date
      xxxxxxxx        XXXX-ACADEMY           ROB TESTNAME       9/21/2010  12:00:0  9/21/2010  12:00:0
    Using Passed Dates Both Start and End  --- OVERRIDE String: 1@1$620360008@BEGDATE$25-SEP-10@ENDDATE$25-SEP-10@
      PRFL_NB_TX       CO_NM                  CNTC_NM                          Start Date                 End Date
      xxxxxxxx        XXXX-ACADEMY           ROB TESTNAME        9/10/25  12:00:00A  9/10/25  12:00:00A
    Using Table and Passed Dates Start - Table, End - Passed  -
    OVERRIDE String: 1@1$620360008@ENDDATE$29-SEP-10@
      PRFL_NB_TX       CO_NM                  CNTC_NM                          Start Date                 End Date
      xxxxxxxx        XXXX-ACADEMY           ROB TESTNAME        9/21/2010  12:00:0  9/10/29  12:00:00A
    Notice the Start and END date YEAR
    Here is where things get a bit confusing as the functions called either read the Database or format the date and Return it in the same DATE array.
    The data provided above was exported as a txt file from a basic Crystal report.
    I can provide Code snipits if needed including native SQLDeveloper exection displays where the date returned to the SP is correct

    This was a date CAST issue in one formula. I had cast all the others in the function and the one missing one was causing the issues.
    Thanks for all who read.

  • Oracle date field not comparing properly with to_date function

    Hi, i'm facing a very weird problem. I'm triyng to retrieve a range of records in between two dates. However, it doesn't seem to understand. What am i doing wrong?
    let's say my table (MYRECORD) has this (where id is varchar and date is DATE and not timestamp) :
    ID DATE
    1 22-JAN-08
    2 22-JAN-08
    3 21-JAN-10
    4 11-FEB-10
    5 11-FEB-10
    So, let's say iwanna get the records from 21st Jan 2010 :
    select
    date as ori_date from MYRECORD where
    date = to_date('21/01/2010','DD/MM/YYYY')
    1.)
    it is not returning any record at all. I'm having problems with between dates and the to_date function as well,
    so i'm trying to get the 'equal' part working first. I can't use to_char because at the end of the day,
    i need to compare between dates.
    what am i doing wrong? has this got anything to do with what kind of format is set up on the oracle server?
    running :
    SELECT value FROM v$nls_parameters WHERE parameter ='NLS_DATE_FORMAT'
    returns DD-MON-RR
    2.) how do we compare dates from the table according to our own specified format from our passed string? I only have READONLY access to this database
    so i can't set anything up.

    please run this
    select To_date(date, 'DD/MM/YYYY HH24:MI:SS') as ori_date from MYRECORDprobably you have hour minute second info in your table, to_date('01012010','DDMMYYYY') means hour, minute and second is 00:00:00 so it wont be equal.The database field type is actually 'DATE' and not datetime. I've also ran the sql you provided to show its timestamp, but it's not showing anything as far as timestamp is concerned. It's showing only the date. So does this mean it's a real date only information?
    However, it might be more efficient to do two comparisons, especially if there's an index on dt:
    WHERE   dt >= TO_DATE ('21/01/2010', 'DD/MM/YYYY')
    AND     dt <  TO_DATE ('22/01/2010', 'DD/MM/YYYY')
    Ok. If we change the range to compare it on the same day, it won't work;
    WHERE   dt >= TO_DATE ('21/01/2010', 'DD/MM/YYYY')
    AND     dt <=  TO_DATE ('21/01/2010', 'DD/MM/YYYY')this also happens if we're using BETWEEN
    this is real weird. It's supposed to work...i don't recall having this kind of issue on other databases. If that's the case,
    each time a user passes me a date string i have to somehow add another day onto its 'to' comparison date in order for things to work.
    but..i don't want to since i don't want to accidentally include the extra day's results!
    Edited by: 803998 on Oct 21, 2010 8:14 PM
    Edited by: 803998 on Oct 21, 2010 8:33 PM

  • To_date function in cursor in oracle 8i

    Please tell me how to use to_date in cursor in oracle 8i. when i m using to_date in where clause in cursor it's giving error to_date function is out of scope.

    CURSOR C1 IS
    SELECT A.XO_NO,to_char(A.XO_DATE,'dd-mm-yyyy') XO_DATE,A.TO_CITY,A.FILE_CODE F_CODE,A.ARR_DATE,A.DEP_DATE,A.VCH_TYPE_CODE,
    A.VCH_NO,A.REMARKS,A.AMOUNT,A.COMP_CODE,to_char(A.SERVICE_DATE,'dd-mm-yyyy')SERVICE_DATE,
    B.AGENT_CODE,B.ROOM_TYP_CODE,
    (B.NO_OF_SINGLE+B.NO_OF_DOUBLE*2+B.NO_OF_EX_BED+B.NO_OF_TWIN*2) NO_OF_PAX,
    B.PER_SR SNGL_BED,B.PER_DR DOUBLE_BED,B.PER_EB TWIN,B.PER_DR EXTRA_BED,B.MEAL_PLAN,
    B.EXCH_RATE,A.FILE_CODE,C.COMP_NAME
    FROM XOS_MS A,QUOT_HOTEL_DS B,AC_COMPANY_MS C
    WHERE A.COMP_CODE=B.COMP_CODE
    AND A.XO_NO=B.XO_NO
              AND A.COMP_CODE=C.COMP_CODE
    AND TRUNC(A.XO_DATE)=TO_DATE('21/03/2005','DD/MM/YYYY');

  • TO_DATE function issue in Oracle 10g R2

    Hi,
    This SQL statement works in Oracle 10g R2 env & Oracle 9i R2.
    SQL>select TO_CHAR(TO_DATE(SYSDATE,'DD/MM/RRRR','NLS_DATE_LANGUAGE = ''AMERICAN'''),'RRRR/MM/DD','NLS_DATE_LANGUAGE = ''AMERICAN''') SYSTEM_DATE
    from dual;
    But after changing the session to Arabic it does not work in Oracle 10g R2 env but works in Oracle 9i R2 env.
    SQL> alter session set nls_language='ARABIC';
    SQL>select TO_CHAR(TO_DATE(SYSDATE,'DD/MM/RRRR','NLS_DATE_LANGUAGE = ''AMERICAN'''),'RRRR/MM/DD','NLS_DATE_LANGUAGE = ''AMERICAN''') SYSTEM_DATE
    from dual;
    Some one please confirm this will not work in Oracle 10g R2 env after altering the session.
    Rgds,

    The error message is:
    ORA-01858: a non-numeric character was found where a numeric was expected.\
    Rgds.

  • Oracle error from to_date in WHERE clause but not in SELECT clause

    If I issue a query like:
    select * from view_1
    where to_date(col1, 'mm/dd/yyyy') > sysdate
    I get an ora-01858 error.
    If I issue a query like
    select to_date(col1, 'mm/dd/yyyy') from view_1
    I don't get any error.
    I've verified the data both visually and using several recommended methods( checking with translate or regular expression), but I can't seem to find any problems with the data.
    Any suggestions for what I should try next?
    cheers,
    dz

    Hi user552575,
    Very strangeNothing mystical, especially if you say that VStudyPatientData is some view. You didn't post its underlying query so one can only guess about what is going on with your queries.
    This is my hypothetical scenario and my guess of what might happen. Consider:
    SQL> create table TStudyPatientData
      2    (SomeKey,
      3     StudyDatasetItemId,
      4     StudyPatientDataValue) as
      5   select rownum,
      6          4232,
      7          '01/12/2008'
      8     from dual
      9  connect by level <= 3;
    Table created.
    SQL> -- Now, let's insert row with incorrect date
    SQL> insert into TStudyPatientData values (4, 4232, 'AA/12/2008');
    1 row created.Here is what we have in TStudyPatientData:
    SQL> select * from TStudyPatientData;
       SOMEKEY STUDYDATASETITEMID STUDYPATIE
             1               4232 01/12/2008
             2               4232 01/12/2008
             3               4232 01/12/2008
             4               4232 AA/12/2008Now, let's create one extra "lookup" table and our hypothetical view:
    SQL> create table SomeTable (x, y) as
      2  select 4232, 4 from dual;
    Table created.
    SQL> create or replace view VStudyPatientData as
      2  select a.*
      3    from TStudyPatientData a
      4   where a.SomeKey <
      5         (select b.y
      6            from SomeTable b
      7           where b.x = a.StudyDatasetItemId);
    View created.It's clear that our simple view will return three rows (row with SomeKey = 4 won't be returned):
    SQL> select * from VStudyPatientData;
       SOMEKEY STUDYDATASETITEMID STUDYPATIE
             1               4232 01/12/2008
             2               4232 01/12/2008
             3               4232 01/12/2008Now, let's see what happens about your queries. This one will succeed:
    SQL> select to_date(StudyPatientDataValue, 'MM/DD/YYYY')
      2    from VStudyPatientData
      3   where StudyDatasetItemId = 4232
      4     and StudyPatientDataValue is not null;
    TO_DATE(S
    12-JAN-08
    12-JAN-08
    12-JAN-08But this one fails, just as in your case:
    SQL> select *
      2    from VStudyPatientData
      3   where StudyDatasetItemId = 4232
      4     and StudyPatientDataValue is not null
      5     and to_date(StudyPatientDatavalue, 'MM/DD/YYYY') > sysdate;
    ERROR:
    ORA-01858: a non-numeric character was found where a numeric was expected
    no rows selectedSo how did this happen? Once we have query execution plans, the answer is obvious. Let's start with "good" query:
    SQL> explain plan for
      2  select to_date(StudyPatientDataValue, 'MM/DD/YYYY')
      3    from VStudyPatientData
      4   where StudyDatasetItemId = 4232
      5     and StudyPatientDataValue is not null;
    Explained.
    SQL> @utlxpls
    PLAN_TABLE_OUTPUT
    | Id  | Operation            |  Name              | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |                    |       |       |       |
    |*  1 |  FILTER              |                    |       |       |       |
    |*  2 |   TABLE ACCESS FULL  | TSTUDYPATIENTDATA  |       |       |       |
    |*  3 |   TABLE ACCESS FULL  | SOMETABLE          |       |       |       |
    Predicate Information (identified by operation id):
       1 - filter("SYS_ALIAS_1"."SOMEKEY"< (SELECT "B"."Y" FROM "SOMETABLE"
                  "B" WHERE "B"."X"=:B1))
       2 - filter("SYS_ALIAS_1"."STUDYPATIENTDATAVALUE" IS NOT NULL AND
                  "SYS_ALIAS_1"."STUDYDATASETITEMID"=4232)
       3 - filter("B"."X"=:B1)
    Note: rule based optimization
    20 rows selected.Take a close look at FILTER operation (with Id = 1). It filters out rows which do not satisfy subquery within a view (where a.SomeKey < (select ... )). Thus, row with incorrect date (AA/12/2008) is simply filtered out.
    But what happens with "bad" query? Let's see:
    SQL> explain plan for
      2  select *
      3    from VStudyPatientData
      4   where StudyDatasetItemId = 4232
      5     and StudyPatientDataValue is not null
      6     and to_date(StudyPatientDatavalue, 'MM/DD/YYYY') > sysdate;
    Explained.
    SQL> @utlxpls
    PLAN_TABLE_OUTPUT
    | Id  | Operation            |  Name              | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |                    |       |       |       |
    |*  1 |  FILTER              |                    |       |       |       |
    |*  2 |   TABLE ACCESS FULL  | TSTUDYPATIENTDATA  |       |       |       |
    |*  3 |   TABLE ACCESS FULL  | SOMETABLE          |       |       |       |
    Predicate Information (identified by operation id):
       1 - filter("SYS_ALIAS_1"."SOMEKEY"< (SELECT "B"."Y" FROM "SOMETABLE"
                  "B" WHERE "B"."X"=:B1))
       2 - filter(TO_DATE("SYS_ALIAS_1"."STUDYPATIENTDATAVALUE",'MM/DD/YYYY')>S
    YSDATE@! AND "SYS_ALIAS_1"."STUDYPATIENTDATAVALUE" IS NOT NULL AND
                  "SYS_ALIAS_1"."STUDYDATASETITEMID"=4232)
       3 - filter("B"."X"=:B1)
    Note: rule based optimization
    21 rows selected.Please notice the second step of the plan (with Id = 2) and the corresponding filtering predicates (especially the one I've marked bold). As we can see, TO_DATE(...) > SYSDATE predicate is evaluated at very first stage, before subquery filtering is done.
    In general, Oracle tries to evaluate single-table predicates first, before evaluating joins and subqueries. In our case, this means that Oracle tries to apply TO_DATE(...) to every row in TStudyPatientData, and it throws exception as soon as it reaches 'AA/12/2008' value.
    Of course, this is hypothetical scenario - I haven't seen your view text so the best I can do is guess.
    However, as you can see, everything is possible with views and, without seeing query plans, it can be hard to understand what is going on.
    Regards.

Maybe you are looking for

  • External hard drive not working in USB multi-port adapter

    Hi, I was wondering if anyone had a suggestion...I got a new My Passport Essential portable external hard-drive. I have a Belkin multi (4) USB adapter and when I plug the hard-drive in, it won't recognize it. It only works if I directly plug it into

  • How can I get Adobe Acrobat 9 Standard installed againg into my notebook Vaio windows7 Pro?

    This Adobe software was preloaded in my Notebook and was unistalled by accident. I've tried to install it using my notebook tools however it doesn't work. I really appreciate your help. Best Regards, Oscar.

  • Select queries

    Hi All, I have a program to be performance tuned. There are select queries on VBAP and BSEG which are taking time. The where condition includes maximum primary keys. But when I checked the data its fetching is very large. I have performance tuned ano

  • Content aware fill

    Wie mache ich eine Inhaltsbasierte Füllung in Photoshop Elements 12 (content aware fill)?

  • Picking request Number Range Assignment

    I am looking for picking request number range assignment?  In Logistics execution we can define the number range, for pciking request but where to assign it?             I request all the SD Guru's to have a look. I find it pretty challenging. Please