Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: VB4, Oracle, ODBC

Re: VB4, Oracle, ODBC

From: Carlos Javier Quintero Vivar <cvivar_at_cat.es>
Date: 1998/02/24
Message-ID: <#9fsyYQQ9GA.129@uppssnewspub05.moswest.msn.net>#1/1

Hello Jonathan,

    The better way to manage dates using ODBC databases is to use the ODBC syntax:

    { d 'yyyy-mm-dd'} for dates
    { ts 'yyyy-mm-dd hh:mi:ss'} for timestamps

    For example;

    INSERT INTO T (D1) VALUES ( { d '1998-12-31' } )

    SELECT * FROM T WHERE D1 > { ts '1998-12-31 23:55:44' }

    The ODBC drivers translates the ODBC syntax into native syntax for the database before sending the statement to the database engine.

    So is very portable.

    If you still want to use the native syntax, you must use the Oracle function TO_DATE.

    Regards,

Carlos J. Quintero Vivar
CAT / Canal+
Madrid (Spain)

Jonathan Sayce escribió en mensaje <01bd406d$7a6208e0$9af982c1_at_sedgely>...
>The scene:
>
> An Oracle 7.1 db on Netware, a Win 3.11 pc, and an ODBC link from a 16-bit
>VB 4 app.
>
>The problem:
>
> While I can insert a date into the Oracle system in the format
>"dd-mmm-yy", I cannot run a query on a certain date. The following query
>reports that there is a 'type mismatch':
>
> SELECT field FROM table WHERE date_field = '24-Apr-96'
>
>The date is sent as a string, enclosed in single quotes.
>
>If anyone can suggest how to get round this - either the correct way to
>query a date via ODBC to Oracle or where in the Oracle system I can find
>the full date syntax - I and many others will be eternally grateful.
>
>Cheers,
>Jon.
>
>
>
Received on Tue Feb 24 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US