Home » SQL & PL/SQL » SQL & PL/SQL » Problem in query........
icon5.gif  Problem in query........ [message #245546] Mon, 18 June 2007 01:57 Go to next message
lokhande.dinesh29
Messages: 36
Registered: May 2007
Member
Hi all,

I am taking '2007/06/18'(string as per my requirement) as an input to my script & in one situation i want to diplay the parameter in this format: 070618(means 'yymmdd'). how can i do this?......

Thanks & Regards,
Dinesh
Re: Problem in query........ [message #245550 is a reply to message #245546] Mon, 18 June 2007 02:06 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
TO_CHAR and TO_DATE will help you out:

First make your string a date
Then you can convert it back into a string with your format.

Let's see what you can come up with.

MHE
Re: Problem in query........ [message #245553 is a reply to message #245550] Mon, 18 June 2007 02:15 Go to previous messageGo to next message
lokhande.dinesh29
Messages: 36
Registered: May 2007
Member
Got the solution:
select to_char(to_date('2007/06/18','yyyy/mm/dd'),'yymmdd') from dual;

Thanx......
Re: Problem in query........ [message #245556 is a reply to message #245546] Mon, 18 June 2007 02:22 Go to previous messageGo to next message
michael_bialik
Messages: 611
Registered: July 2006
Senior Member
Why not :

SELECT SUBSTR('2007/06/18',3,2) || SUBSTR('2007/06/18',6,2) || SUBSTR('2007/06/18',9,2) FROM DUAL


?
Re: Problem in query........ [message #245560 is a reply to message #245556] Mon, 18 June 2007 02:25 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Are you being serious here Michael?

What version do you think is more readable? Of which of the two can you say in one view what it does?
Re: Problem in query........ [message #245582 is a reply to message #245560] Mon, 18 June 2007 03:06 Go to previous messageGo to next message
michael_bialik
Messages: 611
Registered: July 2006
Senior Member
I sit corrected.

Michael
Re: Problem in query........ [message #245624 is a reply to message #245560] Mon, 18 June 2007 04:24 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Frank wrote on Mon, 18 June 2007 09:25
Are you being serious here Michael?


Sorry if this sounded harsh; I did not mean it to be rude, but I actually meant it as a question.
Now that I reread it, it sounded rather rude to me..
Re: Problem in query........ [message #245626 is a reply to message #245624] Mon, 18 June 2007 04:26 Go to previous message
michael_bialik
Messages: 611
Registered: July 2006
Senior Member
Frank, don't worry.

No offence taken.

Michael
Previous Topic: What is wrong with this procedure
Next Topic: details of dbms_smpt package in oracle 9i
Goto Forum:
  


Current Time: Mon Dec 05 13:19:26 CST 2016

Total time taken to generate the page: 0.13787 seconds