This is a pretty simple question, and I searched the previous qu开发者_Python百科estions but couldn't find an answer.
How do you insert or create a timestamp in Oracle using Coldfusion?
You can insert it like this:
<cfquery name="qTest">
insert into myTable(myTimestampCol)
values (<cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#" />)
</cfquery>
Hope that helps.
Use Oracle's built-in SYSDATE function.
<cfquery name="qTest">
insert into myTable(myTimestampCol)
values (SYSDATE)
</cfquery>
When possible, I prefer the built-in database function for stuff like this. It's based on the database server clock rather than the ColdFusion server clock. It also avoids the ever-so-small overhead of converting a string to a date and putting it in a bind variable.
精彩评论