Query Of Queries syntax error. Encountered “DELETE.

May 23, 2009 at 5:39 am 1 comment


If you want to delete some rows from a Query of Query with the DELETE statement you will most likely have encountered the error: Query Of Queries syntax error. Encountered “DELETE.

You can’t use the DELETE statementin QoQ.

Try the following instead

<cfquery
dbtype=”query”
name=”rsDelete”>
SELECT        expiryDateTime
, cacheHash
FROM        variables.instance.cacheCollection
WHERE        (expiryDateTime < <cfqueryparam value=”#now()#” cfsqltype=”CF_SQL_DATE”>)
</cfquery>
<cfloop query=”rsDelete”>
rsDelete.deleteRows( javaCast( “int”, (rsDelete.currentRow – 1) ), javaCast( “int”, 1 ) );
</cfloop>

Advertisements

Entry filed under: ColdFusion.

ColdFusion Flickr Photos API CFPOP GMail

1 Comment Add your own

  • 1. quetwo  |  May 25, 2009 at 2:17 am

    You can only use SELECT statements in Query of Query commands. This is pretty clear in the documentation.

    Conversly, because you can use SELECT statements, you can simply NOT select the rows/objects that you are trying to delete.

    Like

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 19 other followers

Archives

Top Rated

Top Clicks

  • None

Blog Stats

  • 168,382 hits

%d bloggers like this: