ultra...@gmail.com wrote in
news:8ab1b80c-2c88-414f...@googlegroups.com:
> I am trying to convert some oracle sql to db2.
>
> The current issue is:
>
> to_char(trunc(root_ah_runtime/3600), 'FM999999990') || ':' ||
> to_char(trunc(mod(root_ah_runtime,3600)/60), 'FM00') || ':' ||
> to_char(mod(root_ah_runtime,60), 'FM00')
>
> returns
>
> QL20476N The "DECFLOAT_FORMAT" function was invoked with an invalid
> format string "FM999999990". SQLSTATE=22018
You missed the first character "S" from the error code SQL20476N.
It can be found here:
http://pic.dhe.ibm.com/infocenter/db2luw/v9r8/topic/com.ibm.db2.luw.mess
ages.sql.doc/doc/msql20476n.html
A bit strange that in your case it says the DECFLOAT_FORMAT function is
invoked, as - like Peter Coffin already mentioned - the to_char is
synonym with the VARCHAR_FORMAT, not DECFLOAT_FORMAT.
>
>
> and I can't find any documentation on the conversion.
>
> Has anyone seen this before and have a solution?
>
> Thank you!
>
"FM" is a valid datetime format element in Oracle as can be seen in
following Oracle doc (see table 2-15):
docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements004.htm
As described, it specifies that a value should be returned with no
leading or trailing blanks.
The relevant doc for DB2 describing datetime format elements for the
VARCHAR_FORMAT scalar function doesn't specify the "FM":
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%
2Fcom.ibm.db2.luw.sql.ref.doc%2Fdoc%2Fr0053653.html
So it seems this is something that causes DB2's Oracle compatibility to
be a little less than 100% ;-)
You didn't specify the exact DB2 level, but you might also be
interested in this APAR that seems loosely related:
http://www-01.ibm.com/support/docview.wss?uid=swg1IC73585
HTH.
Cheers!
--
Jeroen