to-char

What is the best way to escape non-format characters in Oracle's to_char?

匆匆过客 提交于 2019-11-28 21:04:36
I am trying to print a date in a select statement, but I need to add a letter to the output: to_char(date_updated, 'YYYY-MM-DDTHH:mm:ss') Oracle does not like the T. I just want the T to be output like the colons and the dashes. Can I escape it with a backslash or something? You just need double-quotes around it: to_char(date_updated, 'YYYY-MM-DD"T"HH:mm:ss') 来源: https://stackoverflow.com/questions/588430/what-is-the-best-way-to-escape-non-format-characters-in-oracles-to-char

Why is Oracle's DECODE giving me a different value than NVL?

纵然是瞬间 提交于 2019-11-28 04:39:43
问题 This query: select nvl(0.75,0) from dual gives me 0.75 (numeric) but this query: select decode(1,0,null,0.75) from dual gives me '.75' (string). Why? I tried to fix this by changing the second query to: select decode(1,0,null,to_char(0.75,'0.99')) from dual but in my actual code the 0.75 will be a field (NUMBER) that may have a different number of decimal places and I'm not suppose to add/remove anything from that value. Any ideas on how to fix the missing zero issue but still support all

What is the best way to escape non-format characters in Oracle's to_char?

十年热恋 提交于 2019-11-27 13:27:18
问题 I am trying to print a date in a select statement, but I need to add a letter to the output: to_char(date_updated, 'YYYY-MM-DDTHH:mm:ss') Oracle does not like the T. I just want the T to be output like the colons and the dashes. Can I escape it with a backslash or something? 回答1: You just need double-quotes around it: to_char(date_updated, 'YYYY-MM-DD"T"HH:mm:ss') 来源: https://stackoverflow.com/questions/588430/what-is-the-best-way-to-escape-non-format-characters-in-oracles-to-char

how to display number value in words

谁都会走 提交于 2019-11-27 08:13:49
问题 Q. Display the number value in Words and output should look like this SAL In_Words --------- ----------------------------------------------------- 800 eight hundred 1600 one thousand six hundred 1250 one thousand two hundred fifty And, I'm still didn't figure out, how this query is the solution for the above output. select sal, to_char(to_date(sal,'j'),'Jsp') in_words from emp What to_date is doing here ? Anyone have any idea about this query ? 回答1: So how the query works? Well here’s why: