Coldfusion Query ORDER BY syntax

Hi,
I have products stored in different categories and I want to run a query that will display the products either by product name or by product price depending on the category ID.  I have it working with just one category being sorted by product name (as below)  but how do I specify for multiple categories e.g. IF #URL.cat# EQ "10" OR "11" OR "5" OR "14" ???
<cfif #URL.cat# EQ "10">
<cfquery name="catalogue" datasource="#request.SiteDSN#" username="#request.DSNUser#" password="#request.DSNPasswd#">
SELECT *
FROM products
WHERE prod_cat_id = <cfqueryPARAM value = "#URL.cat#"
   CFSQLType = "CF_SQL_INTEGER"> ORDER BY prod_name
</cfquery>
<cfelse>
<cfquery name="catalogue" datasource="#request.SiteDSN#" username="#request.DSNUser#" password="#request.DSNPasswd#">
SELECT *
FROM products
WHERE prod_cat_id = <cfqueryPARAM value = "#URL.cat#"
   CFSQLType = "CF_SQL_INTEGER"> ORDER BY prod_price
</cfquery>
</cfif>
Thanks in advance!

My example goes for economy, writing the query just once.
<cfswitch expression="#URL.cat#">
<!--- categories 5, 10 or 12 --->
<cfcase value="5,10,12">
        <cfset orderByClause="prod_name">
    </cfcase>
<!--- categories 11 or 14 --->
    <cfcase value="11,14">
        <cfset orderByClause="prod_price">
    </cfcase>
<!--- all categories other than 5,10,11,12,14 --->
    <cfdefaultcase>
        <cfset orderByClause="prod_name">
    </cfdefaultcase>
</cfswitch>
<cfquery name="catalogue" datasource="#request.SiteDSN#" username="#request.DSNUser#" password="#request.DSNPasswd#">
SELECT *
FROM products
WHERE prod_cat_id = <cfqueryPARAM value = "#URL.cat#" CFSQLType = "CF_SQL_INTEGER">
ORDER BY #orderByClause#
</cfquery>

