Query of Queries and LIKE operator

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Query of Queries and LIKE operator

    I am a long time user of query of queries. I changed companies recently, and
    now I can't get the like operator to work with query of queries. Is this a
    server setting, or am I overlooking the obvious? If I remove the like operator,
    the page compiles and runs just fine. Many thanks for any help!!

    <CFQUERY NAME="thisQuery" DATASOURCE="#Request.appDSN#">
    SELECT thisField
    FROM myTable
    </CFQUERY>

    <CFQUERY NAME="QoQthisQuery" DBTYPE="query">
    SELECT thisField
    FROM thisQuery
    WHERE thisField LIKE 'a%'
    </CFQUERY>

    Error:

    The system has attempted to use an undefined value, which usually indicates a
    programming error, either in your code or some system code.

    Null Pointers are another name for undefined values.

    java.lang.NullPointerException

    DannoParker Guest

  2. Similar Questions and Discussions

    1. Syntax error (missing operator) in query expression
      Hi, I have received the following error: ODBC Error Code = 37000 (Syntax error or access violation) Syntax error (missing operator) in query...
    2. Query of Queries on query New type query
      In CF5 we have a page that creates a query, using queryNew and querySetCell and the like, we then used dbtype="query" and gave it's name so we could...
    3. Access: (missing operator) in query expression
      Hi! I operate a database where visitors do inputs directly from the web thru a form. One field has the datatype (property?) Memo and I have not...
    4. Syntax error (missing operator) in query expression'idProperty='
      The following is the code, can someone please help me with the syntax please in the first line please Conn.Execute "UPDATE tblRentalProperty SET...
    5. syntax error (missing operator) query expression
      valuA = (request.form("toadd")) If valuA = "" then SQL = "UPDATE CourseReg SET attended='Active' WHERE ID IN("&request.form("toadd")&")" Set RS =...
  3. #2

    Default Re: Query of Queries and LIKE operator

    What Database are you using? My suggestion any time you are having trouble
    writing a query, is to use the query builder in the database to write the
    query, that way you can refer to its documentation on syntax etc. It also tends
    to give you more verbose errors on what it doesn't like.

    Purple Haze Guest

  4. #3

    Default Re: Query of Queries and LIKE operator

    I'm using an Oracle 9i database. The query returns from the database fine, it just breaks when I try to put a like operator in the query of queries.
    DannoParker Guest

  5. #4

    Default Re: Query of Queries and LIKE operator

    Query of Queries have nothing to do with what database you're using. They run
    exclusively in ColdFusion and don't talk to the database, so syntax is
    exclusive to what ColdFusion both supports and expects.

    As far as I know, ColdFusion doesn't support the LIKE command in Query of
    Queries. The SQL that is supported is a relatively-limited subset of what you
    can do when talking directly to your database.

    Kronin555 Guest

  6. #5

    Default Re: Query of Queries and LIKE operator

    I found a workaround! If I add a WHERE clause to the parent query (WHERE
    thisField = thisField), the query of query works fine with the LIKE operator.
    Very strange........I wonder what the nullPointerException means.....the Java
    compiler must be getting confused.....just one of those things I guess.......

    Thanks for the comments Purple Haze and Kronin555!!

    <CFQUERY NAME="thisQuery" DATASOURCE="#Request.appDSN#">
    SELECT thisField
    FROM myTable
    WHERE thisField = thisField
    </CFQUERY>

    <CFQUERY NAME="QoQthisQuery" DBTYPE="query">
    SELECT thisField
    FROM thisQuery
    WHERE thisField LIKE 'a%'
    </CFQUERY>

    DannoParker Guest

  7. #6

    Default Re: Query of Queries and LIKE operator

    Hi Danno,

    I suspect that in the original query there was a NULL value for thisField.
    When it came to the QofQ it wouldn't be able to compare the NULL value using
    LIKE - hence the Java error that was thrown (NullPointerException).

    Adding the line "WHERE thisField = thisField" would effectively eliminate the
    NULL values. Another option would be to use Oracle's equivalent of the ISNULL()
    function to replace any NULL values with a given value (say a blank string).

    Cheers
    Andy

    Chugglethwaite Guest

  8. #7

    Default Re: Query of Queries and LIKE operator

    Andy,

    Thanks so much for the reply. That was exactly the problem. If I wrap my
    fields with Oracle's version of ISNULL(), which in this example would be
    NVL(thisField,'N/A'), everything works perfectly. Oh, for anyone else who
    stumbles across this post, don't set it to an empty string. i.e.
    NVL(thisField,''). Oracle simply returns it as null again....arghh....

    Thanks again for the help!

    DannoParker Guest

  9. #8

    Default Re: Query of Queries and LIKE operator

    By the way, another solution to this would be: WHERE thisField is not null
    and thisField LIKE 'a%'.
    This is bug 48243, documented here:

    [url]http://www.macromedia.com/support/coldfusion/releasenotes/mx/mx61_known_problems[/url]
    ..html

    DStanten Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139