473,657 Members | 2,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with to_date/to_char

Hi,
Can somebody tell me why this query don't work when I use to_date
Instead of to_char

By using to_char:

select
to_char(last_da y(cast(current_ date - interval '1 month' as date)),'DD.MM.Y YYY')
;

Result: 31.08.2003

By using to_date:

select
to_date(last_da y(cast(current_ date - interval '1 month' as date)),'DD.MM.Y YYY')
;

Result: 01.23.0037

What can I do that this query works correctly with to_date?

Thanxx

Schoeib

4Tek Gesellschaft für angewandte Informationstec hnologien mbH
Schoeib Amin
Tel. +49 (0) 69 697688-132
Fax. +49 (0) 69 697688-111
http://www.4tek.de
Nov 11 '05 #1
1 5673
On Fri, Sep 05, 2003 at 11:26:05AM +0200, Amin Schoeib wrote:
Hi,
Can somebody tell me why this query don't work when I use to_date
Instead of to_char

By using to_char:

select
to_char(last_da y(cast(current_ date - interval '1 month' as date)),'DD.MM.Y YYY')
;

Result: 31.08.2003

By using to_date:

select
to_date(last_da y(cast(current_ date - interval '1 month' as date)),'DD.MM.Y YYY')
;


to_date() do conversion from 'string' to 'data' .... see docs.

Karel

--
Karel Zak <za***@zf.jcu.c z>
http://home.zf.jcu.cz/~zakkr/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 11 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
25295
by: KULJEET | last post by:
hi i have a table c_table with two columns no, date it contains records no n_date 1 10-AUG-03 2 21-AUG-03
3
2247
by: ofer_c33 | last post by:
when i put record into table in this format insert into test(boat_id,strartDate) values(2,to_date('2004-01-02 16:00:00','YYYY-MM-DD HH24:MI:SS')); it is lood ok but when i try to fet the record out i see only the date and not the hour how can i see the hour???/////
3
2507
by: Wei Wang | last post by:
I get compile error for this code: for i in 1..arg_count-1 LOOP RAISE NOTICE quote_literal(to_char(i, ''9'')); END LOOP; where arg_count = 3. I tried RAISE NOTICE to_char(i, ''9''); as well.
1
2419
by: TANUJ | last post by:
i m working on oracle forms 6i n enable to fetch the record in time format. on form, field type is date with format mask hh24:mi but when i fetch it using to_char function nd trans it into to_date func only date show.. not time.. help me.. tanuj
14
4431
by: peteh | last post by:
Hi All; We have many production jobs that "load from cursor" to a UDB/AIX 8.2 (with dpf) data warehouse from source tables residing Oracle 9i. Since Oracle dates are (roughly) equivalent to DB2 timestamps, we frequently use the date() function to "convert" from the Oracle date datatype to the DB2 date datatype. We have used this technique on over 20 Oracle tables for several months with no problem. One table in particular fails with a...
0
2080
by: Lenny | last post by:
Hi. I've a problem with an update from the sqldatasource the table cannot be modified because it is from a third party sw table fields are: codice, fcli_inizio, fcli_fine. keys are codice and fcli_inizio when I run the update the field fcli_fine (not key) is updated but not the fcli_inizio. this is the code. db is in oracle.
0
2438
by: woodsc | last post by:
Hi all, I am trying to optimize the queries in my application. Is there a performance difference between (to_char(myDate,format) < myString) and (myDate < to_date(myString, format)). ex. Select * from myTable where (to_char(fieldDate, 'MM/DD/YYY') <= queryDate ) or Select * from myTable where (fieldDate <= to_date(queryDate, 'MM/DD/YYYY') ) assuming fieldDate is a date or timestamp field and queryDate is '01/01/2007', a...
2
2715
by: moyoal | last post by:
Dear All, Help me! From application i am sending date parameter to report which is in 'DD-MON-RRRR' format... In a table i have a column TRX_DATE in want to compare this column with Form date parameter when i check report argument its something like this
0
8407
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8512
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8612
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.