Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Need to convert the following oracle queries to MYSQL queries.

1)

select to_char(to_date(?,'DD-MM-YY')) 
from dual;

2)

select to_char(next_day(to_date(?,'DD-MM-YY'),'FRIDAY')) 
from dual;

3)

select to_char(to_date(?,'DD-MM-YY'),'DAY') 
from dual;
share|improve this question
    
Read this: Date and Time Functions. But you need to convert data, too, not only queries. But you need to convert data/table-structure, too, not only queries. –  ypercube Jul 12 '12 at 13:32
    
the oracle to_char function without a second argument (the format string) formats a date value depending on settings on your database server and client that are not known to us. to what format do you want the date values be converted? –  miracle173 Aug 9 '12 at 5:54

1 Answer 1

regarding the first command

select to_char(to_date(?,'DD-MM-YY')) 
from dual;

it can be converted like the following

SELECT cast(DATE_FORMAT('?', '%D-%M-%Y')as char) as date;

And for the third command

select to_char(to_date(?,'DD-MM-YY'),'DAY') 
from dual;

it can be converted like the following

select cast(dayname((DATE_FORMAT('?','%D-%M-%Y')))as char) as day;

but for the second one I could not find a very good conversion.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.