Similar Messages

  • Problem with return a ColdFusion query object from a Java class

    Hi!
    I need to return a ColdFusion query object from a Java class
    using a JDBC result set ( java.sql.ResultSet);
    I have tried to pass my JDBC result set in to the constructor
    of the coldfusion.sql.QueryTable class with this code:
    ColdFusion code
    <cfset pra = createObject("java","QueryUtil").init()>
    <cfset newQuery = CreateObject("java",
    "coldfusion.sql.QueryTable")>
    <cfset newQuery.init( pra.getColdFusionQuery () ) >
    My java class execute a query to db and return QueryTable
    Java code (QueryUtil.java)
    import coldfusion.sql.QueryTable; // (CFusion.jar for class
    QueryTable)
    import com.allaire.cfx //(cfx.jar for class Query used from
    QueryTable)
    public class QueryUtil
    public static coldfusion.sql.QueryTable
    getColdFusionQuery(java.sql.ResultSet rs)
    return new coldfusion.sql.QueryTable(rs);
    but when i run cfm page and coldfusion server tries to
    execute : "<cfset pra =
    createObject("java","QueryUtil").init()>" this error appears:
    Object Instantiation Exception.
    An exception occurred when instantiating a java object. The
    cause of this exception was that: coldfusion/sql/QueryTable.
    If i try to execute QueryUtil.java with Eclipse all it works.
    Also I have tried to return java.sql.ResultSet directly to
    coldfusion.sql.QueryTable.init () with failure.
    Do you know some other solution?

    ok
    i print all my code
    pratica.java execute a query to db and return a querytable
    java class
    import java.util.*;
    import java.sql.*;
    import coldfusion.sql.*;
    public class Pratica {
    private HashMap my;
    private String URI,LOGIN,PWD,DRIVER;
    private Connection conn=null;
    //funzione init
    //riceve due strutture converite in hashmap
    // globals
    // dbprop
    public Pratica(HashMap globals,HashMap dbprop) {
    my = new HashMap();
    my.put("GLOBALS",globals);
    my.put("DBPROP",dbprop);
    URI = "jdbc:sqlserver://it-bra-s0016;databaseName=nmobl";
    LOGIN = "usr_dev";
    PWD = "developer";
    DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    try{
    // Carico il driver JDBC per la connessione con il database
    MySQL
    Class.forName(DRIVER);
    /* Connessione alla base di dati */
    conn=DriverManager.getConnection(URI,LOGIN,PWD);
    if(conn!=null) System.out.println("Connection Successful!");
    } catch (ClassNotFoundException e) {
    // Could not find the database driver
    System.out.print("\ndriver non trovato "+e.getMessage());
    System.out.flush();
    catch (SQLException e) {
    // Could not connect to the database
    System.out.print("\nConnessione fallita "+e.getMessage());
    System.out.flush();
    //funzione search
    //riceve un hash map con i filtri di ricerca
    public QueryTable search(/*HashMap arg*/) {
    ResultSet rs=null;
    Statement stmt=null;
    QueryTable ret=null;
    String query="SELECT * FROM TAN100pratiche";
    try{
    stmt = conn.createStatement();// Creo lo Statement per
    l'esecuzione della query
    rs=stmt.executeQuery(query);
    // while (rs.next()) {
    // System.out.println(rs.getString("descrizione"));
    catch (Exception e) {
    e.printStackTrace();
    try {
    ret = Pratica.RsToQueryTable(rs);
    } catch (SQLException e) {
    e.printStackTrace();
    this.close();
    return(ret);
    // ret=this.RsToQuery(rs);
    // this.close(); //chiude le connessioni,recordset e
    statament
    //retstruct CF vede HashMap come struct
    //METODO DI TEST
    public HashMap retstruct(){
    return(my);
    //conversione resultset to querytable
    private static QueryTable RsToQueryTable(ResultSet rs)
    throws SQLException{
    return new QueryTable(rs);
    //chiura resultset statament e connessione
    private void close(){
    try{
    conn.close();
    conn=null;
    catch (Exception e) {
    e.printStackTrace();
    coldfusion code
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
    Transitional//EN">
    <html>
    <head>
    <title>Test JDBC CFML Using CFScript</title>
    </head>
    <body>
    <cftry>
    <cfset glb_map =
    createObject("java","java.util.HashMap")>
    <cfset dbprop_map =
    createObject("java","java.util.HashMap")>
    <cfset glb_map.init(glb)> <!---are passed from
    another page--->
    <cfset dbprop_map.init(glb["DBPROP"])>
    <cfset pra =
    createObject("java","Pratica").init(glb_map,dbprop_map)>
    <cfset ourQuery
    =createObject("java","coldfusion.sql.QueryTable").init(pra.search())>
    <cfcatch>
    <h2>Error - info below</h2>
    <cfdump var="#cfcatch#"><cfabort>
    </cfcatch>
    </cftry>
    <h2>Success - statement dumped below</h2>
    <cfdump var="#ourQuery#">
    </body>
    </html>
    error at line <cfset pra =
    createObject("java","Pratica").init(glb_map,dbprop_map)>
    An exception occurred when instantiating a java object. The
    cause of this exception was that: coldfusion/sql/QueryTable.
    -----------------------------------------------------------------------

  • Query Of Queries syntax error.

    Hi all,
    I have the following query:
    <cfquery name="agent" datasource="datasourcename">
    SELECT * FROM quotes where status = 'Pending'
    <cfif isDefined("form.agent")>
    AND agent = '#FORM.agent#'
    </cfif>
    </cfquery>
    Then, I have the following query of that query
    <cfquery name="totalvalue" dbtype="query">
    SELECT SUM(value) as total FROM agent
    </cfquery>
    however I get the following error:
    Query Of Queries syntax error.
    Encountered "SUM ( value. Incorrect Select List,
    on line 20 which is:
    <cfquery name="totalvalue" dbtype="query">
    now i'm sure this is identical to what ive used before but
    getting the error. the totals query works fine when querying the
    database direct, only got this error when I changed it to query the
    master query.
    i appreciate any help in advance, as no matter how much i
    stare at it I can't see whats wrong!

    I believe that
    value is a reserved word that is probably causing your
    current error. I would rename this column, or alias it in your
    original query. Also, I would add WHERE value IS NOT NULL to your
    Q-of-Q to cover your NULLs.
    Phil

  • Bug in CF11 regarding Query of queries syntax?

    So I have decided to try CF11 because of an official outstanding CF10 bug.
    Once I installed CF11, I get an error when running code like this:
    <cfquery name="LOCAL.stat_questions" datasource="#APPLICATION.dsn#">
         SELECT     survey_questionID
         FROM     tbl_survey_questions
    </cfquery>
    <cfset LOCAL.this_statID = 1>
    <cfquery name="LOCAL.subset" dbtype="query">
         SELECT     survey_questionID
         FROM          [LOCAL].stat_questions
         WHERE     survey_questionID = <cfqueryparam cfsqltype="cf_sql_numeric" value="#LOCAL.this_statID#">
    </cfquery>
    The error I receive is: "Query Of Queries syntax error.
      Encountered ";. "
    If I remove the semi-colon... No error! Is this a bug, or was the semi-colon always bad, but just ignored?
    Thanks

    I just always put it in out of habit from typing out actual MySQL queries (non QoQ). Never was a problem and I always did it. Now running CF11... it requires fixing. Thought it was strange.
    I actually didn't even notice that the semi-colons weren't required in QoQ until I ran into this CF11 bug. I also notice the semi-colon isn't necessary for a MySQL query either in cfquery! Seems weird that it accepts them, but isn't required. Just ignores them?

  • Converting an Ultra Search result to a ColdFusion query

    Hello,
    I'm trying to convert an Ultra Search result into a ColdFusion query.
    There's a java class for CF which turns a java result into a CF query, coldfusion.sql.QueryTable(java.sql.ResultSet), but is there anything which will convert an Ultra Search result to a java result or a CF query?
    Thanks.

    HOMEWORK ALERT HOMEWORK ALERT
    You can't cast from a character to a String. That doesn't work.
    However, in a fit of being helpful.
    Look at the constructors for the String object in the API
    Link ===> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#String(char[])
    char[] charA = {'H', 'E', 'L', 'L', 'O', ' ', 'W', 'O', 'R', 'L', 'D' } ;
    String a = new String(charA) ;
    System.out.println(a) ;There's a price for my help, and it's this. Now that you understand what you can do, is it a good idea or a bad idea and why ???
    Explain.

  • Session keeps running when the query has a syntax error

    I have a weird scenario.
    Take this query for example: select distinct physassignednum from hsi.docdeficiency where delinqlevel> 0 and dfcystatus in (1,6));
    This query has a syntax error as there is an additional bracket at the end. I know that. When I run it on STJOSE database the session keeps running and never returns. Even if I stop it, it does not. I try to disconnect, it says "Connection is currently busy. Try again?" This behavior is pretty consistent on STJOSET. If I run this query on UMASS database it gives me this error (as expected)
    ORA-00933: SQL command not properly ended
    00933. 00000 - "SQL command not properly ended"
    *Cause:   
    *Action:
    Error at Line: 1 Column: 99
    I do not know what is wrong with the STJOSE database connection that causes the session to hang and never return.
    Please help.
    -Nags
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production (both databases)
    SQL Developer Version 3.0.04 Build Main-04.34

    This does not happen in sql*plus. It does not hang. It returns a proper error message.
    HSI@stjose> select distinct physassignednum from hsi.docdeficiency where delinqlevel> 0 and dfcystatus in (1,6));
    select distinct physassignednum from hsi.docdeficiency where delinqlevel> 0 and dfcystatus in (1,6))
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    HSI@stjose>

  • Use plan from stored_outlines from query with different syntax?

    Hello,
    I'd like to know is there any ability to use via stored_outlines plan from query with different syntax?
    Database version - 11.1.06
    If yes, maybe you'll take a look at steps (based on Metalink 726802.1), what I tried to do to make it work (with no success):
    alter session set create_stored_outlines=good;
    run good query
    create private outline good from SYS_OUTLINE_0... -< GOOD
    alter session set create_stored_outlines=bad;
    run bad query
    create private outline good from SYS_OUTLINE_0... -< BAD
    update ol$ set sql_text, textlen, signature, hash_value, hash_value2 from BAD to GOOD records
    leave ol$hintcount for GOOD untouched
    delete ol$ where ol_name='BAD';
    delete ol$hints where ol_name='BAD';
    delete ol$nodes where ol_name='BAD';
    execute dbms_outln_edit.refresh_private_outline('GOOD');
    alter session set sql_trace=true;
    alter session set use_private_outlines=true;
    run bad query
    examine trace file and find that it use execution plan different from both bad and good queries
    PS: Originally bad query is posted already Re: Poor performance while join of 2 comprehensive large views and small table
    PPS: Also I review thread CBO not picking correct indexes or doing Full Scans
    Thanks,
    Sergiy
    Edited by: kiberpress on Sep 30, 2009 6:59 AM

    A query with different syntax would result in a different hash value.
    Stored outlines work based on hash value.
    Your question is probably answered now.
    Sybrand Bakker
    Senior Oracle DBA

  • ORACLE 9I의 HIERARCHICAL QUERY의 ORDER SIBLINGS BY CLAUSE

    제품 : ORACLE SERVER
    작성날짜 : 2003-10-22
    (V9I) Oracle 9i의 Hierarchical query의 ORDER SIBLINGS BY CLAUSE
    ===============================================================
    PURPOSE
    이 문서는 Oracle 9i의 new feature인 ORDER SIBLINGS BY 절을
    Hierarchical query에 사용하는 예를 통하여 특정 컬럼을 기준으로
    Ordering된 형태로 display하는 방법을 보여준다.
    Explanation & Example
    Hierarchical query를 구현할 때 ORDER BY 절을 사용하는 것은
    Oracle 7.1 버젼부터 가능한 것이었다.
    그러나, 순서대로 ordering되지 않고 특정 컬럼(emp table의 ename)을
    기준으로 ordering하기를 원한다면 <Bulletin:10373>처럼 procedure를
    작성하여야만 하였다.
    그러나, Oracle 9i 에서는 ORDER BY 절 대신에 ORDER SIBLINGS BY 절을
    사용할 수 있어 user-defined stored procedure를 만들 필요가 없게 되었다.
    1) Ordering 하기 전의 emp table의 Hierarchical query
    SQL> @a
    ename EMPNO MGR JOB
    KING 7839 PRESIDENT
    JONES 7566 7839 MANAGER
    SCOTT 7788 7566 ANALYST
    ADAMS 7876 7788 CLERK
    FORD 7902 7566 ANALYST
    SMITH 7369 7902 CLERK
    BLAKE 7698 7839 MANAGER
    ALLEN 7499 7698 SALESMAN
    WARD 7521 7698 SALESMAN
    MARTIN 7654 7698 SALESMAN
    TURNER 7844 7698 SALESMAN
    ename EMPNO MGR JOB
    JAMES 7900 7698 CLERK
    CLARK 7782 7839 MANAGER
    MILLER 7934 7782 CLERK
    14 rows selected.
    Ordering 하기 전의 a.sql 은 다음과 같다.
    col ename format a25
    col empno format 99999
    col mgr format 99999
    col job format a15
    select rpad(' ', LEVEL*5) || ename "ename", empno, mgr, job
    from emp
    start with job='PRESIDENT'
    connect by prior empno=mgr;
    2) 9i의 new feature인 Hierarchical query를 사용하여 Ordering한 경우
    SQL> @new_a
    ename EMPNO MGR JOB
    KING 7839 PRESIDENT
    BLAKE 7698 7839 MANAGER
    ALLEN 7499 7698 SALESMAN
    JAMES 7900 7698 CLERK
    MARTIN 7654 7698 SALESMAN
    TURNER 7844 7698 SALESMAN
    WARD 7521 7698 SALESMAN
    CLARK 7782 7839 MANAGER
    MILLER 7934 7782 CLERK
    JONES 7566 7839 MANAGER
    FORD 7902 7566 ANALYST
    ename EMPNO MGR JOB
    SMITH 7369 7902 CLERK
    SCOTT 7788 7566 ANALYST
    ADAMS 7876 7788 CLERK
    14 rows selected.
    Ordering하기 위해 사용한 new_a.sql 은 다음과 같다.
    col ename format a25
    col empno format 99999
    col mgr format 99999
    col job format a15
    select rpad(' ', LEVEL*5) || ename "ename", empno, mgr, job
    from emp
    start with job='PRESIDENT'
    connect by prior empno=mgr
    order siblings by ename;
    Reference Documents
    <Bulletin:10373>

    Thanks to Kendenny, Boneist and Odie.
    Got the point that "Order Siblings by clause" cannot be used with connect by query with analytical function, Thanks Kendenny.
    Yes, I now use main query and subquery, however the subquery be just "connect by" and have the all html tags added in the main query.
    The below query is working now.
    SELECT
    CASE WHEN LAG(mylevel,1,0) OVER (ORDER BY myrownum) >= mylevel THEN '<li>'
    ELSE
    CASE LEAD(mylevel) OVER (ORDER BY myrownum)
    WHEN mylevel THEN
    CASE WHEN myrownum = 1 THEN '<ul id="sidebarmenu1" '
    ELSE '<ul'
    END ||'><li>'
    ELSE
    CASE WHEN myrownum =1 THEN '<ul id="sidebarmenu1"'
    ELSE '<ul '
    END ||' ><li>'
    END
    END ||'<a href="'||
       CASE WHEN link_url IS NOT NULL THEN
          link_url||'title="'||menu_item||'"'
    ELSE '#"' END ||
    '><span>'||short_menu_item||'</span></a>'||
    CASE mylevel - LEAD(mylevel,1,1) OVER (ORDER BY myrownum)
    WHEN -1 THEN NULL
    WHEN 0 THEN '</li>'
    ELSE REPLACE(LPAD('*', myleveL-LEAD(mylevel,1,1) OVER (ORDER BY myrownum),'*'), '*','</li></ul></li>')
    END ||
    CASE WHEN LEAD(mylevel,1,0) OVER (ORDER BY myrownum) = 0 THEN '</ul>'
    ELSE NULL END unordered_List,
    menu_item, menu_id,
    above_menu_id
    FROM (
    SELECT LEVEL mylevel, ROWNUM myrownum,daevmt.*
    FROM dae_vs_my_tasks daevmt
    CONNECT BY PRIOR daevmt.menu_id = daevmt.above_menu_id
    START WITH daevmt.above_menu_id = 'TOPMENU'
    ORDER SIBLINGS BY display_order
    ) t;
    Odie, I tried altering the session for the flag, still the first query was not working.
    Thanks again all for your great time in answering me.

  • Query of Qeries Syntax problem

    I'm getting an error on the syntax for my SELECT statement in
    a Query of Queries. The code is:
    <cfquery name="OnOrderLogData" dbtype="Query"
    result="result3">
    SELECT *,
    ROW_NUMBER() OVER([ORDER] [BY] RowNumber [ASC]) + 0 AS
    PageOrder
    FROM OOLogView
    WHERE RowNumber > 3 AND RowNumber <= 33
    </cfquery>
    The error is:
    Encountered "(. Incorrect Select Statement, Expecting a
    'FROM', but encountered '(' instead, A select statement should have
    a 'FROM' construct.
    I know that certain reserved words need to be escaped with
    square brackets, and I have surrounded all the words that were on
    the list in the reference manual with square brackets. I did not
    see anything in the reference manual that says I can not use
    parenthesis in the SELECT statement, nor anything that says I can
    not use the SQL function ROW_NUMBER. I have spent several hours
    trying many different things and still can't get it to work. It
    works fine when I execute it as an Ad Hoc query in SQL Server 2005
    Studio Express (when I take out the square brackets).
    Can anyone please help me figure out what is wrong and how to
    fix it? Thanks.

    > Adam, your's was the least impolite
    Heh. Talk about "damning with faint praise".
    > I have Ben Forta's 3 volumes, the CF Reference Manual
    and the CF User's Guide.
    > None are very specific about what IS OK to do,
    I actually find livedocs to be the best resource for looking
    up CF stuff.
    http://livedocs.adobe.com/coldfusion/8/using_recordsets_1.html
    Or googling these forums (NB: *Google*, not the in-built
    search function,
    which is rubbish).
    > If I would say something to my boss such as, "You
    shouldn't expect..." or
    > "What do you expect..." in the context as these answers,
    I would be in the dog
    > house.
    Sure. But you're not our boss. If we were to draw parallels
    like that,
    it'd be the other way around if anything. (I would not draw
    the parallels
    either way, that said). I actually *would* talk to one of my
    subordinates
    like that, but I'm noted at work for my "terseness" at times
    (some might
    describe it in harsher terms than that ;-). We've all got
    different
    expectations, I guess.
    > That is the kind of criteria used to judge the
    appropriateness of how
    > one should converse with other people.
    OK, well I think - for the reasons you outlined - you're
    going to be a bit
    disappointed there. I recommend ignoring the tone (or at
    least the tone
    you're perceiving), and just take the info as given. On the
    whole, people
    here are pretty polite, actually.
    But anyway. I think you got your answer, so job done.
    Although now you've
    got to work out another way of sorting out your issue...
    Adam

  • Coldfusion query of queries error

    I have a long query named "Results.Itinerary" in a CFC which
    I have to add this query to.
    <CFLOOP QUERY = "Results.Itinerary">
    <CFQUERY NAME = "GetPorts" DATASOURCE="x">
    SELECT *
    FROM Itinerary_Ports
    WHERE (ItineraryID = #ItineraryID#)
    AND (Name NOT LIKE '%At Sea%')
    </CFQUERY>
    <CFSET ThisPortList = ValueList(GetPorts.Name)>
    <CFSET QuerySetCell(Results.Itinerary,
    "PortList","#ThisPortList#", CurrentRow)>
    </CFLOOP>
    Now this query below gives me an error, I know I need to have
    the single quotes around PortList for it to work , but coldfusion
    is getting confused and throwing errors.
    <cfquery name="Search.Results.ThisShip" dbtype="QUERY">
    SELECT *
    From Search.Results.Itinerary
    Where ShipID = #ShipID#
    AND NumberOfNights = #NumberOfNights#
    AND PortList = '#PortList#' < - Coldfusion will sometimes
    get screwed up on this line.
    ORDER BY DepartureDate ASC
    I need to know a different way to write this. Thanks.

    Thanks to you and Dan. I think the key was getting rid of the
    apostrophies that coldfusion added. I still dont know if its a
    QuerySetCell that adds them or what, but having them makes
    problems.
    Here is what I did to fix it
    In the query I used QuotedValueList and used a delimiter.
    Then I stripped out the apostrophies that coldfusion added.
    Then I reset the QuerySetCell with the apostrophies removed.
    <CFLOOP QUERY = "Results.Itinerary">
    <CFQUERY NAME = "GetPorts" DATASOURCE="Cruises">
    SELECT *
    FROM Itinerary_Ports
    WHERE (ItineraryID = #ItineraryID#)
    AND (Name NOT LIKE '%At Sea%')
    </CFQUERY>
    <CFSET ThisPortList =
    QuotedValueList(GetPorts.Name,";")>
    <CFSET QuerySetCell(Results.Itinerary,
    "PortList","#ThisPortList#", CurrentRow)>
    <cfset a = replace(PortList,"'","","all")>
    <CFSET QuerySetCell(Results.Itinerary, "PortList","#a#",
    CurrentRow)>
    </CFLOOP>
    The next part I did was the "PortList IN ('#PortList#'). "
    SELECT *
    From Search.Results.Itinerary
    Where ShipID = #ShipID#
    AND NumberOfNights = #NumberOfNights#
    AND PortList IN ('#PortList#')
    ORDER BY DepartureDate ASC

  • Query code cotains Syntax Errors

    Hello Experts,
    In the process of upgrading from 4.6 to 6.0 ECC SAP version, we had some issues at the moment of testing Queries from SQ01 transaction, nevertheless almost all the problems with queries were solved by regenerating them all over again from SQ01 for Queries and SQ02 for Infosets.
    Everything was OK so far, until I tested this Query related to PCH Logical Database and realized that It had Syntax Errors and can't run, and the other 5 Queries related to the same Logical Database are having the same Syntax Errors and they can not be fixed by executing the Query from SQ01 or regenerating the Infoset (PCHORG) from SQ02.
    I guess the Syntax Errors must be fixed by regenerating the code in the new version, but how can I do this?
    Or, is there another process I am skipping to achieve this?
    Any ideas on this?
    Thanks in advance!

    Hello VitorDFPinheiro thanks for your answer,
    I tried to modify the errors manually but in first Instance this is not possible whitout an Access Key and secondly I think this is not the best practice due the code for queries is generated Automaticaly.
    Nevertheless I tried to correct this syntax errors by copying the code and pasted it into a new Z program and compile it, the compiler threw even more errors when I corrected the first one, so I think that this is not the way to procced.
    I guess that there should be a way to "regenerate" the query and this "regeneration" must reorganize the code and its syntax.
    Any other suggestions?
    Edited by: memo_cv on Oct 11, 2010 6:56 PM

  • Warning in query in Extended Syntax Check

    Hi all,
    I perform Extended Syntax Check.
    It generates following warning for the query: -
    In "SELECT SINGLE....", the WHERE condition for the key field "MATNR" does not test for equality. Therefore the single record in question may not be unique.
    (You can hide the message using "#EC *)
    Please tell me what does it mean. How can I suppress this warning?
    Regards,
    Saurabh A. Buksh

    Hi,
    whenu r using select single use a variable or a workarea don't use tables.
    select single matnr from mara into v_matnr
    where matnr in s_matnr.
    also as it is warning message u can neglectit .
    when u  r using select single u should give entire key information also.
    Regards,
    Nagaraj
    Message was edited by: nagaraj kumar nishtala

  • Coldfusion query works in cfm but not cfc

    I have the following query that works just fine in cfm file but cannot seem to get to work in a coldfusion cfc. Any ideas.
    Select distinct include.value from xxxxx.authorprofile,
    table(authorprofile.uidinclude) include where profilename='#selectedProfile#'

    No Oracle version
    No Cold Fusion version
    No explanation of what either CFM or CFC means
    My recommendation would be that you ask the people that sold you the tool. It is, after all, their product that is the issue.

  • Multiple query order

    Hello, I have an oracle report with 3 queries/groups which are not linked. Is there a way to set a sequence in which the queries run? Say the first query created runs first, second next e.t.c?
    Many Thanks

    query reports runs as:
    the most upper and left in the data model
    in this order upper - left
    you can test this thing
    create a report with 2 queries
    you can check the order running con trace tools - trace put a name of trace (better with path) and mark only sql checkbox
    run the report
    after run open again the trace tool and clear the name and then ok to close the file
    open the file and you can see the sql order
    then change the query 1 right and down of query 2 save the file
    close report
    open again report open the file and do the same anc check the file
    i said close report because the builder have a cache of the running and if you change the queries in the data model you cannot see the difference
    i tested reconnecting without closing the builder but the cache is local and the builder use it.

  • Problem in a inner query- order by clause

    hi...
    I have a update statement with a simple select clause present as inner query..
    (select col1 from table1 where col2='abc' and rownum=1 order by col3 desc)
    since it is a inner query, thats why i can not remove the brackets.
    col3 may be 0 or 1(1 can occur only once...0 can be multiple times)
    my target is to fetch the record if the col3 is 1
    if it is not 1, then it will fetch the first record with col3=0...thats why i have put order by col3.
    moreover i want only one record, thats why i have put rownum=1.
    but it is failing with 'missing right parenthesis'.
    please help..

    Hi,
    Remember that the ORDER BY clause is applied last, after the WHERE clause is completed, so when you way
    WHERE     ROWNUM = 1
    ORDER BY  col3    DESCin the same sub-query, you're picking one row (arbitrarily), and then "sorting" that one row.
    Here's one way to get the results you want:
         SELECT     col1
         FROM     (
                   SELECT  col1
                   ,     ROW_NUMBER () OVER (ORDER BY  col3  DESC)
                                  AS r_num
                   FROM     table1
                   WHERE     col2     = 'abc'
                   AND     col3     IN (0, 1)
         WHERE     r_num     = 1
    )Depending on how this is used in your complete query, there may be better ways to get the same results.

Maybe you are looking for

  • Solaris 8 on V215

    Is it possible to install Solaris 8 on a V215 server? I know it's not supported, but could it be done for test purposes? Can't try to install since I don't have the server right now. /F

  • Iphoto is not working on Mac OS X 10.5.8.??

    I have tried to open iphoto and it is says it cannot open as it is in CLASSIC form. I then tried utilities and then the reinstall discs- there was no iphoto on the discs and I cannot find iLife...... do I buy snow leopard then Lion so I can get a pho

  • I want to use my apple id with the in the itunes without credit card.

    I have made an apple id but when i use it in the app store it says that i have to sign with it into the itunes storebut when i do it it asks me for credit card number. i want the id for free

  • Airplay not working over wireless, works over ethernet?

    I posted this in multiple forums in which it applies to. Just looking for troubleshooting suggestions from my wireless N MBPro, to my wired ATV2. Here is the rundown (all devices running latest updates): 1)used to work just fine with old router 2)air

  • ITunes movie and music sharing advice needed

    OK, I need some adavice from some of you itunes experts out there. First, let me explain my setup by going room to room. Home Office: Airport Extreme, sitting next to an Intel Dial Core Mac Mini. Mac Mini has an external 1TB hard drive with my music