I didn't test it against an Oracle DB, but the following works against a SQL
Server DB. Be sure to adjust the cfsqltype according to the data type of
your form field.

<cfqueryparam value="#form.myField#" cfsqltype="cf_sql_varchar"
null="#YesNoFormat(NOT LEN(TRIM(form.myField)))#">

Hope this helps!


On Mon, Jan 11, 2010 at 4:21 PM, Won Lee <[email protected]> wrote:

>
> I'm not sure what to do a search on this subject so please excuse me if
> this
> question was already asked.
>
> I have a form.  It has an optional field. When I go to insert a new record
> into the Oracle DB, the db will throw an error if the formfield is empty.
>
> I can get around this by using a <cfif len(trim(form.fieldname)>.  Is there
> a better way to handle this?  Isn't there a performance hit for this sort
> of
> quasi-dymanic sql statement?
>
> The only thing I can think off the top of my head is when I convert it to a
> stored procedure to check for the length there since quasi-dynamic queries
> have less impact on the DB side.
>
>
> TIA,
> W
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329549
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to