To_date,to_char function behavior

I have a table that contains starting dates of employment for employees. Since the table could have several starting dates (This is normal in our institution), I wrote a pl/sql loop to count the number of employees whose ONLY starting date (meaning they have only one starting date) lies in the year 2008. Now I faced the following problems when running the code in a when-button-pressed trigger in forms:
1. the counter in the statement
if to_char(docexecdt,'dd-mm-yyyy) between '1-1-2008' and '31-12-2008' then x:=x+1
returned an abnormal number (too large for the size of the table)
(where docexecdt is the field containing the starting date)
is using to_char here incorrect?
2. the statement
if to_date(docexecdt) between '1-1-2008' and '31-12-2008' then x:=x+1
returned an error "invalid month"
although I tried several date formats.
given that I tried running the same to_date function on the table in sql*plus with no error returned.
What is the correct format mask for the to_date function?

-> Why does the to_char(docexecdt,'dd-mm-yyyy') return an incorrect result?
Because putting dd (the day of the month) first puts EVERY day between your dates:
01-01-2008 is LESS than ALL the following dates:
01-02-1982
12-01-2000
15-08-1998
30-01-2009
30-12-2020
31-12-2008 is GREATER than ALL the above dates.
NEVER compare dates by placing DAY or MONTH before the year!!!!
When you compare using DDMMYYYY format, the only dates less than 01-01-2008 are January 1 of any prior year. The only dates greater than 31-12-2008 are 31-December of any year greater than 2008.
The correct way to find your count is given by Paul M, where you ONLY look at the year.

Similar Messages

  • What is the use of To_date, to_char functions?

    what is the use of To_date, to_char functions?
    while i am using these in my day to day activities but never able to know the exact working of tehse.
    Message was edited by:
    437022

    Dates are stored and manipulated as coded (binary) values that always contain "century, year, month, date, hour, minute second"
    We don't want to see the date as stored. We want to see the characters (digits) that make up the date. So we use to_char(the-date-value)
    We want to tell the system a date, but have a heck of a time entering the binary. So we input the characters (digits) that make up the date and tell the system to convert that to a binary 'date' using to_date(our-string-that-respresents-dates)
    The magic Oracle has added is the format codes (see chapter 2 of the SQL Reference manual for the complete list). We can get the system to print out dates and times, including day of week (and so on) using format codes.
    The default format is to show us the date but not the time. Which leads a lot of people to believe that the time is not stored.

  • Behaviour of to_char function in sqlplus versions 8.1.6.0.0 and 9.0.1.3.0 .

    Behavior of to_char function in sqlplus versions 8.1.6.0.0 and 9.0.1.3.0:
    Hello,
    We are migrating our apps between different environments and we observed the following behaviour:
    When using the command select to_char(sysdate,'D') from dual, this gives out a value of 4 in sqlplus version 8.1.6.0.0 (win NT). The same command gives out a value of 3 in sqlplus version 9.0.1.3.0 (win XP).
    The underlying software is Oracle Enterprise Edition Release 8.1.7.4.0 in both the cases. Why this difference in behaviour? Can anyone please advise me.
    regards,
    Srikanth

    The first day of week depends on the globalization parameter NLS_TERRITORY. Set it for the instance or for the session to AMERICA to get the week start on sunday. You can also set this in the NLS_LANG os variable (export NLS_LANG=american_germany.we8iso8859p1)
    SQL> alter session set nls_territory='germany'
    SQL> select to_char(sysdate, 'Day D') from dual;
    TO_CHAR(SYS
    Wednesday 3
    SQL> alter session set nls_territory='america';
    SQL> select to_char(sysdate, 'Day D') from dual;
    TO_CHAR(SYS
    Wednesday 4Kind regards
    Laurent Schneider
    OCM-DBA

  • Reg: error while converting a date datatype to the char using TO_CHAR function.

    Hello all,
    I'm trying to convert a date datatype to the specified format (i.e., by using vaariable using the to_char function in my sql,
    SQL:
    select 0 dummy,'select' from dual
    union all
    select a.COLUMN_ID dummy,
    (case a.DATA_TYPE when 'NUMBER' then '''''' || '||' || a.COLUMN_NAME || '||'',''||'
                      when 'DATE' then '''"''' || '||' || TO_CHAR(a.COLUMN_NAME,'&dateformat') || '||' || '''",''' || '||'
                      else '''"''' || '||' || a.COLUMN_NAME || '||' || '''",''' || '||'
                end)
    from DBA_TAB_COLUMNS a
    where a.OWNER = upper('&owner_name')
    and a.TABLE_NAME = upper('&table_name')
    union all
    select 998 dummy,''' ''' from dual
    union all
    select 999 dummy,'from &owner_name..&table_name;' from dual
    order by dummy
    error:
                      when 'DATE' then '''"''' || '||' || TO_CHAR(a.COLUMN_NAME,'DD-MM-YYYY') || '||' || '''",''' || '||'
    ERROR at line 5:
    ORA-01722: invalid number
    Please help me in resolving this, Thanks in advance.
    Regards,
    Konda.

    > ISA Server is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests. (12204)
    This seems to be your specific network configuration.  It seems that your corporate network is blocking HTTPS requests which don't use port 443. Your ABAP system is configured to use a port other than 443. Either talk to your basis admins about changing your ABAP system configuration to use port 443 or talk to your network administrators to allow whichever port the ABAP system is running on.

  • Need help in to_char function

    Hi All,
    I'm using below sql query to get sysdate with time stamp.
    select to_char(sysdate,'YYYYMMDD HH24:MM:SS') from dual
    This gives me below result:  20130816 05:08:49
    Strangely, when I keep on running the same query, I notice after 60 seconds are complete, time stamp starts with  20130816 05:08:01 again.
    Am i missing something here..
    Thanks in advance

    Karthick_Arp wrote:
    Keep a simple thing in mind. Date stored in the DB does not have any format. Format need to be applied while you display. The default date format is specified by the NLS_DATE_FORMAT parameter. You have used TO_CHAR to display date in a specific format. But the problem is that you have converted DATE into string. So if its just for display purpose then set the NLS_DATE_FORMAT, do not use TO_CHAR.
    With respect to your issue You need to represent Minute as MI. You have represented it as MM (Month) That's why you see 08 always.
    " the problem is that you have converted DATE into string"
    No, the problem was that he was explicitly using an incorrect format mask, specifying months where he should have specified minutes.
    The problem inherently cannot be the result of converting a DATE into a string.  Dates are always converted to strings for presentation, either implicitly by using the controlling setting of NLS_DATE_FORMAT (which can be set at several levels) or explicitly by using the to_char function.  Oracle will always convert.  It has to.  Internally, a date is binary gibberish.  But computer screens and printers can only show strings of characters, so the DATE will be converted to a character string, by hook or by crook.  And the method of oracle making that conversion is exactly the same.  The only thing that varies is how the user chooses to make that specification.  And "not choosing" (by not using the to_char function) is still choosing ... choosing to rely on nls_date_format.

  • To_char function help

    Hi All,
    I have run this query in my oracle database
    SELECT
    J.NAME,
    (CASE J.STATUS WHEN 'Completed' THEN COUNT(J.STATUS) ELSE 0 END) CURRENT_MONTH_COMPLETE,
    (CASE J.STATUS WHEN 'Pending for Process Engine' THEN COUNT(J.STATUS) ELSE 0 END) CURRENT_MONTH_IN_PROGRESS
    FROM
    CMN_SCH_JOBS_V J
    WHERE
    J.STATUS IN ('Completed','Pending for Process Engine') AND J.LANGUAGE_CODE='en'
    and to_char(J.START_DATE,MM')=12
    GROUP BY J.NAME,J.STATUS;I have a doubt regarding this
    to_char(J.START_DATE,MM')=12Basically to_char() function returns a string value, but when it is equated against a numeric value oracle should raise an error right, this query is running fine. Please tell why this is happening.
    Regards
    Praveen Vuppalapati

    What a strange query. I'd expect it to be either:
    SELECT
    J.NAME,
    J.STATUS
    COUNT(*)
    FROM
    CMN_SCH_JOBS_V J
    WHERE
    J.STATUS IN ('Completed','Pending for Process Engine') AND J.LANGUAGE_CODE='en'
    and to_char(J.START_DATE,MM')=12
    GROUP BY J.NAME,J.STATUS;... or ...
    SELECT
    J.NAME,
    SUM(CASE J.STATUS WHEN 'Completed' THEN 1 ELSE 0 END) CURRENT_MONTH_COMPLETE,
    SUM(CASE J.STATUS WHEN 'Pending for Process Engine' THEN 1 ELSE 0 END) CURRENT_MONTH_IN_PROGRESS
    FROM
    CMN_SCH_JOBS_V J
    WHERE
    J.STATUS IN ('Completed','Pending for Process Engine') AND J.LANGUAGE_CODE='en'
    and to_char(J.START_DATE,'MM')=12
    GROUP BY J.NAME;Ought to wrap the to_char() in a to_number as well, really.

  • Difference between storing sysdate and to_date(to_char(sysdate, 'DD Mon YYY

    What is the difference between storing sysdate or to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM') in a date data type column?
    When I column value is set with sysdate the following query gives no records
    select *
    from Test
    WHERE Updatedon = to_date('22 Sep 2012 07:55 PM','DD Mon YYYY HH:MI AM');
    when I run the same query with out where clause I am getting the records with that time or storing with to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM') gives records.
    Can someone explain the difference please?

    Hi,
    Welcome to the forum!
    user8765044 wrote:
    What is the difference between storing sysdate or to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM') in a date data type column?Remember that all DATEs include hours, minutes and seconds , as well as year, month and day.
    to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM')is equivalent to
    TRUNC (SYSDATE, 'MI')To see why, consider what
    to_char(sysdate, 'DD Mon YYYY HH:MI AM'),does. It creates a string out of the year, month, day, hours and minutes of SYSDATE, but it ignores the seconds. If you convert that string into a DATE, the seconds will default to 00.
    When I column value is set with sysdate the following query gives no records
    select *
    from Test
    WHERE Updatedon = to_date('22 Sep 2012 07:55 PM','DD Mon YYYY HH:MI AM');
    when I run the same query with out where clause I am getting the records with that time or storing with to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM') gives records.Whenever you get confusing results with DATEs, display the full DATE, including hours, minutes and seconds.
    To change the default DATE format in your session, so that the hours, minutes and seconds appear automatically, use ALTER SESSION. For example:
    ALTER SESSION  SET NLS_DATE_FORMAT = 'DD-Mon-YYYY HH:MI:SS AM';

  • TO_CHAR FUNCTION IN ORACLE FORM

    HI,
    Table called A has column name col1
    col1
    12563.563
    52685.563
    05263.540
    I would like to use SUBSTR(col1,2,6) for insert values from A table to B table by Oracle form and following values are inserted in B table
    2563.5
    2685.5
    263.4
    If I use SQLPLUS it is inserting as my requirement like
    2563.5
    2685.5
    5263.4
    Third row should be 5263.5 instead of 263.4. In Oracle form may have internal coversion function to convert character value to number values, I do not want to convert the value to number. Both table columns are varchar2 column.
    What is the equal to_char function in Oracle form. If it is NLS_NUMERIC_CHARACTERS, please what are the parameters to be passed along with column.
    Thanks in advance
    Saravanan.

    Hello,
    If you don't want to take account any calculation on the decimal part, you could consider the Trunc() function instead of the To_Char():
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> select to_char(52685.563,'00000000.0'), trunc(52685.563,1) from dual
      2  /
    TO_CHAR(526 TRUNC(52685.563,1)
    00052685.6            52685.5
    SQL> Francois

  • TO_DATE(TO_CHAR(sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY')

    Hi all,
    I am working with a Oracle 9i R2 database
    SQL>select TO_CHAR(sysdate, 'MM/DD/YYYY') CHRDATE from dual;
    CHRDATE
    11/14/2005
    SQL>select TO_DATE(TO_CHAR(sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY') mydate from dual;
    MYDATE
    14-NOV-05
    I want to retain the 4 digit year. Please suggest what I am doing incorrect.
    Thanks

    Your select statement,SQL>select TO_DATE(TO_CHAR(sysdate,...is equivalent toselect sysdate...And whenever you select a date, SQL Plus has to convert it to a character format before it can display it on the SQL Plus output screen.
    The four-digit year IS being retained internally ...until you display it on the screen. If you just set the default date format for displaying dates to include the four-digit year, you will see the full year:
    SQL> select SYSDATE mydate from dual;
    MYDATE
    14-NOV-05
    SQL> alter session set nls_date_format = 'MM/DD/YYYY';
    SQL> select SYSDATE mydate from dual;
    MYDATE
    11/14/2005
    SQL> select TO_DATE(TO_CHAR(sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY') mydate from dual;
    MYDATE
    11/14/2005

  • To_date(to_char(sysdate,'dd/mm/yyyy hh24:mm'),'dd/mm/yyyy hh24:mm')

    Hi
    I am using this conversion to_date(to_char(sysdate,'dd/mm/yyyy hh24:mm'),'dd/mm/yyyy hh24:mm')
    but it says format string appears twice
    Could some one please help me with this?

    user11365275 wrote:
    I have a requirement for taking hh:mi from a date ..ie i need to compare two dates till hrs and mins level but not secs..so i was trying to take the date till hrs,mins and then convert to dates and compare them...Exactly this is my requirement
    to_date(TO_CHAR(LOAD_DATE,'DD/MM/YYYY HH24:Mi'),'DD/MM/YYYY HH24:Mi')
    <(SELECT to_date(TO_CHAR(CURRLOADTIME,'DD/MM/YYYY HH24:Mi'),'DD/MM/YYYY HH24:Mi')
    FROM Table1 WHERE
    JOBNAME='DEFAULT_EVENT_LOG');
    PLease can you suggest anything better than this comparison or let me know if this works correct nowYou are using a TO_CHAR to format a date field in a string. Then use a TO_DATE to change it back to a date. This "double" formatting is a deep misunderstanding about what is a date field.
    If you want to compare dates and get rid of the seconds, use truncate, for instance :
    SQL> select trunc(sysdate,'mi'),sysdate from dual;
    TRUNC(SYSDATE,'MI') SYSDATE
    02/02/2010 09:18:00 02/02/2010 09:18:55Your WHERE clause will become :
    ...trunc(LOAD_DATE,'mi')<(SELECT trunc(CURRLOADTIME,'mi')...Nicolas.

  • Error in result of To_Char function.

    Hi,
    My name is Ramanujulu, I was practicing Date functions and found one error in one of the To_Char functions.
    Please assume the sysdate as 19th Decmber 2006. (I used this date in example)
    SQL> select to_char(sysdate-7, 'ddspth-month-syear') from dual;
    TO_CHAR(SYSDATE-7,'DDSPTH-MONTH-SYEAR')
    twelfth-december - two thousand six
    It returns the 12th as twelfth. (Additional letter F). Who will correct this and how do i make this change in my Database.
    Please let me know how to correct this.
    Thanks,
    Ramanujulu B.

    http://dictionary.reference.com/browse/twelfth

  • Trouble getting a timestamp formatted by a 'to_char' function

    We have trouble getting a timestamp formatted by a 'to_char' function and a 'group by'
    for a count. By assigning the result of the to_char function to an attribute and
    grouping on that attribute, we try to get the frequency of an event.
    What happens is a non predictable 'IllegalArgumentException' on
    'Timestamp.class' while getting the timestampvalue.
    We make use of a scrollablecursor as you can see in the stacktrace.
    java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
    at java.sql.Timestamp.valueOf(Timestamp.java:160)
    at oracle.sql.CHAR.timestampValue(CHAR.java:567)
    at oracle.jdbc.driver.ScrollableResultSet.getTimestamp(ScrollableResultSet.java:658)
    at oracle.toplink.oraclespecific.Oracle9Platform.getObjectFromResultSet(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.getObject(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.fetchRow(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.cursorRetrieveNextRow(Unknown Source)
    at oracle.toplink.queryframework.ScrollableCursor.retrieveNextObject(ScrollableCursor.java:512)
    at oracle.toplink.queryframework.ScrollableCursor.loadNext(ScrollableCursor.java:357)
    at oracle.toplink.queryframework.ScrollableCursor.hasNext(ScrollableCursor.java:233)
    After restarting the application server there is a chance that the query returns
    with the expected results. But most of the times it just returns the above
    mentioned exception.
    I don't see the logic in the apparently random parsing of the value.
    The column in the database is a timestamp, but that the reason why i'm using the
    to_char method.

    This is a bug in TopLink with ReportQuery. Please report this is Oracle technical support. Basically TopLink is converting to the attribute type, but should not be if a function was applied to the expression.
    To workaround the issue you can use getField(/) in the expression instead of get(/) (using the database field name instead of the class attribute name).

  • Unusual result with TO_CHAR function on a date

    Can anybody explain to me why I see two different results if I use the following SQL in PL/SQL Developer (Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)? I'm not sure if I have a wrong setting in Oracle or PL/SQL Developer, or if I'm just misunderstanding how the TO_CHAR function works. Many thanks.
    select sysdate, to_char(sysdate, 'dd/mm/yyyy hh:mm:ss') as FORMATTED_DATE from dual
    Results:
    SYSDATE
    10/02/2009 16:52:32
    FORMATTED_DATE
    10/02/2009 04:02:32

    select sysdate, to_char(sysdate, 'dd/mm/yyyy hh:mm:ss') as FORMATTED_DATE from dual
    Results:
    SYSDATE
    10/02/2009 16:52:32
    FORMATTED_DATE
    10/02/2009 04:02:32It should not be -> mm it should be mi .
    Got me?
    Regards.
    Satyaki De.

  • TO_CHAR Function Format Argument Limit

    I was curious if there is a limitation to the length of the string used as the Format argument in the TO_CHAR Function? If so, how long is it?

    I couldn't find it in the documentation, but it appears at first glance to be 63 for numbers with a simple format mask. You could experiment with the others:-
    SQL>
    SQL> DECLARE
      2     v1 VARCHAR2(32767);
      3     v2 VARCHAR2(32767);
      4  BEGIN
      5     FOR i IN 1 .. 32767 LOOP
      6        BEGIN
      7           v1 := v1 || '9';
      8           SELECT TO_CHAR(1,v1) INTO v2 FROM dual;
      9        EXCEPTION
    10           WHEN OTHERS THEN
    11              DBMS_OUTPUT.PUT_LINE(
    12                 'Maximum length of format mask for ' ||
    13                 'numbers is [' || TO_CHAR(i-1) || ']'
    14                 );
    15              RETURN;
    16        END;
    17     END LOOP;
    18  END;
    19  /
    Maximum length of format mask for numbers is [63]
    PL/SQL procedure successfully completed.
    SQL> SELECT TO_CHAR(1, '99999999999999999999999999999999999999999999999999999999999999') as sixty_two
      2  FROM   dual;
    SIXTY_TWO
                                                                  1
    SQL> SELECT TO_CHAR(1, '999999999999999999999999999999999999999999999999999999999999999') as sixty_three FROM dual
      2  /
    SIXTY_THREE
                                                                   1
    SQL> SELECT TO_CHAR(1, '9999999999999999999999999999999999999999999999999999999999999999') as sixty_four FROM dual
      2  /
    SELECT TO_CHAR(1, '9999999999999999999999999999999999999999999999999999999999999999') as sixty_four FROM dual
    ERROR at line 1:
    ORA-01481: invalid number format modelRegards
    Adrian

  • Orcl:query-database gives error when using to_char function in select stmt

    hi
    Use Case : We get a csv file ("bank_import_<MMDDYYYYY>.csv") from the bank containing the transactions occured for the month. The date in the filename is retrieved into string and i need to convert this string to the format "MON-DD-YYYY". This is the required format for an header table which takes this string as primary key.
    Code:
    statement_name = '11302206'.........
    <copy>
    <from expression="concat("'select to_char(to_date('",bpws:getVariableData('statement_name') ,"','MMDDYYYY'),'MON-DD-YYYY') from dual'")"/>
    <to variable="xpath"/>
    </copy>
    <copy>
    <from expression="orcl:query-database(bpws:getVariableData('xpath'),false(),false(),'jdbc:oracle:thin:apps/apps@croaker:1529:RSICMI')"/>
    <to variable="statement_name"/>
    </copy>
    Error:
    [2006/12/06 19:13:04] Updated variable "xpath" less
    <xpath>'select to_char(to_date('10302006','MMDDYYYY'),'MON-DD-YYYY') from dual'</xpath>
    [2006/12/06 19:13:04] "XPathException" has been thrown. less
    XPath expression failed to execute.
    Error while processing xpath expression, the expression is "orcl:query-database(bpws:getVariableData("xpath"), false(), false(), "jdbc:oracle:thin:apps/apps@croaker:1529:RSICMI")", the reason is .
    Please verify the xpath query.
    Log Message:
    <2006-12-06 19:13:04,595> <DEBUG> <UAT.collaxa.cube.xml> <XPathUtil::evaluate> XPathQuery[concat("'select to_char(to_date('", bpws:getVariableData("statement_name"), "','MMDDYYYY'),'MON-DD-YYYY') from dual'")], XPath Result: class=java.lang.String value='select to_char(to_date('10302006','MMDDYYYY'),'MON-DD-YYYY') from dual'
    <2006-12-06 19:13:04,595> <DEBUG> <UAT.collaxa.cube.xml> <XPathUtil::initXPath> namespaceMapping is: rootMap: {bpws=http://schemas.xmlsoap.org/ws/2003/03/business-process/, xp20=http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20, ns4=http://xmlns.oracle.com/pcbpel/adapter/db/top/BAIBankUpload, ldap=http://schemas.oracle.com/xpath/extension/ldap, xsd=http://www.w3.org/2001/XMLSchema, ns5=http://xmlns.oracle.com/pcbpel/adapter/file/, client=http://xmlns.oracle.com/BAI_BankUpload, ora=http://schemas.oracle.com/xpath/extension, ns1=http://xmlns.oracle.com/pcbpel/adapter/file/readBAIBankImportCSV/, ns3=http://TargetNamespace.com/readBAIBankImportCSV, ns2=http://xmlns.oracle.com/pcbpel/adapter/db/Insert_SI_CE_STATEMENT_LINES_INT/, bpelx=http://schemas.oracle.com/bpel/extension, orcl=http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc, =http://schemas.xmlsoap.org/ws/2003/03/business-process/}
    scopedMap: {}
    <2006-12-06 19:13:04,751> <DEBUG> <UAT.collaxa.cube.xml> <XPathUtil::evaluate> XPathQuery :orcl:query-database(bpws:getVariableData("xpath"), false(), false(), "jdbc:oracle:thin:apps/apps@croakercom:1529:RSICMI")
    org.collaxa.thirdparty.jaxen.FunctionCallException
         at org.collaxa.thirdparty.jaxen.FunctionCallException.fillInStackTrace(FunctionCallException.java:124)
         at java.lang.Throwable.<init>(Throwable.java:195)
         at java.lang.Exception.<init>(Exception.java:41)
         at org.collaxa.thirdparty.jaxen.saxpath.SAXPathException.<init>(SAXPathException.java:83)
         at org.collaxa.thirdparty.jaxen.JaxenException.<init>(JaxenException.java:82)
         at org.collaxa.thirdparty.jaxen.FunctionCallException.<init>(FunctionCallException.java:86)
         at oracle.tip.pc.services.functions.ExtFuncFunction$QueryDatabaseFunction.call(ExtFuncFunction.java:190)
         at org.collaxa.thirdparty.jaxen.expr.DefaultFunctionCallExpr.evaluate(DefaultFunctionCallExpr.java:184)
         at org.collaxa.thirdparty.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:107)
         at org.collaxa.thirdparty.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:724)
         at org.collaxa.thirdparty.jaxen.BaseXPath.selectNodes(BaseXPath.java:253)
         at org.collaxa.thirdparty.jaxen.BaseXPath.evaluate(BaseXPath.java:210)
         at com.collaxa.cube.xml.xpath.XPathUtil.evaluate(XPathUtil.java:93)
         at com.collaxa.cube.engine.ext.wmp.BPELAssignWMP.evalFromValue(BPELAssignWMP.java:501)
         at com.collaxa.cube.engine.ext.wmp.BPELAssignWMP.__executeStatements(BPELAssignWMP.java:122)
         at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perform(BPELActivityWMP.java:188)
         at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:3408)
         at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1836)
         at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:75)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:166)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:252)
         at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:5438)
         at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:1217)
         at com.collaxa.cube.engine.delivery.DeliveryService.handleInvoke(DeliveryService.java:511)
         at com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean.handleInvoke(CubeDeliveryBean.java:335)
         at ICubeDeliveryLocalBean_StatelessSessionBeanWrapper16.handleInvoke(ICubeDeliveryLocalBean_StatelessSessionBeanWrapper16.java:1796)
         at com.collaxa.cube.engine.dispatch.message.invoke.InvokeInstanceMessageHandler.handle(InvokeInstanceMessageHandler.java:37)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:125)
         at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
         at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
         at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
         at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    Root cause:
    java.lang.ClassCastException
         at oracle.tip.pc.services.functions.ExtFuncFunction$QueryDatabaseFunction.call(ExtFuncFunction.java:158)
         at org.collaxa.thirdparty.jaxen.expr.DefaultFunctionCallExpr.evaluate(DefaultFunctionCallExpr.java:184)
         at org.collaxa.thirdparty.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:107)
         at org.collaxa.thirdparty.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:724)
         at org.collaxa.thirdparty.jaxen.BaseXPath.selectNodes(BaseXPath.java:253)
         at org.collaxa.thirdparty.jaxen.BaseXPath.evaluate(BaseXPath.java:210)
         at com.collaxa.cube.xml.xpath.XPathUtil.evaluate(XPathUtil.java:93)
         at com.collaxa.cube.engine.ext.wmp.BPELAssignWMP.evalFromValue(BPELAssignWMP.java:501)
         at com.collaxa.cube.engine.ext.wmp.BPELAssignWMP.__executeStatements(BPELAssignWMP.java:122)
         at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perform(BPELActivityWMP.java:188)
         at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:3408)
         at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1836)
         at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:75)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:166)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:252)
         at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:5438)
         at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:1217)
         at com.collaxa.cube.engine.delivery.DeliveryService.handleInvoke(DeliveryService.java:511)
         at com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean.handleInvoke(CubeDeliveryBean.java:335)
         at ICubeDeliveryLocalBean_StatelessSessionBeanWrapper16.handleInvoke(ICubeDeliveryLocalBean_StatelessSessionBeanWrapper16.java:1796)
         at com.collaxa.cube.engine.dispatch.message.invoke.InvokeInstanceMessageHandler.handle(InvokeInstanceMessageHandler.java:37)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:125)
         at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
         at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
         at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
         at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    <2006-12-06 19:13:04,751> <ERROR> <UAT.collaxa.cube.xml> ORABPEL-09500
    XPath expression failed to execute.
    Error while processing xpath expression, the expression is "orcl:query-database(bpws:getVariableData("xpath"), false(), false(), "jdbc:oracle:thin:apps/apps@croaker:1529:RSICMI")", the reason is .
    Please verify the xpath query.

    Hi,
    QAbdul wrote:
    when I tried to execute the followingin XMLQuery by calling TO_CHAR() whithin this query I am getting this error"ORA-19237: XP0017 - unable to resolve call to function - fn:TO_CHARTO_CHAR is a SQL function, XQuery is unaware of it.
    XPath 2.0 specifications define a fn:format-date function but Oracle has not included yet in its XQuery implementation.
    Easiest way to go is A_Non's solution, but if you need to format at multiple places in the query, you can declare a local XQuery function.
    For example, to format to "DD/MM/YYYY" from the canonical xs:date format "YYYY-MM-DD" :
    {code}
    declare function local:format-date($d as xs:date) as xs:string
    let $s := xs:string($d)
    return concat(
    substring($s, 10, 2), "/",
    substring($s, 7, 2), "/",
    substring($s, 2, 4)
    {code}
    and an example of use :
    {code}
    SQL> CREATE TABLE test_xqdate AS SELECT sysdate dt FROM dual;
    Table created
    SQL> SELECT *
    2 FROM XMLTable(
    3 'declare function local:format-date($d as xs:date) as xs:string
    4 {
    5 let $s := xs:string($d)
    6 return concat(
    7 substring($s, 10, 2), "/",
    8 substring($s, 7, 2), "/",
    9 substring($s, 2, 4)
    10 )
    11 }; (: :)
    12 for $i in ora:view("TEST_XQDATE")/ROW/DT
    13 return element e {
    14 attribute xs_date_format { $i/text() },
    15 attribute local_format { local:format-date($i) }
    16 }'
    17 COLUMNS
    18 xs_date_format VARCHAR2(10) PATH '@xs_date_format',
    19 local_format VARCHAR2(10) PATH '@local_format'
    20 )
    21 ;
    XS_DATE_FORMAT LOCAL_FORMAT
    2010-10-28 28/10/2010
    {code}

Maybe you are looking for

  • Adobe Flash Player Doesn't Work

    Goodday, I was unable to attend an on-line seminar due to Adobe Flash Player. The system is an iCore 7, running Windows 8.1 and the browser is Internet Explorer 11.1. I did follow the correcting on-line instructions and ended back where I started and

  • CAn EJB do persistance without hibernate?

    Hai All..... My doubt is that 'Can EJB do persistance without hibernate or any other tools'? Can EJB do persistance alone?? Please Help

  • Music disappeared after i ran itunes match

    almost half of my music disappeared from my desktop folders after I ran iTunes match. Now iTunes can't find the files to play them. What happened? and most importantly, Why? I've had a lot of this music for over 6 years

  • Best solution for 22 APs with no WLAN controller

    Hello, I have 22 aironet 1130 access points installed in a large building together with an ACS 4.1. what is the best solution to manage the APs, provide QOS and centrally authenticate and control the AP. Will enabling WDS on AP provide radio manageme

  • When I run the smartform

    I just see the field names that  comes from the internal table. I have added a table, one row and 4 cells; afterwards I have created text for these cells and added the field names like >> &itab1-studentNo&. For each cell I have added different fields