VB.NET

Moderators: seancampbell
Number of threads: 4022
Number of posts: 10035

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to query Date in Oracle Posted by samlow82 on 10 Jul 2003 at 8:08 PM
I'm using Oracle and have some problem about date format.
{
Dim command As New OleDb.OleDbCommand()
command.Connection = connection
command.CommandText = "SELECT COUNT(*) AS COUNT FROM CAR WHERE DATE_KEYIN = '07/07/2003'"
Dim datRead = command.ExecuteReader()
Do Until datRead.Read = False
tb1.Text = datRead(0)
Loop
datRead.Close(
}

I saw the date that was already insert into table is in format 'M/D/YYYY', without hh:mm:ss .
But i search high and low this format is supported in Oracle.
However, it will prompt me ERROR "ORA-01843 Not a valid month"
Report
Re: How to query Date in Oracle Posted by raymcd on 11 Jul 2003 at 10:08 AM
: I'm using Oracle and have some problem about date format.
: {
: Dim command As New OleDb.OleDbCommand()
: command.Connection = connection
: command.CommandText = "SELECT COUNT(*) AS COUNT FROM CAR WHERE DATE_KEYIN = '07/07/2003'"
: Dim datRead = command.ExecuteReader()
: Do Until datRead.Read = False
: tb1.Text = datRead(0)
: Loop
: datRead.Close(
: }
:
: I saw the date that was already insert into table is in format 'M/D/YYYY', without hh:mm:ss .
: But i search high and low this format is supported in Oracle.
: However, it will prompt me ERROR "ORA-01843 Not a valid month"

I always use "WHERE TO_CHAR(DATE_KEYIN, 'YYYYMMDD') = '20030707'" That's also good for sorting since it's year, month, day.

-Ray




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.