Query Of Queries syntax error. Encountered “DELETE.

Posted on May 23, 2009. Filed under: ColdFusion |

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>

Make a Comment

Make a Comment: ( 1 so far )

blockquote and a tags work here.

One Response to “Query Of Queries syntax error. Encountered “DELETE.”

RSS Feed for Comments RSS Feed

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.


Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...