Questions tagged [to-date]

to_date is sql function that converts string to date

to_date is an SQL function that converts a string to a date.

Reference

293 questions
2
votes
2 answers

How to write date condition on where clause in oracle

I have data in the date column as below. reportDate 21-Jan-17 02-FEB-17 I want to write a query to fetch data for 01/21/2017? Below query not working in Oracle. SELECT * FROM tablename where reportDate=to_date('01/21/2017','mm/dd/yyyy')
Shakeer Hussain
  • 2,230
  • 7
  • 29
  • 52
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
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
2 answers

Not a valid month in oracle when add_months is used

I have given the below code in query. where to_date(cal_wid,'yyyymmdd') between add_months(to_date(sysdate, 'MM-YYYY'),-12) and to_date(sysdate, 'MM-YYYY') I am getting the following bug. (I am doing in a Xampp server) …
rji rji
  • 697
  • 3
  • 17
  • 37
2
votes
2 answers

Oracle Date Error - ORA-01841

I have the following table in Oracle11g. SQL> DESC tmp_test; Name Type Nullable Default Comments -------------------- ------------- -------- ------- -------- SERNO NUMBER(10) …
MrM
  • 389
  • 1
  • 8
  • 23
2
votes
2 answers

to_date with AS400

I am writing to you because I can't use the operator to_date on an AS400 database. With Oracle database, I use: datefield >= to_date('01/01/2014','DD/MM/YYYY') But with AS400, I get an error: Incompatible operator Is there another function I may…
Olivierm67
  • 81
  • 1
  • 1
  • 8
2
votes
1 answer

normalize date in postgres - character to date

I have a Table with coloumnname description description //character…
Mani Deep
  • 1,298
  • 2
  • 17
  • 33
2
votes
2 answers

What exact exception to be caugth while calling TO_DATE in pl/sql code

I have below code to_date('1311313', 'yymmdd') which actually throws exception with saying invalid month. Which is can manage as exception when others then sop('date format is wrong'); Here the problem is everything will get caught which I do not…
gahlot.jaggs
  • 1,083
  • 3
  • 11
  • 21
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

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
2
votes
2 answers

To_date function in Vertica format?

How can I get Vertica function to_date('','format') do output like this: DDMonYYYY - 01/ABR/2012 and not like it does (01-04-2012)?! dbadmin=> select now(); now -------------------------------- 19/09/2012 11:03:48.284339 BRT (1…
Up_One
  • 5,213
  • 3
  • 33
  • 65
2
votes
1 answer

What is Julian Date Format

I have came through a query in SQL which will convert number we enter to word format The Query is select to_char(to_date(&num,'J'),'JSP') from dual; TO_CHAR(TO_DATE(678,'J'),'JSP') ------------------------------- SIX HUNDRED…
Aspirant
  • 2,238
  • 9
  • 31
  • 43
2
votes
2 answers

Oracle TO_DATE headache

I have a string column that contains the below data as an example 10/20/2005 15:08:00 11252011 15:22:40 I have created a temp date column that I will copy the contents into, drop the string column and rename the temp column to what the string…
Jon
  • 38,814
  • 81
  • 233
  • 382
1
vote
3 answers

How can I extract and display the date range based on Quarter in Oracle?

I'm building a summary table as part of a stored procedure and I have two columns. The first column needs to show the start and the second column needs to show the end of a date range that is based from an input parameter that is a number…
dee
  • 609
  • 7
  • 16
  • 24