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

not displaying 'none' instead of a 0

Right now my query is giving me a 0 when I count the enrolled date. How could I have a row show me 'none' result instead of a 0. what I am missing here ? COALESCE(TO_CHAR(SUM(ENROLLMENTS)),'none') ENROLLMENTS this is what I have SELECT…
Manual
  • 1,627
  • 5
  • 17
  • 20
0
votes
3 answers

PLSQL Replace Hours in a date

I want to replace the hour on a date, for instance, if I have 07/07/13 11:15, I'll want to get 07/07/13 00:00 from the first date. So, what I'm trying to do is this: textDate := TO_CHAR (auxDate, 'DD/MM/RR')||' '||textHour||':'||textMin; endDate :=…
mdlapla
  • 37
  • 10
0
votes
2 answers

to_char and to_date are returning different output

I am using below queries. select sysdate from dual where to_char(sysdate,'DD-MM-YY')='28-MAY-13'; and the output is null. But for below query, output is current date. select sysdate from dual where to_date(sysdate,'DD-MM-YY')=…
Samurai
  • 843
  • 6
  • 23
  • 44
0
votes
1 answer

convert date in sql using to_char function

I would like to convert the following date to this format(DD-MON-YYYY). I tried executing the below query but I got the error saying "date format not recognised". select to_char(to_date('Sat Dec 01 00:00:00 IST 2012','EEE Mon dd HH:mm:ss z…
Raul
  • 139
  • 1
  • 6
  • 17
0
votes
1 answer

Oracle to_char subquery in Trigger

I have a table (Meeting) with date type attribute (MeetDate) and another varchar2 type attribute (WorkWeek). I'm trying to do an After trigger to fill in the WorkWeek field based on the MeetDate value using the to_char function. Tried the following…
Nimesh Wicks
  • 19
  • 1
  • 7
0
votes
2 answers

SQL Developer: Invalid Relational Operator Error, also formatting questions

I am trying to add some formatted columns to a query to our db, but I think I'm getting the operators wrong in my CASE statement. I'm also unclear on how to write formatting for the TO_CHAR operation. Is it the same as for the TO_DATE operation?…
Alex Ackroyd
  • 1
  • 1
  • 1
0
votes
3 answers

Character to number conversion error in trigger

How will the trigger insert between two timings? Getting character to number conversion error in the if condition while inserting. Below is my trigger. create or replace trigger TRI_INSERT after insert on stud_details referencing old as old…
0
votes
4 answers

Create a new String with Duplicate Letters

I am trying to create a string that inserts a duplicate letter from the original into the modified. For example, the output of one run would be: Original word: stack Output: sstack, sttack, staack, stacck, stackk Does that make sense? I…
Jeagr
  • 1,038
  • 6
  • 16
  • 30
0
votes
2 answers

SQL Using to_char(null), to_number(null), etc in set operators with Oracle

I'm a student entering the world of SQL for the first time and I cannot find any clear and understandable documentation on how to use to_somedatatype(null) to substitute for missing columns in a UNION, INTERSECT, etc. I'm using the HR schema that…
Troy D
  • 381
  • 2
  • 4
  • 17
0
votes
5 answers

Java ordinary programming

I encountered a problem while converting a string to char array... my problem is:- String str="2+32*2"; char a[]=new char[str.length()]; str.getChars(0,str.length,a,0); my array looks like this:- a[0]='2'; a[1]='+'; a[2]='3'; …
0
votes
2 answers

Converting string to integer using enum and storing it as integer array in c#

I want to convert the string to character array. Further, the values in character array has to be converted to number values using enum. The values that returned as integer has to be stored in integer array. My coding is: enum alphabets { a =…
janani
  • 123
  • 1
  • 2
  • 14
0
votes
1 answer

How to convert this sql to EJB QL

The sql query is: SELECT to_char(DE.DELIVERYID) FROM DELIVERIES DE; DELIVERYID in oracle is a number and deliveryid in JPA is a Long. any suggestion?
Rafael
  • 185
  • 1
  • 4
  • 14
0
votes
2 answers

How to insert into table where variable -1

I'm having problems while trying to insert into a table by selecting from another table with the dates as a condition. The date will be retrieved from another table and not from Oracle, because the application stores its own system date (i.e. today…
feef24
  • 1
  • 1
0
votes
1 answer

search date and time in oracle using to_char

In oracle, when I search using below query, it is fetching wrong records (check the attached screenshot), can someone suggest the correct format for 12 hour time. to_char(a.created, 'MM/DD/YYYY HH12:MI:SS') >='05/23/2012 12:00:00' Thanks, Kiran.
Kiranshell
  • 267
  • 3
  • 6
  • 12
0
votes
5 answers

to_char in where clause SQL / Postgresql

I'm using Postgresql DB. I want to perform a query against a numeric column in a table to find if the value starts with a particular number. I currently have: SELECT * FROM myTable WHERE to_char(ID, '12345678') LIKE '2%' However this returns an…
Steve
  • 340
  • 4
  • 16