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
0
votes
1 answer

Convert MDDYYYY and MMDDYYYY column to MM-DD-YYYY in Oracle SQL

I used SELECT TO_DATE(INC_DATE, 'MMDDYYYY') FROM BASICINCIDENT2010;but since not all the dates in the inc_date are of the same format. It causes the error of Month not found.
0
votes
2 answers

Whats wrong with the following code

Why isn't the following code working ? String s = "fecbda"; Arrays.sort(s.toCharArray()); System.out.println(s);
Connors
  • 1
  • 2
0
votes
3 answers

Oracle 01481. 00000 - "invalid number format model"

This is my query i have used to get the value as money. Nut when concat value getting above exception. The query is select to_char(b.balance,'9999.'||d.number_of_decimal_places) from balance b, decimal d Am stuck with this problem.
user5122076
0
votes
2 answers

Oracle c# number function returns 0 always

I am trying to call an Oracle function which has a return type of number. I am calling from C# using OleDB and I understand that the mapping of type number in Oracle is a decimal. Whenever I call this i get a 0 back. using (OleDbCommand…
Dominic Cotton
  • 789
  • 10
  • 34
0
votes
1 answer

PostgreSQL using to_char with floor

Ok I am converting from SQL Server to PostgreSQL. I am having trouble with some to_char. CASE LENGTH(LTRIM(RTRIM(to_char(floor(_FloatValue))))) WHEN 1 THEN '0' || LENGTH(LTRIM(RTRIM(TO_CHAR(floor(_FloatValue))))) || ':' ELSE…
Louis Royster
  • 111
  • 1
  • 12
0
votes
1 answer

Getting Error with Date Format in To_Char

I am getting error in the second script. Please explain why i am getting error in the second script. select count(*) from LCL_SHR_IncidentIntegrationInt where externalsystem = 'IPSOFT' and…
Subbu
  • 41
  • 1
  • 8
0
votes
3 answers

Using a to_char function inside a case statement with Oracle APEX

I was working on Oracle APEX writing a query which gives a list of the upcoming birthdays of students in 2016 and orders them chronologically. This worked and I used the following code: SELECT first_name, last_name,…
KRAD
  • 51
  • 2
  • 10
0
votes
4 answers

Why wont TO_DATE return the TIME section of my query?

I am trying to convert EPOCH to a HUMAN DATETIME. When I test this on their website, it returns the right value. When I do it within SQL Developer, it's wrong. This lead me to check other basic SQL to see how they get returned, select sysdate…
Runawaygeek
  • 115
  • 3
  • 13
0
votes
2 answers

to_char, to_date in Microsoft SQL Server

I'm trying to convert the following command: to_char(to_date('01/01/1970 00:00:00', 'MM/DD/YYYY HH24:MI:SS')+((1442998800)/( 60 * 60 * 24 )+(180/1440)),'DD/MM/YYYY HH24:MI:SS') But with no success, any help is greatly appreciated Many thanks
Chrismage
  • 109
  • 1
  • 2
  • 9
0
votes
2 answers

How to extract only time from '0/0/0000 10:23:56 AM'?

I am having date as 0/0/0000 10:23:56 AM in a column. I have tried with TO_CHAR(column_dt,'hh24:mm:ss') and TO_CHAR(column_dt,'hh:mm:ss pm'), but both are returning 00:00:00 and 00:00:00 00 respectively. Can any one please help me out ?
Soumya
  • 19
  • 4
0
votes
2 answers

Strange behaviour when filtering by date in Oracle

I'm on an Oracle database, the following query: select codi_belf, data_elab,id_inte,anno from mimsspam_tab where id_inte = 504; retrieves 6 records E924 05-AGO-15 504 2015 D458 05-AGO-15 504 2015 D458 05-AGO-15 504 2015 B275 …
0
votes
1 answer

Oracle "Invalid Number" caused by to_char function

I have the following SQL query which is looking for duplicate values in a table (two values being null must be classed as a duplicate, hence the use of nvl): select * from PersonLinkTable personLink where personLink.RefPerson = 100 and…
Phil 87
  • 73
  • 2
  • 8
0
votes
1 answer

to_char function in SQLPLUS

When I run select to_char(SYSDATE-3) from dual from SQL DEVELOPER it gives 26-06-15. But when I run the same query from SQLPLUS session from Linux its giving - SQL> select TO_CHAR(SYSDATE-3) from…
0
votes
0 answers

Oracle TO_CHAR to convert nvarchar to int

I have a string variable passed to plsql procedure from front end which contain comma selerated integers, to retrieve these integers i am using TO_CHAR (P_LISTID). P_LISTID is variable passed. THIS is working in many procedures written by…
Vishwas Rao
  • 121
  • 1
  • 1
  • 11
0
votes
2 answers

Oracle SQL: How do I convert the substrings in a string using to_char

The to_char works fine when applied to single match like below. select to_char('54523234', '99,999,999,999') I use regex to find the match of only the currencies in the string. But when I apply to_char to the first group, it doesn't work SELECT…
Anandh
  • 35
  • 4