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

Netezza TO_CHAR Function not evaluating appropriately?

I am having issues with a query that, if ran with hard-coded dates, will insert the correct number of rows into a table (170K+). The issue is, when I try to automate it, by replacing the hard-coded dates with date functions, the query will then only…
0
votes
2 answers

Contatenating two date values into one column

Should be a pretty simple question. I have two fields - one a year field and the other a month field. The month field is an integer and if there is only one digit such as 6 for June there is no leading zero. I want to concatenate the two fields…
Luke
  • 31
  • 8
0
votes
1 answer

TO_CHAR function for handling decimal format

I have a data column with varchar(19,4). How do I show it in proper decimal format e.g I want to show 1000000.0000 instead of 1000000 only (need it in specific format for file processing by some third paty). Currently I used…
bloomwood
  • 31
  • 2
  • 6
0
votes
1 answer

to_date and to_char issue

I need to delete records inserted in the last minute and i have to use a specific system date that exists in my database and that is actually truncated (select sys_date from dual returns 20/3/2014). i tried to format the date to show minutes and…
mardeea
  • 45
  • 1
  • 7
0
votes
0 answers

ORACLE TO_CHAR ERROR

I heve a function (use Dbms_sql.Varchar2s) that part of it is below: str_work(Nvl(str_work.Last, 0) + 1) := ' Select '; str_work(Nvl(str_work.Last, 0) + 1) := ' TIP.ID_ITEM,'; str_work(Nvl(str_work.Last, 0) + 1) := ' …
user2364211
  • 21
  • 1
  • 2
0
votes
2 answers

Checking date with less than or equal to 10 days

Select projectname from project where to_char(start_date, 'yyyy-mm-dd') - to_char(end_date, 'yyyy-mm-dd') <= 10; Hi, so i want to get a project that is less than or equal to 10 days long, I am new to SQL, not sure if I am doing it right or not.
user2786596
  • 135
  • 2
  • 5
  • 10
0
votes
1 answer

Format postgres numeric like money ($0.20)

I have a numeric column that I'm trying to format like currency, but I can't seem to get the format right. I currently have: to_char(my_column, 'fml9999999999999999999D9999999999999999999') but it outputs $.2 If I remove the 'fm' modifier, it…
frodo2975
  • 10,340
  • 3
  • 34
  • 41
0
votes
1 answer

How to display the name of day and then only display data from a particular day

So I have a query that displays the name of the day of the week and the wine that went with that day. The problem I have is that I only want to display data from Tuesday. How would I go about doing that? select to_char(res_date, 'DAY'), wine from…
ShoSom
  • 29
  • 7
0
votes
1 answer

ORA-00933 Error for to_char formatting PLSQL

I have the following codes: IF nvl(p_value, 0) >= 0 THEN l_currency_prefix := 'scc.currency_prefix_pos'; l_currency_suffix := 'scc.currency_suffix_pos'; ELSE l_currency_prefix := 'scc.currency_prefix_neg'; …
Law
  • 349
  • 2
  • 5
  • 14
0
votes
2 answers

Delete first space (to_char) SQL Oracle

I write a select: select orderid, unitprice*(1-discount)*quantity as "a", to_char(unitprice*(1-discount)*quantity, '99999D99') as "SUM" from OrderDetails where unitprice*(1-discount)*quantity > 5000 Result is: How delete only first…
viartemev
  • 211
  • 1
  • 4
  • 13
0
votes
3 answers

How to make this sql code in Java

Does anyone know how to implement this SQL code in Java code? to_char(to_date(time,'sssss'),'hh24:mi') Time format is like 36000 in database and then after this sql command it is: 10:00 I want to make this function work in Java not SQL.
Vuk Vasić
  • 1,398
  • 10
  • 27
0
votes
2 answers

Order by time stored as Varchar

I have a column(s_time) as varchar. I store 12 hours time(7:00 AM). I want to order by this column(s_time). I tried with this oracle query select * from tabl_time order by to_date('s_time','hh12:mi') asc But this did not work. Can anyone …
Shanna
  • 753
  • 4
  • 14
  • 34
0
votes
1 answer

Can Convert.ToChar() function get int parameter bigger than 65535

I am trying to get all chars of Segoe UI Symbol Font. I got them, converted to char, converted to Hex value and added to listview as items. So, somebody else can use their hex values for XAML projects as icon. But the problem is this in the code:…
ibrahim
  • 313
  • 3
  • 19
0
votes
0 answers

Is there an equivalent TO_CHAR or TO_DATE SQL function in HSQLDB, ver. 1.8.0?

I have an HSQLDB, ver. 1.8.0, database that I would like to run some SQL date functions on (such as a date range select). Is there an equivalent HSQL function to do this with a column that is defined as a BIGINT?
atom88
  • 1,449
  • 3
  • 22
  • 32
0
votes
1 answer

Oracle - Filter results between modified working week

Using Oracle, I am currently filtering data using AND schedstart BETWEEN (TRUNC(SYSDATE - (TO_CHAR(SYSDATE,'D')+6))) AND (TRUNC(SYSDATE - (TO_CHAR(SYSDATE,'D')-1)))) which isn't what I want. My working week starts on a Wednesday and finishes on a…