Hi,
When i Execute this query, I got the result as 29-MAY-07 - select sysdate from dual;
But i want 29-MAY-2007.
What is the query for it?
Thanks,
5 3993
Hi,
When i Execute this query, I got the result as 29-MAY-07 - select sysdate from dual;
But i want 29-MAY-2007.
What is the query for it?
Thanks,
Hi,
It's a pretty straight forward query: -
-
SELECT TO_CHAR(SYSDATE,'DD-MON-YYYY') FROM DUAL
-
-
Cheers!
Hi,
It's a pretty straight forward query: -
-
SELECT TO_CHAR(SYSDATE,'DD-MON-YYYY') FROM DUAL
-
-
Cheers!
Ok. Now it is working. But i need date type not char type. For that what to do?
Thanks,
Srinivas r.
Ok. Now it is working. But i need date type not char type. For that what to do?
Thanks,
Srinivas r.
Hi,
You can still use it as a date field. Try inserting to_char(sysdate,'dd-mon-yyyy')
into a date field in a table and you will come to know.
Anyways the other method of changing the date format is to alter the default format in sqlplus: -
-
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY';
-
-
This changed format will hold good for the current session and is generally used during file loads.
Hope this helped...
Hi,
You can still use it as a date field. Try inserting to_char(sysdate,'dd-mon-yyyy')
into a date field in a table and you will come to know.
Anyways the other method of changing the date format is to alter the default format in sqlplus: -
-
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY';
-
-
This changed format will hold good for the current session and is generally used during file loads.
Hope this helped...
Hi,
When i am using to_char() function, it converts date type to char type. So im getting error in code behind.
Then i do not want to set as NLS_DATE_FORMAT = 'DD-MON-YYYY'.
Because some times i need some other format.
Plz say any other suggestion.
Thanks,
Srinivas r.
Hi,
When i am using to_char() function, it converts date type to char type. So im getting error in code behind.
Then i do not want to set as NLS_DATE_FORMAT = 'DD-MON-YYYY'.
Because some times i need some other format.
Plz say any other suggestion.
Thanks,
Srinivas r.
Hi rsrinivasan,
I guess you are comparing this formatted date with some other date field. If yes then it makes sense to format even that field before doing the actual comparison. For example if say a date variable v_date holds sysdate and you want to compare this then you can do: -
SELECT 1 FROM DUAL WHERE TO_CHAR(V,'DD-MON-YYYY') = TO_CHAR(SYSDATE,'DD-MON-YYYY')
-
If your requirement is something else and then please do let me know.
Cheers!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: WroteForLuck |
last post by:
I am trying to write a simple SQL statement which will take a string
(startdate) in the format DDMMYYYY and compare it to a date stored in
an Oracle database. My SQL is as follows:
<%
"select...
|
by: Yaroslav K. Kravchishin |
last post by:
Oracle 7.0.1 Server
When I type
SQL> select sysdate from dual;
SYSDATE
---------
01-OCT-03
01-OCT-03
2 rows selected.
|
by: Yaroslav K. Kravchishin |
last post by:
Oracle 7.0.1 Server
When I type
SQL> select sysdate from dual;
SYSDATE
---------
01-OCT-03
01-OCT-03
2 rows selected.
|
by: Jouke Langhout |
last post by:
Hello all!
For quite some time now, I've got the following problem:
Access won't close properly when a user closes the application. An
ACCESS process stays active and that process can only be...
|
by: Colleyville Alan |
last post by:
I am using Access and have embedded the ActiveX control Formula One that
came with Office 2000. (ver 3.04). I have created and formatted a
spreadsheet and now I want to copy the info with...
|
by: sajan |
last post by:
Hi,
I new to python.
I'm trying to make changes to an existing python code .
The code has an if condition something like
if datetime(*(time.strptime(creation_date, '%d-%b-%y'))) <...
|
by: sajithamol |
last post by:
What is the difference between current_date & sysdate function?
|
by: premkumarsp1 |
last post by:
hi
in the oracle sysdate, time is coming wrongly. THe date and time in the OS from where i am accessing oracle and in the OS where oracle is installed is correct. I want to know how to update time...
|
by: karuppiah |
last post by:
Hi All,
i need query,how to select last 3 month ,last 3wek,last 3 days , this last 3 month and 3 week should be friday, using sysdate from dual table, there is no exsting table, pls any one help...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |