0
<cfquery dbtype="query" name="LOCAL.modello">
SELECT 
    * 
FROM 
    modelliDelMarchio 
WHERE 
    marchioid = #ARGUMENTS.marchioid#  
    AND tipologia = #ARGUMENTS.tipo# 
    AND nome = '#ARGUMENTS.nome#'
</cfquery>

I have an error on the last query line.

It's:

Query Of Queries runtime error. Comparison exception while executing =. Unsupported Type Comparison Exception: The = operator does not support comparison between the following types: Left hand side expression type = "STRING". Right hand side expression type = "LONG".

I swear that:

  • ARGUMENTS.nome IS a string (I tried with javacast, too!)
  • modelliDelMarchio is a valid DB query, containing real data. "nome" is a varchar.

My version is 9.0.1.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Fabio B.
  • 9,138
  • 25
  • 105
  • 177
  • 2
    Try using `` and see if that helps. It's a good idea to get into the habit of using `cfqueryparam` everywhere. :) – Sean Walsh Jun 25 '12 at 15:51
  • 1
    Also, are you sure that it is `nome` that is causing the error and not one of the other two comparisons? Have you tried putting all three variables into `cfqueryparam`? – Sean Walsh Jun 25 '12 at 16:10
  • 1
    s992 has a very good point - nothing in the error you've posted says that "nome" is the problem, and with the info provided it seems more likely that "marchioid" or "tipologia" are the culprits. Use cfqueryparam for _all_ of them, and if you still get the error, do `` to see what each of the values are. – Peter Boughton Jun 25 '12 at 17:04
  • 1
    In addition to the other suggestions, can you post 1) a dump of the query types ie `getMetaData(yourQoQ)` and 2) the `cfargument` declarations - as well as the actual values used in the query. – Leigh Jun 25 '12 at 18:49

1 Answers1

1

You need to cfqueryparam all of your values. If you can't (or don't want to), then you need to write your expressions like so:

marchioid = '#Arguments.marlchioid#'

If you leave the quotes off and don't use cfqueryparam, the SQL engine will treat those values as either a numeric or boolean value. Strings must be in quotes, or cfqueryparams in order to be treated as strings.

Dan Short
  • 9,598
  • 2
  • 28
  • 53