ORA-00923 - Dynamic query in Oracle

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default ORA-00923 - Dynamic query in Oracle

    Hello all,

    I am developing an app that can work off both MS-SQL and Oracle databases. The
    problem has surfaced where I am now testing in Oracle and a specific piece of
    code that references a query that is stored in the database is cause the
    following error:

    ODBC Error Code = S1000 (General error)


    [Oracle][ODBC][Ora]ORA-00923: FROM keyword not found where expected


    Here is the section of code where it is breaking:

    <cfquery name="variable" datasource="#reports.report_DNS#">
    #preserveSingleQuotes(reports.report_var_query)#
    <cfif #reports.search_number# neq "">


    <cfif #reports.report_var_where# eq "">
    WHERE #reports.report_var_where#
    <cfelse>
    WHERE
    </cfif>
    #reports.report_join_left# #reports.operator#
    '#evaluate("group.#reports.report_join_right#")#'


    <cfloop query="get_where">
    AND #where_left# #where_operator# <cfif #URL.excel# eq
    'YES'>'#evaluate("URL.#where_right#")#'<cfelse>'#e valuate("form.#where_right#")#
    '</cfif>
    </cfloop>
    </cfif>
    #preserveSingleQuotes(reports.report_var_group)#

    </cfquery>


    ------------------
    #reports.report_var_query# is where the query is plugged in and I have tried
    running it in SQLplus, but is still gives me the same error. Here is the value
    that is stored in the database:

    SELECT poc, cdr_month+' '+cdr_year AS date, hcode, cell, calling_card, ldist,
    tfr, atm, fra, dts_mci, dts_spr, dts_ver FROM cdr



    It worked just fine in MS-SQL, but in Oracle it doesn't. Would the query above
    work in Oracle 9i?

    Thanks!!!

    DettCom Guest

  2. Similar Questions and Discussions

    1. query with oracle 10g
      hi all, i run this query in toad and it works but when i try to use it in coldfusion i have no records select...
    2. ora-00923 FROM not found where expected
      i have a query with an inline view, something like "select * from (select user from dual)" although a bit more complicated the query works fine...
    3. ColdFusion+cfquery+Oracle+CLOB+"Query of Query"
      Error message is: Query Of Queries runtime error. Unsupported SQL type "java.sql.Types.CLOB". My database table: RESMIGAZETEFIHRISTI: ...
    4. Error ORA-00923
      Hello, I can not make the databound Navigator (Superexpert Data Form) work on Oracle using the OLEDB part of it I get the following error One...
    5. Oracle SQL query
      Hi, My Oracle sql isn't very good, I need to select from a table events that occurred + / - 28 days from now. So, SELECT blah from table_blah...
  3. #2

    Default Re: ORA-00923 - Dynamic query in Oracle

    Is "date" a reserved word in Oracle? If so, it may be pickier than the other DB flavors.
    philh Guest

  4. #3

    Default Re: ORA-00923 - Dynamic query in Oracle

    I don't know for sure if +'s work also, but I do know (just the other day in
    fact) I had to change my &'s from an access query into double Bars, ||, for
    Oracle concatenation. Hate to say it, but you may need to starting putting in
    datasource specific logic.

    JMGibson3 Guest

  5. #4

    Default Re: ORA-00923 - Dynamic query in Oracle

    Thanks guy for the unbelievable response time!!!

    both of you hit it, by renaming "date", it triggered another error -
    ORA-01722: invalid number. I think that error has something to do with +' '+.

    Do you guys know how to do that in an oracle select statement?

    Thanks again!




    DettCom Guest

  6. #5

    Default Re: ORA-00923 - Dynamic query in Oracle

    I'm sorry, I didn't see the "||" reference. That worked perfectly!!!!
    DettCom Guest

  7. #6

    Default Re: ORA-00923 - Dynamic query in Oracle

    Do you know what the Oracle equivalent would be for sql's ISNULL(variable, '') would be? Thanks
    DettCom Guest

  8. #7

    Default Re: ORA-00923 - Dynamic query in Oracle

    WHERE colname IS NULL,

    but you really oughta pick up a manual or Google up a good site because you'll
    be running across many more differences. Oracle isn't necessarily that
    different from the others but it's sounding like MS-SQL is.

    JMGibson3 Guest

  9. #8

    Default Re: ORA-00923 - Dynamic query in Oracle

    DettCom - I believe Oracle's version of ISNULL() is NVL(). I'm not 100% sure, but you may be able to use the COALESCE() function, in both databases.
    mxstu 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