Questions tagged [to-char]

The TO_CHAR function converts another data type (e.g. NUMBER, DATE) to a text. Use for questions about the use of this function.

The TO_CHAR function converts another data type (e.g. NUMBER, DATE) to text. It is usually used to format output data.


Sources:

215 questions
2
votes
1 answer

Oracle - How can I use NLSParams to force change language using TO_CHAR function?

I'm coding a PL/SQL function to display in words a number inserted from parameter between 0 and 5000 but the result displayed is displayed in English (as you can check in the screenshot), but now I want to displayed the result in Spanish and I read…
Young Al Capone
  • 369
  • 1
  • 6
  • 25
2
votes
1 answer

Can someone explain why the below queries function differently? Literally the only difference between the two is that

The below two queries are identical except that the first has >= on the last line and the second has =. Yet the first returns 129 rows, while the second returns 0. Today is 11-15-2016, so I expected them to return the same. The data type of…
Seth A Kelley
  • 33
  • 1
  • 4
2
votes
1 answer

Inserting a Date data

so I have this table RPG_RETCON ( UNIQUE_ID VARCHAR2(100 BYTE), CONTAINER VARCHAR2(100 BYTE), DATA_POINT_NAME VARCHAR2(100 BYTE), SOURCE_VALUE VARCHAR2(100 BYTE), CSS_VALUE VARCHAR2(100 BYTE), STATUS …
2
votes
0 answers

Oracle SQL: failing to convert number to char

I have a table SOME_TABLE with a field SOME_NUMBER of type number. If I try to convert this field to char, I'm getting an error in some cases. This select select id, SOME_NUMBER, …
Luigi Cortese
  • 10,841
  • 6
  • 37
  • 48
2
votes
2 answers

How to convert String with timezone to Date

How to convert below string to Date in Oracle Wed Jan 13 23:01:24 GMT 2016 Tried below and this get's date as SELECT TO_CHAR(SYSDATE, 'DY MON DD HH24:MM:SS YYYY') FROM dual; FRI AUG 26 14:08:04 2016 Eventually, Wanted something like this SELECT…
MoG
  • 404
  • 6
  • 16
2
votes
1 answer

Oracle SQL TO_CHAR variable length

I'd like to ask you with help with a TO_CHAR method in Oracle SQL. TO_CHAR(Number_parameter,'9999D99','NLS_NUMERIC_CHARACTERS = ''. ''') vc_num, Number_Parameter is coming in as a decimal number with usual values between 10.10 to 1999.99 (but not…
erewien
  • 349
  • 4
  • 15
2
votes
2 answers

using TO_CHAR of TIMESTAMP throws ORA-01877 if it's more than 78 characters

I'm facing a strange issue I'm trying to convert some numbers into "words" , simply by doing this: TO_CHAR(TO_TIMESTAMP(LPAD( nvl(trunc(99999999),0) , 9, '0'), 'FF9'),'FFSP') AS amt_in_words that works perfectly ,the output is "NINETY-NINE…
user2219385
  • 45
  • 1
  • 10
2
votes
1 answer

PostgreSQL - get all integer digits from double precision field for use in to_char function

As stated in the documentation of Postgres 9.0 the double precision data type has a precision of 15 decimal digits and a storage of 8 bytes, then an integer number larger than a normal bigint (8 bytes) stored in a double precision field is…
Osuka
  • 106
  • 1
  • 9
2
votes
1 answer

h2 database to_char alias throwing null pointer

HQL working good with oracle database ,but throwing null pointer when using h2 databse 1.3. 175 Query q = session.createQuery( "select new TESTPOJO(c.name, c.phoneNumber, " + "to_char(c.dateofBirth, 'YY') from STUDENT c " + "where…
2
votes
1 answer

how to check if the three dates in a table column has continuous months

i have a table that has a column name date_tran that shows the date on which the user has made any transaction. is there any way how i can check if 3 transactions are made by the user is in the same month or 3 continuos month? i am using the…
ritika
  • 61
  • 1
  • 10
2
votes
2 answers

oracle to_char daylight savings

In below, why isn't Daylight savings included in to_char()? How can i get the time with daylight savings? SELECT systimestamp AT TIME ZONE 'Australia/Adelaide' from dual; SELECT TO_CHAR(systimestamp AT TIME ZONE 'Australia/Adelaide' ,'yyyy-MM-dd…
user503647
  • 41
  • 1
  • 1
  • 5
2
votes
1 answer

to_char function is returned, the zeros in Oracle Database 10g Express 10.2.0.1.0

Let's create a test table to illustrate the problem: CREATE TABLE "TMP1" ( "X" VARCHAR2(256 BYTE) NOT NULL ) LOGGING NOCOMPRESS NOCACHE; INSERT INTO "TMP1" VALUES ('XxYyyyZzzWww_123456_0106201395810_0106201395810.csv'); INSERT INTO "TMP1"…
abg
  • 2,002
  • 7
  • 39
  • 63
2
votes
4 answers

how to display number value in words

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…
Ravi
  • 30,829
  • 42
  • 119
  • 173
2
votes
2 answers

Oracle - Number to varchar

I have a table containing a column of type Number create table tmp ( /*other fields*/ some_field Number ) and in a PL SQL script, I want to convert that field to a varchar. However, i don't know its length, so I get an exception Exception…
Tom
  • 43,810
  • 29
  • 138
  • 169
2
votes
2 answers

How can I convert a complex sysdate + something else with a to_date function?

Bit stuck here. Say I run the following SQL query: select to_char(sysdate, 'DD/MON/YY') || ' 15:32:00' from dual; The result gives me this: 08/NOV/12 15:32:00 Now I want to take that result and use it in a to_date function (long story as to why,…
kooper
  • 97
  • 2
  • 9
1 2
3
14 15