Results 1 to 2 of 2

Thread: [2005] Working with Oracle Dates

  1. #1

    Thread Starter
    Hyperactive Member oyad's Avatar
    Join Date
    Feb 2003
    Location
    PhoxWare MicroSystems
    Posts
    463

    [2005] Working with Oracle Dates

    Hi
    Am trying to write a dynamic sql query that fetches data from oracle 10g database. My Where criteria is giving me real problems but i guess it has to do with the oracle data format. The data column is a TIMESTAMP data type storing values like 25-JAN-09 07.06.01.000000000 AM. Am trying to get rows having the columns matching a specific date( ignoring the time values), my where looks like this

    WHERE to_date(COMPLY_RUN_DASHBOARD_DATE,'DD-MON-RR')='" & Now.Date & "'"
    i get the following error :
    CheckError
    ORA-01830: date format picture ends before converting entire input string
    plz, any clue?
    Nobody is smarter than all of us!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Working with Oracle Dates

    Don't ever build SQL statements using string concatenation. This is just one example of the problems it causes. If you always use parameters then you'll never encounter this issue or a host of others. Follow the ADO.NET Examples link for several examples of inserting values into SQL code using parameters.

    Just note that that code is for SQL Server, although Oracle code will be almost identical. Where SQL Server prefixes parameters with "@" though, I believe Oracle uses ":".
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width