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
Similar Messages
-
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). -
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 advanceKarthick_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. -
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:
437022Dates 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. -
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,
SrikanthThe 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 -
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 VuppalapatiWhat 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. -
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 -
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
-
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:32select 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. -
Listener calls Function plus Arguments??
Hi guys,
Not sure if there's an easy way to do this, I'd like a
listener to call a function with arguments when triggered.
Currently, what I have looks like this:
object.addEventListener(errorTrigger, functionToCall);
public function functionToCall():void {
...you get my idea...
And, I'd really like to add some arguments to the function. I
realize that if I use:
object.addEventListener(errorTrigger,
functionToCall(myArgument));
then it will want
functionToCall to
return a
function name to be used. Hopefully, you're still with me on
this...
The reason I want to add the arguments, is because I have
three different listeners.
And I'd rather not have three different functions to deal
with them, I'd rather consolidate it into one function and use the
argument to distinguish the difference.
Rather than:
object.listener(error1, function1);
object.listener(error2, function2);
object.listener(error3, function3);
function1 ():void {}
function1 ():void {}
function1 ():void {}
I'd prefer something like:
object.listener(error1, function(1));
object.listener(error2, function(2));
object.listener(error3, function(3));
function(num):void {}
Hopefully, that all makes sense. Sorry, I'd post the code,
but it's way to long, and I'd rather not confuse anyone with
something else contained within it.
More than happy to try and cut it down if someone needs to
see the code though.
Cheers
OzThanks for your efforts, I don't quite know whether it's what
I'm looking for though.
The events I am using are predefined by Flex's upload
function. So, this may help:
fileUpload.addEventListener(HTTPStatusEvent.HTTP_STATUS,
uploadError);
fileUpload.addEventListener(IOErrorEvent.IO_ERROR,
uploadError);
fileUpload.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
uploadError);
And I'd really like to add the parameters to the end, like
so:
fileUpload.addEventListener(HTTPStatusEvent.HTTP_STATUS,
uploadError(param));
fileUpload.addEventListener(IOErrorEvent.IO_ERROR,
uploadError(param));
fileUpload.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
uploadError(param));
Is this something that I have to cast to / extend apon the
existing events using your technique above? In essence, creating a
duplicate of this event?
Thanks
Oz. -
Help Required --- TO_CHAR function for formatting DATE
Tue, 20 Jan 2004 17:39:11 GMT.
I want the output in the above mentioned format . Can any one help me ,Please.
I tried some thing like this.......
select to_char(sysdate,'Dy, DD Mon yyyy HH24:MI:SS') from dual; and them Append GMT to it. Is this correct the way ? :D.You can append the results of the following (assuming the database timezone is GMT):
select dbtimezone from dual; -
Formating dates with to_char function
Hi,,
Inside a pl/sql procedure Im formating a date:
v_start_date := 2011-04-01 05:00:00;
v_start_month := to_char(v_start_date,'mm');and I need that v_start_month returns = 04
but returns 4
What could I do to fix it
Many Thanks..If you define v_start_month as a number then it will strip off the leading 0 when it displays. Define v_start_month as a varchar and it will display the way you want.
SQL> DECLARE
2 v_month VARCHAR2(10);
3 BEGIN
4 v_month := to_char(SYSDATE,'mm');
5 dbms_output.put_line(v_month);
6 END;
7 /
08 -
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} -
ERROR when called TO_CHAR function from XMLQuery
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_CHAR
any help/ideas on the follwing would be much appreciated.
Thanks
Abdul
select XMLQuery('<marketfeed id="f1" action="CREATE" source="marketfeed1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<competitions>
{for $f in ora:view("fixture")
for $c in ora:view("competition")
for $homes in ora:view("squad")
for $aways in ora:view("squad")
for $homet in ora:view("team")
for $awayt in ora:view("team")
where $f/ROW/GID = "g321667"
and $f/ROW/COMPETITIONID = $c/ROW/ID
and $f/ROW/HOMESQUADID = $homes/ROW/ID
and $f/ROW/AWAYSQUADID = $aways/ROW/ID
and $homes/ROW/TEAMID = $homet/ROW/ID
and $aways/ROW/TEAMID = $awayt/ROW/ID
return
<competition id="{$c/ROW/ID/text()}"
shortname="{$c/ROW/NAME/text()}"
name="{$c/ROW/NAME/text()}">
<teamlists>
<teamitam name="{$homet/ROW/NAME/text()}"
id = "{$homes/ROW/TID/text()}" />
<teamitem name="{$awayt/ROW/NAME/text()}"
id = "{$aways/ROW/TID/text()}" />
</teamlists>
<matches>
<match id="{$f/ROW/GID/text()}"
venue="{$f/ROW/VENUE/text()}"
matchdate="{TO_CHAR($f/ROW/STARTDATE/text(), "YY-MM-DD")}"
name="{concat($homet/ROW/NAME/text(), " v ", $awayt/ROW/NAME/text())}"
>
<teams>
<team home="H" id = "{$homes/ROW/TID/text()}" />
<team home="A" id = "{$aways/ROW/TID/text()}" />
</teams>
</match>
</matches>
</competition>
</competitions>
</marketfeed>'
returning content
from dual
Edited by: QAbdul on 26-Oct-2010 06:44Hi,
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
-
Plug problem? Battery problem?
This evening the screen on my iBook G4 started oscillating between bright and not quite as bright (unevenly, but sometimes as rapidly as one second). At the same time, the battery icon would switch between showing the power supply connected and disco
-
Basic Standby Database(Manually Managed) in Standard edition
Hello, We are using oracle SE where dataguard feature is not available. So we cloned the database and applied archived logs for recovery followed a metalink doc. Everything is good. Now I need to keep my standby in synch with primary, for this i need
-
i tried to activate my icloud but it tells me that my account is not verified. what do i do?
-
the pic butten on messages is not working. can not send or recieve photos. please help.
-
HTML5 - securing intellectual property
Hi, Currently when I publish in Captivate project then the content and how we created it is hidden from view (unless someone decompiles it) . With HTML5 my understanding is that everthing is in plain text and there is no way of doing DRM or hiding c