On 8/17/05, wolf2k5 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to figure out what is the best way to write SQL queries
> including date and time values that will work across several Oracle
> Database installations (different versions and different regional
> settings).
>
> So far I am using some code similar to this:
>
>
> <cfset myMask = "MM/DD/YYYY">
>
> <!--- just for testing, the real value is not the current date --->
> <cfset myDate = DateFormat(Now(),myMask)>
>
> <cfquery name="myQuery" datasource="myDatasource">
> SELECT *
> FROM myTable
> WHERE TRUNC(myDate) < TO_DATE(<cfqueryparam value="#myDate#"
> cfsqltype="CF_SQL_VARCHAR">,<cfqueryparam value="#myMask#"
> cfsqltype="CF_SQL_VARCHAR">)
> </cfquery>
>
>
> It works fine and AFAIK it should be pretty portable to other Oracle
> Database installations.
>
> But I just figured out that simpler code also seems to work fine:
>
>
> <cfset myDate = DateFormat(Now(),myMask)>
>
> <cfquery name="myQuery" datasource="myDatasource">
> SELECT *
> FROM myTable
> WHERE TRUNC(myDate) > <cfqueryparam value="#myDate#" cfsqltype="CF_SQL_DATE">
> </cfquery>
>
>
> I'd like to use it since it's more compact ...
> Will it work fine with all Oracle Database installations?
>
> Also, I found some posts recommending to use the CreateODBCDate function.
> Is that a better way? Why?
>
> Thanks.

Hi there,

I didn't find a good reply to my previous questions yet.

What is the best practice here in your opinion?

Thanks a lot.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222427
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to