Depending on the database this does not work.  Oracle doesn't allow multiple
SQL statements in a single <cfquery>.  Or if it does, I haven't seen how to
do it.

As for your comment "and never put anything more complex than a simple
function call into a CFQuery block" - why?  Personally I prefer building my
complex dynamic queries inside the <cfquery> where I can follow the logic
better, rather than trying to create a variable with the SQL in it - reminds
me of creating SQL statements in VB!

Dan


-----Original Message-----
From: Christian Gustafson [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 16, 2000 5:22 PM
To: CF-Server
Subject: RE: question about quotations


If you're going to take this route, you should store the SQL in a variable
and submit it to the DB in a single batch, and even add transactional code
if you like:

<cfset Variables.SQL="">
<cfloop list="#form.phone_number#" index="i" delimiters=",">
        <cfset Variables.SQL=Variables.SQL & "delete phone_detail where
phone = '#i#';">
</cfloop> 

<cfquery name="deletePhone" datasource="#application.dsn#">
        #PreserveSingleQuotes(Variables.SQL)#
</cfquery>

As a good rule of thumb, never loop over queries, and never put anything
more complex than a simple function call into a CFQuery block.

Cheers,

Christian Gustafson
Senior Software Engineer
Onvia.com
Work. Wisely.
http://www.onvia.com
(p) 206.373.9307
(c) 206.852.6095


The information contained in this message is privileged and confidential.  It is 
intended solely for the use of the named recipient.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, or use 
of the contents of this transmission is strictly prohibited.  If you receive this 
message in error, please notify the sender immediately.  Thank you.
------------------------------------------------------------------------------
To unsubscribe, send a message to [EMAIL PROTECTED] with 
'unsubscribe' in the body or visit the list page at www.houseoffusion.com

Reply via email to