Syntax Error In Query

Can someone fix this query for me?  I have been at it for an hour and can't locate the rogue error
ISNULL(CAST(CONVERT(DECIMAL(18,4)(COUNT(CASE WHEN soldStatus IN ('Yes', 'Pending') THEN saleTotal ELSE NULL END))) AS FLOAT)/NULLIF(CAST(CONVERT(DECIMAL(18,4),(COUNT(DISTINCT(saleTotal))) AS FLOAT),0),0) As Percentage

Hello Joe,
You should format your T-SQL more proper, then it's easier to read and easier to find mistakes:
ISNULL(CAST(CONVERT(DECIMAL(18,4),
(COUNT(CASE WHEN soldStatus IN ('Yes', 'Pending')
THEN saleTotal
ELSE NULL END))) AS FLOAT)
/NULLIF(CAST(CONVERT(DECIMAL(18,4), COUNT(DISTINCT(saleTotal))) AS FLOAT),0),0) As Percentage
1. First line, there was a comma behind DECIMAL(18,4), missunt
2. Last line, one opening bracket before COUNT to much
Olaf Helper
[ Blog] [ Xing] [ MVP]

Similar Messages

  • TNG_recordset  Syntax error in query.  Incomplete query clause.

    I'm using the ADDT insert record form wizard and I keep getting this error: Syntax error in query. Incomplete query clause. Can anyone help?
    <br />
    <br /><%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <br />
    <!--#include file="../Connections/rentalpaypro.asp" -->
    <br />
    <!--#include file="../includes/common/KT_common.asp" -->
    <br />
    <!--#include file="../includes/tNG/tNG.inc.asp" -->
    <br /><%<br />'Start log out user<br />  Set logout = new tNG_Logout<br />  logout.setLogoutType "link"<br />  logout.setPageRedirect "../index.html"<br />  logout.Execute<br />'End log out user<br />%>
    <br /><%<br />'Make a transaction dispatcher instance<br />Dim tNGs: Set tNGs = new tNG_dispatcher<br />tNGs.Init "../"<br />%>
    <br /><%<br />' Start trigger<br />Dim formValidation: Set formValidation = new tNG_FormValidation<br />formValidation.Init<br />formValidation.addField "ContactFirstName", true, "text", "", "", "", ""<br />formValidation.addField "ContactLastName", true, "text", "", "", "", ""<br />formValidation.addField "EmailAddress", true, "text", "email", "", "", ""<br />formValidation.addField "BillingAddress", true, "text", "", "", "", ""<br />formValidation.addField "City", true, "text", "", "", "", ""<br />formValidation.addField "StateOrProvince", true, "text", "", "", "", ""<br />formValidation.addField "ZipCode", true, "numeric", "", "", "", ""<br />formValidation.addField "PhoneNumber", true, "text", "", "", "", ""<br />tNGs.prepareValidation formValidation<br />' End trigger<br />%>
    <br /><%<br />'Start Restrict Access to Page<br />  Dim restrict: Set restrict  = new tNG_RestrictAccess<br />  restrict.Init MM_rentalpaypro_STRING, "../"<br />'Grand Levels: Any<br />  restrict.Execute<br />'End Restrict Access to Page<br />%>
    <br /><%<br />' Make an insert transaction instance <br />Dim ins__Landlord_Contact_Info_: Set ins__Landlord_Contact_Info_ = new tNG_insert<br />ins__Landlord_Contact_Info_.init MM_rentalpaypro_STRING<br />tNGs.addTransaction ins__Landlord_Contact_Info_<br />' Register triggers<br />ins__Landlord_Contact_Info_.registerTrigger Array("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1")<br />ins__Landlord_Contact_Info_.registerTrigger Array("BEFORE", "Trigger_Default_FormValidation", 10, formValidation)<br />ins__Landlord_Contact_Info_.registerTrigger Array("END", "Trigger_Default_Redirect", 99, "index.asp")<br />' Add columns<br />ins__Landlord_Contact_Info_.setTable ""Landlord_Contact Info""<br />ins__Landlord_Contact_Info_.addColumn "ContactFirstName", "STRING_TYPE", "POST", "ContactFirstName", ""<br />ins__Landlord_Contact_Info_.addColumn "ContactLastName", "STRING_TYPE", "POST", "ContactLastName", ""<br />ins__Landlord_Contact_Info_.addColumn "EmailAddress", "STRING_TYPE", "POST", "EmailAddress", ""<br />ins__Landlord_Contact_Info_.addColumn "BillingAddress", "STRING_TYPE", "POST", "BillingAddress", ""<br />ins__Landlord_Contact_Info_.addColumn "City", "STRING_TYPE", "POST", "City", ""<br />ins__Landlord_Contact_Info_.addColumn "CompanyName", "STRING_TYPE", "POST", "CompanyName", ""<br />ins__Landlord_Contact_Info_.addColumn "StateOrProvince", "STRING_TYPE", "POST", "StateOrProvince", ""<br />ins__Landlord_Contact_Info_.addColumn "ZipCode", "NUMERIC_TYPE", "POST", "ZipCode", ""<br />ins__Landlord_Contact_Info_.addColumn "Extension", "STRING_TYPE", "POST", "Extension", ""<br />ins__Landlord_Contact_Info_.addColumn "FaxNumber", "STRING_TYPE", "POST", "FaxNumber", ""<br />ins__Landlord_Contact_Info_.addColumn "PhoneNumber", "STRING_TYPE", "POST", "PhoneNumber", ""<br />ins__Landlord_Contact_Info_.setPrimaryKey "ContactInfoID", "NUMERIC_TYPE", "", ""<br />%>
    <br /><%<br />'Execute all the registered transactions<br />tNGs.executeTransactions<br />%>
    <br /><%<br />'Get the transaction recordset<br />Dim rs_Landlord_Contact_Info_<br />Dim rs_Landlord_Contact_Info__numRows<br /><br />Set rs_Landlord_Contact_Info_ = tNGs.getRecordset(""Landlord_Contact Info"")<br />rs_Landlord_Contact_Info__numRows = 0<br />%>

    Are you sure that you are passing the querystring customerid
    when the form
    company_cus is empty.
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "aonefun" <[email protected]> wrote in
    message
    news:epmf3n$f3u$[email protected]..
    >I am receiving the following error message:
    >
    > Microsoft][ODBC Microsoft Access Driver] Syntax error
    (missing operator)
    > in
    > query expression 'customerid_cus='.
    >
    > for the following code:
    >
    > If IsEmpty(Request.Form("company_cus")) Then
    >
    > rs_company.Source = "SELECT customerid_cus, company_cus
    FROM
    > customers_cus
    > WHERE customerid_cus= "&
    Request.QueryString("customerid") &" "
    >
    > Else
    >
    > rs_company.Source = "SELECT customerid_cus, company_cus
    FROM
    > customers_cus
    > WHERE company_cus = '"& Request.Form("company_cus")
    >
    > End If
    >
    > What could the problem be?
    >

  • Syntax error (parsing query)

    I'm trying to search based on two properties and got an exception:
    syntax error (parsing query);location=trexsahqt1v:30003 (Errorcode 2029)
    If i set only one condition my code is working fine
    My code....
    for(int i = 0; i < searchParams.length; i++)
    IQueryEntry queryEntry = indexCollection.getNewQueryEntry()    
    if ("createdby".equalsIgnoreCase(searchParams<i>.getPropertyName()))
             queryEntry.setRowType(IQueryEntry.ROW_TYPE_ATTRIBUTE);
             queryEntry.setTermAction(IQueryEntry.TERM_ACTION_EXACT);
             queryEntry.setPropertyName(PropertyName.createCreatedBy());
             queryEntry.setValue("same value")
             queryEntry.setPropertyOperator(IQueryEntry.PROPERTY_OPERATOR_EQUAL);
             queryEntryList.add(queryEntry);
       if ("modifiedby:".equalsIgnoreCase(searchParams<i>.getPropertyName()))
             queryEntry.setRowType(IQueryEntry.ROW_TYPE_ATTRIBUTE);
             queryEntry.setTermAction(IQueryEntry.TERM_ACTION_EXACT);
             queryEntry.setPropertyName(PropertyName.createCreatedBy());
             queryEntry.setValue("same value");
             queryEntry.setPropertyOperator(IQueryEntry.PROPERTY_OPERATOR_EQUAL);
             queryEntryList.add(queryEntry);
    Is any "AND" or "OR" operators I have to setup , if yes please let me know how?
    Really appreciate your help

    I'm trying to search based on two properties and got an exception:
    syntax error (parsing query);location=trexsahqt1v:30003 (Errorcode 2029)
    If i set only one condition my code is working fine
    My code....
    for(int i = 0; i < searchParams.length; i++)
    IQueryEntry queryEntry = indexCollection.getNewQueryEntry()    
    if ("createdby".equalsIgnoreCase(searchParams<i>.getPropertyName()))
             queryEntry.setRowType(IQueryEntry.ROW_TYPE_ATTRIBUTE);
             queryEntry.setTermAction(IQueryEntry.TERM_ACTION_EXACT);
             queryEntry.setPropertyName(PropertyName.createCreatedBy());
             queryEntry.setValue("same value")
             queryEntry.setPropertyOperator(IQueryEntry.PROPERTY_OPERATOR_EQUAL);
             queryEntryList.add(queryEntry);
       if ("modifiedby:".equalsIgnoreCase(searchParams<i>.getPropertyName()))
             queryEntry.setRowType(IQueryEntry.ROW_TYPE_ATTRIBUTE);
             queryEntry.setTermAction(IQueryEntry.TERM_ACTION_EXACT);
             queryEntry.setPropertyName(PropertyName.createCreatedBy());
             queryEntry.setValue("same value");
             queryEntry.setPropertyOperator(IQueryEntry.PROPERTY_OPERATOR_EQUAL);
             queryEntryList.add(queryEntry);
    Is any "AND" or "OR" operators I have to setup , if yes please let me know how?
    Really appreciate your help

  • Syntax error in query expression

    I am receiving the following error message:
    Microsoft][ODBC Microsoft Access Driver] Syntax error
    (missing operator) in query expression 'customerid_cus='.
    for the following code:
    If IsEmpty(Request.Form("company_cus")) Then
    rs_company.Source = "SELECT customerid_cus, company_cus FROM
    customers_cus WHERE customerid_cus= "&
    Request.QueryString("customerid") &" "
    Else
    rs_company.Source = "SELECT customerid_cus, company_cus FROM
    customers_cus WHERE company_cus = '"&
    Request.Form("company_cus") &"' "
    End If
    What could the problem be?

    Are you sure that you are passing the querystring customerid
    when the form
    company_cus is empty.
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "aonefun" <[email protected]> wrote in
    message
    news:epmf3n$f3u$[email protected]..
    >I am receiving the following error message:
    >
    > Microsoft][ODBC Microsoft Access Driver] Syntax error
    (missing operator)
    > in
    > query expression 'customerid_cus='.
    >
    > for the following code:
    >
    > If IsEmpty(Request.Form("company_cus")) Then
    >
    > rs_company.Source = "SELECT customerid_cus, company_cus
    FROM
    > customers_cus
    > WHERE customerid_cus= "&
    Request.QueryString("customerid") &" "
    >
    > Else
    >
    > rs_company.Source = "SELECT customerid_cus, company_cus
    FROM
    > customers_cus
    > WHERE company_cus = '"& Request.Form("company_cus")
    >
    > End If
    >
    > What could the problem be?
    >

  • 11g gateway for ODBC returns SYNTAX ERROR on query

    Hi,
    I have made a database link to an odbc link on a 11g gateway. The odbc driver for the database in question is called connx, a third party driver to connect to RMS files on an old vax. The odbc driver works fine as I tested it independently of the gateway.
    The database link connection is fine. I do desc tablename and it returns the correct columns
    I do for example select * from SICF090MLT@melt and it returns :
    meltdb>select * from SICF090MLT@melt;
    select * from SICF090MLT@melt
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    Illegal identifier
    A1."CHARGE_NO" , A1."MIX_ID" , A1."BUCKET_ID" , A1."AIM_ST" , A1."SCRAP_MIX_NAME" FROM << Syntax Error >> 'SICF090MLT' A1
    ORA-02063: preceding 3 lines from MELT
    As you can see all of the columns have been discovered by the query,
    I am not sure what can be the issue. Maybe a character translation issue? Some configuration settings for the gateway? Any ideas?
    On a side note: all other database links to other databases (sqlserver) work fine with this 11g gateway.
    The Best to all of you!

    Mireille,
    I am using a win32 driver.
    HS_FDS_SUPPORT_STATISTICS is false for all my database links. I have had issues with that in the past and have already learned my lesson :)
    I will check the quoted identifier setting for my odbc link and change it if I can.
    As a side note: for now I am using the DBMS_HS_PASSTHROUGH package to get around the problem, but it is better if I solve my original problem obviously. I will let you know.
    Merci et bonne journée.

  • SQLException syntax error in query

    I am baffled and hoping that maybe you can spot an error in my query - I can't seem to find it!
    The query is:
    INSERT INTO CreditCard (userID, type, name, number, expiration, addressID) VALUES (5, 1, 'Bill', '1264', 2004-04-10, 9)
    And in code it is:
    String sql = "INSERT INTO CreditCard (userID, type, name, number," + " expiration, addressID) VALUES (" + userId + ", " + type + ", \'" + name + "\', \'" + number + "\', " + expiration + ", " + addressId + ")";
    I keep getting error for this line:
    stmt.execute(sql);
    with the following message:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3065)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
    at jauction.server.CreditCardImpl.<init>(CreditCardImpl.java:65)
    at jauction.server.CreditCardTest.main(CreditCardTest.java:14)
    Do you spot the syntax error in the query? Is there any other reason why I could be getting this error?
    Similar INSERT INTO queries have been implemented and tested in this project of mine and they are working fine. I am baffled as to where the syntax error is in this query. If you spot it - could you point it out? Thanks.

    Thanks man, you saved me hours of debugging.
    I had an Access table with a column named TimeStamp, just couldn't get the damn thing to work. But I think both our problems are JDBC/SQL related, not Access related. In other words, it wouldn't work on any other RDBMS system either.
    Someone should put it in the documentation somewhere that using SQL datatype names for column names is a no-no.

  • Syntax error on query generation

    Hi,
    When I try to generate report syntax error occures. It's not a custom code. What do you think about it ?
    (syntax error in the following code:
      return.
      perform Debug_xfems.
    See some piece of generated file :
    REPORT RSRRNAME.
    FORM SELECT_4.
      if G_S_QCF-cmess eq rrkg_C_cmess-error.
        perform CU_MESS_send.
      endif.
        read Table <G_THX_s> assigning <G_SX_S>
             with table key k = G_SX_s-k.
        if sy-subrc gt 0.
          insert G_SX_S into table <G_THX_S> assigning <G_SX_S>.
        endif.
    ENDFORM.
      FORM MOVE_Z_SP_0001.
    ENDFORM.
      return.
      perform Debug_xfems.
    form check_fems using value(I_fems) type i.
      perform I_fems of           " REP I_FEMS = 2
              MOVE_Z_SP_0001
              DEBUG_XFems.
    endform.                      " now look at G_TSX_XFems
    Thanks in advance.
    Fiodar.

    Hi,
    I would suggest that you check OSS for existing SAP notes on the issue and if you find nothing, please create a SAP customer message.
    All the best,
    Mike

  • Query syntax error after multiprovider change

    Hi everyone,
    I removed key figures from a multicube, changed a query on top afterwards and saved it. The key figures are no longer in the key figure list of the query in the Query designer, and are no longer used in any place within the query.
    Now, I'm getting a syntax error on query execution, since the compiled query still contains a reference to the old key figures. Regeneration via RSRT or saving under a new name doesn't work, and to delete the generated report I need a developer key.
    Any ideas?
    Regards,
    Tilman

    Hi Shashank,
    thanks for your response.
    I did try the "check query" button, it didn't return an error. When executing the query via rsrt, I get a dump due to "Syntax error in program GP48VM7K0MSF08DRO2382A2PSTI ". The program still contains data type references to the removed infoobjects. When checking the program via SE38, you get just that syntax error.
    I'm looking for a way to clean these things up. Even when creating a new query on the aggregation level (I was talking about a multiprovider earlier, which is located underneath), the error pops up. I activated all the objects along the way, with no effect.
    Regards,
    Tilman

  • Syntax Errors in Recordset, Dreamweaver 8

    Hi All!
    I'm struggling to figure out Dreamweaver's syntax for a Recordset I'm building.  I'm using Dreamweaver 8, ColdFusion 9 to connect with my database, and Windows 7.
    I have to start by admitting I copied code from an similar program, and am trying to get it to work for me.
    Here's the error I get when I "test" the recordset:
    Syntax error. in query expression '1=1
    Here's the query:
    SELECT LastName, FirstName, MiddleName, Generation, PartyType
    FROM [Party Information]
    WHERE 1=1
      SELECT FullCaseNo, DocketSheet
      FROM [Case Information]
      WHERE 1=1
      <cfif IsDefined("Form.LastName") and Form.LastName NEQ "">
       AND PartyInformation.Last Like'#Form.LastName#%'
      </cfif>
      <cfif IsDefined("Form.FirstName") and Form.FirstName NEQ "">
       AND PartyInformation.First Like'#Form.FirstName#%'
      </cfif>
            <cfif IsDefined("Form.CaseNo") and Form.CaseNo NEQ "">
       AND CaseInformation.FullCaseNo ='#Form.CaseNo#'
      </cfif>
    ORDER BY LastName, FirstName, MiddleName, FullCaseNo
    For the sake of just seeing I deleted "WHERE 1=1" just to see if it would run, and I got another syntax error in the FROM clause.  In case this wasn't already obvious I'm brand new to Dreamweaver and just trying to get this thing to work.
    Any help is much appreciated, thanks in advance!!

    That's sad to hear.
    Anyway, if you're continuing to work on this, why dont you try replacing this:
    SELECT LastName, FirstName, MiddleName, Generation, PartyType
    FROM [Party Information]
    WHERE 1=1
    with this:
    SELECT LastName, FirstName, MiddleName, Generation, PartyType
    FROM PartyInformation
    WHERE 0=1
    WHERE 1=1 is usually a SQL code to prevent injections and to increase performance of the query you're running.
    WHERE 0=1 will usually look up all records in the table you're querying into - this is what you're trying to achieve here anyway.
    and rename the table on your DB from Party Information to PartyInformation

  • Syntax error while writing a select query.

    Hi all,
    I have a requirement where I have to pick a value if the text for that value is
    MYCARu2019S Lovliest Car.
    And so I wrote a query that
    SELECT     RUECK INTO XRUECK FROM AFVC WHERE ltxa1 = ' MYCARu2019S Lovliest Car'.
                    ENDSELECT.
    But it gives me a syntax error saying     
    u201CLiterals taking up more than one line not permittedu201D.
    Can some one tell me what is wrong. I need to select RUECK value from AFVC  table if
    ltxa1 value is ' MYCARu2019S Lovliest Car'.
    Kindly help what is going wrong...
    Regards,
    Jessica Sam

    Hi,
    Narendran is right use two single quotes.
    also careful wile comparing string. i think as you write ltxa1 value is ' MYCARu2019S Lovliest Car'.
    so while comparing you must not use space just before staring use the following
    SELECT  rueck INTO xrueck FROM afvc WHERE ltxa1 = 'MYCAR''S Lovliest Car'. " Not use Space before M
    ENDSELECT.
    Hope will help you.
    Kind Regards,
    Faisal

  • Select-options in SELECT query - syntax error

    Hi all,
      I get the error below when I try to use the select options in a SELECT query . Please help me.
    "The IN operator with "SO_AWART" is followed neither by an internal
    table nor by a value list."
    The code i have used(Logical database  PNP is used):
    TABLES: pernr,
            catsdb.
    INCLUDE ztime_cwtr_top.    " global Data
    INCLUDE ztime_cwtr_f01.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    SELECT-OPTIONS SO_AWART FOR CATSDB-AWART.
    PARAMETERS P_THRES TYPE I.
    SELECTION-SCREEN END OF BLOCK B1.
    Get data from CATSDB table. Workdates within the date interval are considered.
      SELECT pernr workdate awart catsquantity beguz enduz status
      FROM catsdb
      INTO TABLE it_catsdb
      WHERE pernr  = pernr-pernr    AND
           workdate GE pn-begda     AND
           workdate LE pn-endda     AND
           status   IN ('20', '30') AND
           awart    IN  so_awart .
          awart    IN ('1100', '1137', '1138', '1139', '1140',
                      '1147', '1148', '1149', '1157', '2003' ).
    when I give the values directly i do not get any syntax error, but when I use select options in the where condition I get the syntax error.
    I have tried different options like using only the select-options in the where condition.
    Thanks in advance.....
    Madhu

    Solved.
    Code with syntax error:
    include z...top .
    include z...fo1.
    select-options: xxxxxxx
    Code  with no syntax error:
    select-options: xxxxxxx
    include z...top .
    include z...fo1.
    Thanks for all your help,
    Madhu

  • Can not use SUM in a simple query because of a syntax error?

    Hi
    Thank you for reading my post.
    I am trying to execute the following query:
    q = em.createQuery("SELECT SUM((NE.pipeLength - 0.6)+((NE.networkDepth-NE.initialDepth)*0.41)+ NE.standLenght)  FROM NExpansion NE  where (( NE.contract.contractor=:contractor) AND (NE.pDiameter=:diameter))");
                  q.setParameter("contractor", contractor);
    q.setParameter("diameter", diameter);
         l =  (Long) q.getSingleResult();And I get the following error:
    Caused by: Exception [TOPLINK-8025] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EJBQLException
    Exception Description: Syntax error parsing the query [SELECT SUM((NE.pipeLength - 0.6)+((NE.networkDepth-NE.initialDepth)*0.41)+ NE.standLenght)  FROM NExpansion NE  where (( NE.contract.contractor=:contractor) AND (NE.pDiameter=:diameter))], line 1, column 12: unexpected token [(].
    Internal Exception: line 1:12: unexpected token: (
            at oracle.toplink.essentials.exceptions.EJBQLException.unexpectedToken(EJBQLException.java:389)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.handleANTLRException(EJBQLParser.java:350)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.addError(EJBQLParser.java:278)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.reportError(EJBQLParser.java:378)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.aggregateExpression(EJBQLParser.java:1416)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.selectExpression(EJBQLParser.java:1158)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.selectClause(EJBQLParser.java:403)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.selectStatement(EJBQLParser.java:178)
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.document(EJBQLParser.java:135)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.parse(EJBQLParser.java:166)
            at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.buildParseTree(EJBQLParser.java:127)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:215)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:189)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:153)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:114)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:99)
            at oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.<init>(EJBQueryImpl.java:86)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:204)
            ... 30 more
    Caused by: line 1:12: unexpected token: (
            at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.aggregateExpression(EJBQLParser.java:1365)
            ... 43 morePlease let me know what am I doing wrong?
    Thanks.

    Hello,
    From the grammar in the JPA spec, SUM only takes a state_field_path_expression which is defined as
    state_field_path_expression := {identification_variable | single_valued_association_path_expression}.state_field
    Please feel free to file an enhancement to have this expanded upon.
    Best Regards,
    Chris

  • InfoSet Query: Syntax Error while generating the program.

    Dear All,
    I have a Query in CRM system which contains an Infoset based on LDB.
    The InfoSet Query throws up a Syntax error while generating the program.
    So, we are not able to change the Infoset using the Infoset Query through SQ01.
    The error is as follows:-
    Syntax error in program "AQZZ==/SAPQUERY/CRM_ACTMON1 ".
    Error in the ABAP Application Program
    The current ABAP program "CL_QUERY_OUTPUT_DEFINITION====CP" had to be
    terminated because it has
    come across a statement that unfortunately cannot be executed.
    The following syntax error occurred in program "AQZZ==/SAPQUERY/CRM_ACTMON1 "
    in include "AQZZ==/SAPQUERY/CRM_ACTMON1 " in
    line 28:
    ""CRMT_REPORT_LOCATORLIST" must be a flat structure. You cannot use int"
    "ernal tables, strings, references, or structures as components. -"
    Please help me arrive at an solution, so that we are able to change the Infoset through the InfoSet Query.
    Awaiting your reply as soon as possible.
    Thanks and Regards,
    Pankaj.

    There is an error in your query, specifically in the definition of CRMT_REPORT_LOCATORLIST. In the short dump (transaction ST22) you will see more details and the exact location of an error if you just scroll down.
    I can't tell more because this problem is specific to your system, to which I have no access. Read the whole dump and look at all the objects mentioned there.

  • AVG calculation and syntax error while parsing a named query

    Hi all,
    I've to calcolate the average of polling results for each value column (5 value column in total). I want to use this single row result line for a bar graph.
    I created a new named query in the EJB:
    @NamedQueries({
      @NamedQuery(name = "Polls.findAll", query = "select o from Polls o"),
      @NamedQuery(name = "Polls.findAVG", query = "select o AVG(Value1) as Value1, AVG(Value2)  as Value2, AVG(Value3)  as Value3, AVG(Value4)  as Value4, AVG(Value5)  as Value5 o from Polls o")   // <-- my named query
    ...I tried it in the sql query tool of Oracle 10g XE and sql syntax is ok, but when I run my javaServiceFacade on JDev I receive this message:
    Exception in thread "main" Local Exception Stack:
    Exception [EclipseLink-8023] (Eclipse Persistence Services - 1.0.1 (Build 20080905)): org.eclipse.persistence.exceptions.JPQLException
    Exception Description: Syntax error parsing the query [Polls.findAVG: select AVG(Value1) as Value1, AVG(Value2)  as Value2, AVG(Value3) as Value3, AVG(Value4) as Value4, AVG(Value5) as Value5 o from Polls o].
    Internal Exception: org.eclipse.persistence.internal.libraries.antlr.runtime.EarlyExitException
    ...Where is the syntax error in my named query?
    Edited by: Silicio on 22-nov-2008 1.05

    Thanks Shay, now I think syntax is correct for gain an average for each column:
    @NamedQuery(name = "Polls.findAVG", query = "select AVG(o.value1), AVG(o.value2), AVG(o.value3), AVG(o.value4), AVG(o.value5) from Polls o")But still got some trouble to get a bar graph...
    If I drag&drop that query from data control, I get an empty graph with 5 values ,look http://img153.imageshack.us/img153/8710/emptygraphag7.png .
    In the log there is some errors (due that named query and its methods in EJB):
    AVVERTENZA: Transient state added to StateManager.  State may not be serialized.  State id:  data.oracle_view_risultatiPageDef.Polls1__cubicDefinition
    23-nov-2008 11.08.28 oracle.adf.share.http.HttpSessionStateManagerImpl putState
    AVVERTENZA: Transient state added to StateManager.  State may not be serialized.  State id:  data.oracle_view_risultatiPageDef.Polls1__dataModel
    [EL Info]: 2008.11.23 11:08:29.546--ServerSession(20936795)--EclipseLink, version: Eclipse Persistence Services - 1.0.1 (Build 20080905)
    [EL Info]: 2008.11.23 11:08:29.562--ServerSession(20936795)--Server: WebLogic Server Temporary Patch for CR380042 Thu Sep 11 13:33:40 PDT 2008
    [EL Info]: 2008.11.23 11:08:29.562--ServerSession(20936795)--file:/C:/Oracle/Middleware/jdeveloper/system/system11.1.1.0.31.51.56/o.j2ee/drs/Application13/Application13-Model-ejb/-Model login successful
    23-nov-2008 11.08.37 oracle.adfinternal.view.faces.config.rich.RegistrationConfigurator handleError
    GRAVE: Server Exception during PPR, #1
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: groovy.lang.MissingPropertyException, msg=Exception evaluating property 'id' for java.util.Arrays$ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: id for class: java.lang.Double
         at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:753)
         at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:779)
         at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:690)
         at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:1816)
         at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1554)
         at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1634)
         at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:746)
         at oracle.adf.model.bean.DCDataRow.getAttributeInternal(DCDataRow.java:352)
         at oracle.jbo.server.ViewRowImpl.getKey(ViewRowImpl.java:598)
         at oracle.adf.model.bean.DCDataRow.getKey(DCDataRow.java:149)
         at oracle.adf.model.binding.DCIteratorBinding.buildFormToken(DCIteratorBinding.java:3836)
         at oracle.adf.model.binding.DCBindingContainerState.buildStringBuffer(DCBindingContainerState.java:71)
         at oracle.adf.model.binding.DCBindingContainerState.toString(DCBindingContainerState.java:590)
         at oracle.adf.model.binding.DCBindingContainer.getStateToken(DCBindingContainer.java:4293)
         at oracle.adfinternal.controller.application.model.SaveStateTokenListener.afterPhase(SaveStateTokenListener.java:54)
         at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.afterPhase(ADFLifecycleImpl.java:529)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchAfterEvent(LifecycleImpl.java:118)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchAfterPagePhaseEvent(LifecycleImpl.java:166)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.dispatchAfterPagePhaseEvent(ADFPhaseListener.java:122)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:68)
         at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:51)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:354)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:203)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:278)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:238)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:195)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:138)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:102)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: groovy.lang.MissingPropertyException: Exception evaluating property 'id' for java.util.Arrays$ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: id for class: java.lang.Double
         at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:2978)
         at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1368)
         at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:2578)
         at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:178)
         at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:474)
         at Script1.run(Script1.groovy)
         at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:741)
         ... 50 more
    ## Detail 0 ##
    groovy.lang.MissingPropertyException: Exception evaluating property 'id' for java.util.Arrays$ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: id for class: java.lang.Double
         at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:2978)
         at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1368)
         at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:2578)
         at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:178)
         at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:474)
         at Script1.run(Script1.groovy)
         at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:741)
         at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:779)
         at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:690)
         at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:1816)
         at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1554)
         at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1634)
         at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:746)
         at oracle.adf.model.bean.DCDataRow.getAttributeInternal(DCDataRow.java:352)
         at oracle.jbo.server.ViewRowImpl.getKey(ViewRowImpl.java:598)
         at oracle.adf.model.bean.DCDataRow.getKey(DCDataRow.java:149)
         at oracle.adf.model.binding.DCIteratorBinding.buildFormToken(DCIteratorBinding.java:3836)
         at oracle.adf.model.binding.DCBindingContainerState.buildStringBuffer(DCBindingContainerState.java:71)
         at oracle.adf.model.binding.DCBindingContainerState.toString(DCBindingContainerState.java:590)
         at oracle.adf.model.binding.DCBindingContainer.getStateToken(DCBindingContainer.java:4293)
         at oracle.adfinternal.controller.application.model.SaveStateTokenListener.afterPhase(SaveStateTokenListener.java:54)
         at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.afterPhase(ADFLifecycleImpl.java:529)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchAfterEvent(LifecycleImpl.java:118)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchAfterPagePhaseEvent(LifecycleImpl.java:166)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.dispatchAfterPagePhaseEvent(ADFPhaseListener.java:122)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:68)
         at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:51)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:354)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:203)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:278)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:238)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:195)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:138)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:102)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)I try to print out a singlue AVG value in this way (main method of javaServerFacade class):
        public static void main(String [] args) {
            final JavaServiceFacade javaServiceFacade = new JavaServiceFacade();
            //  TODO:  Call methods on javaServiceFacade here...
            List<Polls> pollsAVG = javaServiceFacade.queryPollsFindAVG();
            for (Polls a: pollsAVG){
                System.out.println(a.getValue1());
    ...I get this error:
    Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to oracle.model.Polls
         at oracle.model.JavaServiceFacade.main(JavaServiceFacade.java:25)
    Process exited with exit code 1.
    ...I've searched for Ljava in the documantation finding nothing interesting.

  • MS SQL - Syntax error for valid query

    I have a problem with the second query in this code (gives me
    a syntax error in my HAVING line)
    <cfquery name="getDupes" datasource="#application.ODBC1#"
    dbtype="ODBC" username="#application.userNameODBC1#"
    password="#application.userPassODBC1#">
    SELECT *
    FROM view_FormCount
    WHERE formCount >= 2
    ORDER BY formNum
    </cfquery>
    <cfset variables.lstForms = "">
    <cfoutput query="getDupes">
    <cfset variables.lstForms=
    listAppend(variables.lstForms,"'#getDupes.formNum#'")>
    </cfoutput>
    <cfset variables.whereClause = "(formNum =
    #ReplaceNoCase(variables.lstForms,',',' OR formNum =
    ','ALL')#)">
    <cfquery name="getDetails"
    datasource="#application.ODBC1#" dbtype="ODBC"
    username="#application.userNameODBC1#"
    password="#application.userPassODBC1#">
    SELECT tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr
    FROM tblForms INNER JOIN tblCompanies ON tblForms.formCustNum
    = tblCompanies.companyNum
    GROUP BY tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr
    HAVING #variables.whereClause#
    ORDER BY tblForms.formNum, tblForms.formCustNum
    </cfquery>
    Now, the really odd thing is if I just take the query text
    out of the CFQUERY tags and use CFOUTPUT instead (to see in my
    browser what query is getting executed) I get a query that I can
    paste into Enterprise Mgr and runs fine.
    I can even paste the resulting text into my code in a CFQUERY
    and CF will run it fine.
    In other words, the dynamic version query gives me an error,
    but if I just output the SQL statement, copy-and-paste that into
    the CFQUERY that's erroring out (replacing what's there) to run as
    a static query, it works fine (sample of static query below).
    The error I get when I try to do it dynamically is "Error
    Executing Database Query. [Macromedia][SQLServer JDBC
    Driver][SQLServer]Line 4: Incorrect syntax near '10169318'. The
    error occurred on line 21." which is where the HAVING clause
    starts.
    SELECT tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr FROM tblForms INNER
    JOIN tblCompanies ON tblForms.formCustNum = tblCompanies.companyNum
    GROUP BY tblForms.formNum, tblForms.formName, tblForms.formCustNum,
    tblCompanies.companyAbbr HAVING (formNum = '10169318' OR formNum =
    '1016CONCERTA' OR formNum = '1016NSAIDS' OR formNum =
    '1016STRATTERA' OR formNum = '1016WELLBUTRIN' OR formNum =
    '18504211' OR formNum = '185093807' OR formNum = '73208565' OR
    formNum = '732120027' OR formNum = '7322154' OR formNum = '7323402'
    OR formNum = '7323522' OR formNum = '73238900' OR formNum =
    '7324211' OR formNum = '7324211S' OR formNum = '7324265' OR formNum
    = '73242891' OR formNum = '732434341' OR formNum = '732434342' OR
    formNum = '73243435' OR formNum = '73243436' OR formNum =
    '73243439' OR formNum = '73243440' OR formNum = '73243441' OR
    formNum = '73243442' OR formNum = '73243443' OR formNum = '7324359'
    OR formNum = '7324360' OR formNum = '7324370' OR formNum =
    '7324560' OR formNum = '7324959' OR formNum = '7326411ptreg' OR
    formNum = '7326599' OR formNum = '7326600' OR formNum = '7326620'
    OR formNum = '7326707' OR formNum = '7326931' OR formNum =
    '7328410' OR formNum = '732851031TOP' OR formNum = '7328512' OR
    formNum = '7328548' OR formNum = '7328548P2' OR formNum =
    '7328548P3' OR formNum = '7328548P4' OR formNum = '73289400' OR
    formNum = '73290D' OR formNum = '7329154' OR formNum =
    '73291544JHS' OR formNum = '73291545JHS' OR formNum =
    '73291546JHSMH' OR formNum = '73291547JHSMH' OR formNum = '7329174'
    OR formNum = '7329308' OR formNum = '7329402' OR formNum =
    '7329424' OR formNum = '7329455' OR formNum = '7329520' OR formNum
    = '7329539' OR formNum = '73297701JH' OR formNum = '73298273' OR
    formNum = '73298400' OR formNum = '73298403' OR formNum =
    '73298404' OR formNum = '7329883' OR formNum = '73298860' OR
    formNum = '7329887' OR formNum = '73298974' OR formNum = '7329899'
    OR formNum = '7329899S' OR formNum = '73299190' OR formNum =
    '7329987' OR formNum = '7329999PTO' OR formNum = '732AV5160' OR
    formNum = '732CMHFRAZ' OR formNum = '732HIPAA' OR formNum =
    '732HIPAAFLYERS' OR formNum = '734HEART' OR formNum = '7444711' OR
    formNum = '7449230' OR formNum = '744HR4991' OR formNum =
    '7538014MI' OR formNum = '77511044' OR formNum = '77511045' OR
    formNum = '775stampnochange' OR formNum = '80851001BLUE' OR formNum
    = '80MR4200' OR formNum = '80MR4273' OR formNum = '80MR4274' OR
    formNum = '80MR4300' OR formNum = '80MR9934' OR formNum =
    '80MR9935' OR formNum = '80SHC100' OR formNum = '80SHC4301' OR
    formNum = '80SHC9830' OR formNum = '80SHC9832') ORDER BY
    tblForms.formNum, tblForms.formCustNum

    AWFrueh1808 wrote:
    > OK, that's simple enough. But then I'm really confused
    as to why the query in
    > my original post/example didn't work.
    >
    > The only single quotes in my #whereClause# variable were
    wrapped around each
    > varchar value in the WHERE clause (well, HAVING) as in
    HAVING formNum = '12345'
    > OR formNum = '54321'
    >
    > I never used a single quote within the value itself. And
    yet
    > preservesinglequotes fixed it. So what was CF doing? Why
    did the single
    > quotes still show up in the error msg - and in the right
    place?
    >
    As I said the default behavior is to escape the quotes in
    your variables
    as data. So the default output of your SQL statement, before
    preserveSingleQuotes() would be like this.
    HAVING formNum = ''12345'' OR formNum = ''54321''
    As you can see that is not the desired results in your case.
    In your
    case you have the proper number of single quotes in your
    string and you
    do not want any added. You want to preserve them so to say.
    Thus
    adding preserveSingleQuotes() around your whereClase
    variable, i.e.
    preserveSingleQuotes(whereClause) says do not add any quotes,
    keep them
    all single.

Maybe you are looking for

  • Thunderbird not responding, and I need to know how to find out what version of Thunderbird I have?

    I am running Windows 7 Home Premium, use Firefox, but not sure how to tell what version. I have Zone Alarm anti-virus / firewall, iolo System Mechanic, and run them both regularly. I also have a g-mail account, a folder labeled "Gmail" in Thunderbird

  • Pls/sql in trace file

    Hi! The problem is appearence of pl/sql code in trace file instead of separate cursors of SQL statements. So, I can't get information about each SQL statement separatelly. What's wrong? How to separate SQL statements? Nosorog

  • How can I fix dubious permission errors?

    I changed the permissions at root (I now know that was a stupid move) however I now unable boot the machine, it just sits on the logo screen. I am away from home and do not have the OS CD.  Is there a solution?

  • Runtime error running Flash CS5

    Hello, I have this weird issue with Flash Professional CS5. It has worked just fine for me in the past but when i try to start it now it gives me the following error: "This application has requested the Runtime to terminate in an unusual way. Please

  • Archive Deletion Issue

    Hi, I have the following archive backup and maintenence scripts configured in my cron which run on a daily basis. How ever of late I faced an issue where in the archive destination got filled up. On check I found that there were archives that were ol