which action can you use the TO_DATE function?

For which action can you use the TO_DATE function?

For which action can you use the TO_DATE function?

A.
Convert any date literal to a date

B.
Convert any numeric literal to a date

C.
Convert any character literal to a date

D.
Convert any date to a character literal

E.
Format ’10-JAN-99’ to ‘January 10 1999’



Leave a Reply 1

Your email address will not be published. Required fields are marked *

11 − six =


Hola

Hola

Question: How do I use the to_date function to store data into a DATE datatype.

Answer: The to_date function is used to convert character data to the date datatype. Like to_char, this function can be called with a single parameter, much like

to_date (’02-MAY-97′)
which returns a value of type date. to_date may also be called with a second parameter, which instructs the function to convert the specified string from the specified format into a standard date. For example,

to_date (’02 May 1997′, ‘DD MONTH YYYY’)
returns

02-MAY-97
The Oracle to_date function is used to change a test string (or variable) into an internal date format.

Remember, all DATE datatypes are stored in a special internal format, complete to the hundredth of a second. You can change the display using nls_date_format also.

The to_date function is usually used in SQL when storing into the database.

Insert into mytab (date_col) values to_date(string,format);

Examples of the to_date function might include:

to_date(’10-12-06′,’MM-DD-YY’)

to_date(‘jan 2007′,’MON YYYY’)

to_date(‘2007/05/31′,’YYYY/MM/DD’)

to_date(’12-31-2007 12:15′,’MM-DD-YYYY HH:MI’)

to_date(‘2006,091,00:00:00’ , ‘YYYY,DDD,HH24:MI:SS’)

to_date(’15-may-2006 06:00:01′,’dd-mon-yyyy hh24:mi:ss’)

to_date(‘022002′,’mmyyyy’)