#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Posts
    18
    Rep Power
    0

    select date type from Oracle table in ColdFusion


    Hi. I am trying to run a query in ColdFusion that includes a date data type. If I run the query in SQL+ I can see the date value but when I run the query from a ColdFusion page the date value is always an empty string.

    Here is how I am inserting the date value:

    Code:
    <cfquery name="my_query" datasource="my_datasource">
    insert into MY_TABLE
    (MY_DATE_FIELD)
    values (<cfqueryparam value="#now()#" cfsqltype="cf_sql_date" />)
    </cfquery>
    I run a query like this to try and get the date value:

    Code:
    <cfquery name="my_query" datasource="my_datasource">
    select MY_DATE_FIELD
    from MY_TABLE
    </cfquery>
    What am I doing wrong? Thank you for your help.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,265
    Rep Power
    968
    now() does not return a valid ODBC date type. Try inserting the date by using the createODBCDate() function.

IMN logo majestic logo threadwatch logo seochat tools logo