Query of queries syntax error.

Hi all

I have the following query:

< cfquery 'agent' datasource = name = 'Datasourcename' >
SELECT * FROM quote where status = 'pending '.
< isDefined ("form.agent") cfif >
AND agent = ' #FORM.agent # '.
< / cfif >
< / cfquery >

Then I have the following query of this query

< cfquery name = "totalvalue" dbtype = "query" >
SELECT total MySQL under the name OF the agent
< / cfquery >

However, I get the following error:

Query of queries syntax error.
Met «SUM (value.» List of incorrect selection,

on line 20, which is:

< cfquery name = "totalvalue" dbtype = "query" >

now, I'm sure it's identical to what ive used before, but the error. totals query works fine when querying the database direct, only had this error when I changed it to query the master query.

I appreciate any help in advance, that no matter how I look at I can't see whats wrong!

In my view, that this value is a reserved word which originally is probably your current error. I would rename this column or alias it in your initial query. Also, I would like to add value WHERE IS NOT NULL to your Q-Q to cover your NULL values.

Phil

Tags: ColdFusion

Similar Questions

  • Query question queries

    You can query a query created using queryNew()?

    When I try the following code, I get an error:

    "Query of queries syntax error.
    Meeting "qData. user. "Incorrect conditional expression, waiting for an a [as | null | between | in | comparison] condition."

    Code:

    < cfset qData = queryNew ("tool, user, community, fm01, fm02, fm03, fm04, fm05, fm06, fm07, fm08, fm09, fm10, fm11, fm12, fy") >
    < cfset temp = #queryAddRow (qData) # >
    < cfset temp = #querysetCell (qData, "tool", "empty") # >
    < cfset temp = #querysetCell (qData, "user", "Bob") # >

    < cfquery dbtype = "query" name = "chkQdata" >
    SELECT *.
    OF qData
    WHERE qData.user = 'Bob '.
    < / cfquery >

    I just tried the code you provided, adding two cfdump Tags (the first to empty the qData query and the second to empty the chkQdata query). Everything worked well exactly as you had it on Railo 3.1. It did not work (threw the error you got) on CF 8.0.1.

    If I deleted the WHERE clause of the query of chkQdata, it runs (no error) in CF 8.0.1.

    For that it works as you want in CF8, change the user column. This seems to be a keyword for CF8. While I didn't check exactly, if I change your original request to be 'empty' = tool, it runs. In addition, rename the column user usr generates the script runs correctly.

    Here is the code that I had to work in CF8 and Railo 3.1:

    SELECT *.

    OF qData

    WHERE the usr = "Bob."

  • Query of queries: error when you try to fake Left Outer Join

    Hello

    I'm trying to reproduce a left outer join, combining two query of queries using a method I find here

    However, I get an error message...

    Here is the code I use...

    < cfquery dbtype = "query" name = "qry" >
    SELECT *.
    OF returnQry, returnQry2
    WHERE returnQry.mediumImage = returnQry2.mediumImage
    ORDER BY returnQry.name
    < / cfquery >

    < name cfquery = "returnQry3", dbtype = "#application.mx #" >
    SELECT *.
    OF trackmeanings t
    < / cfquery >

    < cfquery dbtype = "query" name = "endQry" >
    SELECT name, nameRcd, mediumImage, comments COUNT (sMessage)
    OF qry, returnQry3
    WHERE qry.name = returnQry3.sNameTrack

    UNION

    SELECT name, nameRcd, mediumImage, comments COUNT (sMessage)
    OF qry, returnQry3
    WHERE #qry.name # NOT IN (#QuotedValueList (returnQry3.sNameTrack) #)
    GROUP BY name, nameRcd, mediumImage
    < / cfquery >

    When I try to use the query output in a page, I get the error message "incorrect conditional expression, waiting for an a [as |]» null | between | in | "comparison condition.

    Anyone have any ideas?

    Thank you very much

    The items in the list should be cited.  Since you are using quotedvaluelist, it's weird that they aren't.  However, if you use cfqueryparam, list = Yes, you should have better luck.  Among other things, it will protect you against the apostrophe in names.

  • Error running query of queries

    Hello

    I am in the process of updating my site in CF5 to CF9 and I get a "query of query error" on the following code each time I have add the first point to my shopping cart. If I add a second element, the error disappears. Here are two pieces of keys to the code where I pull the item from the database information and then use the query requests to merge the query with the amount of shopping cart.

    <!-get-> Product Details

    < CFQUERY NAME='GetDetails'

    DATASOURCE = ' #request.ds # '

    Username = ' #request.dsuser # '

    PASSWORD = ' #request.dspass # ' >

    SELECT
    ItemNo,

    Agenda,

    Grades,

    Price,

    ImageSmall

    DE Products
    ItemNo IN (#QuotedValueList(GetCart.ItemNo) #)
    < / CFQUERY >

    <!-add the column "OrderQty"->

    < CFQUERY NAME="GetList" DBTYPE="query">

    SELECT
    GetDetails.ItemNo YOU ItemNo,

    GetDetails.Item point, AS

    GetDetails.Grades AS Grades,

    AS price, GetDetails.Price

    GetDetails.ImageSmall AS ImageSmall,

    GetCart.Quantity AS OrderQty

    DE GetDetails, GetCart
    GetDetails.ItemNo = GetCart.ItemNo
    < / CFQUERY >

    This is the error I get. The line number refers to the Q of Q above.

    Error running query of queries.

    Comparison = runtime exception.
    Comparison of Type incompatible Exception: on the left side and right side of the comparison operator "=" have incompatible types.
    Type of expression left side = "VARCHAR".
    Expression type side right hand = "DATE".

    I tried a lot of things affect a 'string' type to the right, but nothing seems to work.

    I would be very happy any help that I can get as I've spent countless hours trying to figure this.

    Thank you
    Steve

    Looks like the GetCart query is generated with functions to query coldfusion as opposed to a database query.  It also seems that the QueryNew function has the names of the fields, but not the types of data.  This means some trys to ColdFusion for the type of basic data on the first rows of data.

    Or it could be something else.

  • Can't find answer to a query of queries error

    Not only I saw this forum, but also google this problem, but the unfortunnately I have no chance to find the answer.

    I wrote this simple query:

    < cfquery name="test" dbtype="query">

    Select The SSN, date of birth de myquery where SSN <> '' OR Date of birth <>"

    < / cfquery >

    and I got this error:

    Error running query of queries.

    Exception of comparison when running <>.
    Unsupported Type comparison Exception: the <>operator does not support comparison between the following types:
    Type of expression left side = 'DOUBLE '.
    Expression type side right hand = "STRING".

    I tried the following and has not worked either, still got the same error.

    < cfquery name ="test" dbtype ="query">

    Select The SSN, date of birth de myquery

    NSS <> < cfqueryparam cfsqltype ="CF_SQL_VARCHAR" Value =""/ >

    OR Date of birth <> < cfqueryparam cfsqltype ="CF_SQL_VARCHAR" Value =""/ > < / cfquery >

    Ever met someone the same problem and know how to solve it?

    Select SSN, date of birth of myquery where cast (SSN to the varchar type) <> " OR cast (date of birth as varchar) <> "

  • Insert query syntax error

    I have a flash form that is used for inserts a record in an Access database table. In the because there are 4 datefields, several fields of text, and then on several fields. When I submit the form, I get a syntax error that reads:

    Running database query. [Macromedia] [SequeLink JDBC Driver] [ODBC Socket] [Microsoft] [ODBC Microsoft Access driver] Syntax error in INSERT INTO statement.
    The error occurred on line 184. Complex object types cannot be converted to simple values.

    184 line is the last line of the values in the Insert query. The query looks like this:

    < CFQUERY DATASOURCE = '#REQUEST. DataSource #">"
    INSERT INTO EstimateNumber)
    BidNumber,
    Project,
    Construction,
    EstimatedBy,
    Region,
    Company,
    Division,
    InquiryNumber,
    SafetyChecklist,
    SafetyChecklistDate,
    QCChecklist,
    QCChecklistDate,
    EstimatedValue,
    UserUsername,
    UserPassword
    Updated,.
    ReviewDate,
    ReviewedBy,
    Discipline,
    BidDate,
    JobNumber,
    UpdatedBy
    )
    VALUES)
    #FORM. BidNumber #.
    ' #FORM. Project #',
    ' #FORM. Site #',
    ' #FORM. EstimatedBy #'.
    #FORM. Region #.
    #FORM.Company #,.
    #FORM. Division #.
    ' #FORM. InquiryNumber #'.
    #FORM. SafetyChecklist #.
    #FORM. SafetyChecklistDate #.
    #FORM. QCChecklist #.
    ' #FORM. QCChecklistDate #'.
    #FORM. EstimatedValue #.
    ' #FORM. UserUsername #',
    ' #FORM. UserPassword #',
    #FORM. # Update,
    #FORM. ReviewDate #.
    #FORM. ReviewedBy #.
    #FORM. Discipline #.
    #FORM. BidDate #.
    #FORM. JobNumber #.
    ' #FORM. "UpdatedBy #
    )
    < / CFQUERY >

    Any recommendations?

    chrispilie wrote:
    > Any recommendations?

    (1) enable debugging in order to visualize the generated actual query and post the SQL here
    (2) empty the form field. Are all of the form simple strings of values?

    (3) for the values inserted into a date/time column, you use cfqueryparam or CreateODBCDate, CreateODBCDateTime to convert the string to an object of good time. This ensures that the value is inserted properly

    Although I personally recommend to use cfqueryparam to subject parameters (not only date values).

  • in the query expression syntax error

    I get 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") & "". "

    On the other

    rs_company. "Source =" SELECT customerid_cus, company_cus FROM customers_cus WHERE company_cus = ' "& Request.Form ("company_cus") &" "'"

    End If

    What could be the problem?

    Are you sure that you pass the customerid querystring when the form
    company_cus is empty.

    --
    Paul Whitham
    Certified Professional Dreamweaver MX2004
    Adobe Community Expert - Dreamweaver

    Valleybiz Web design
    www.valleybiz.NET

    "aonefun" wrote in message
    News:epmf3n$f3u$1@forums. Macromedia.com...
    > I get the following error message:
    >
    [> Microsoft] [ODBC Microsoft Access driver] Syntax error (missing operator)
    > in
    > query expression 'customerid_cus ='.
    >
    > to 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") & ""
    >
    > Other
    >
    > rs_company. Source = "SELECT customerid_cus, company_cus FROM".
    > customers_cus
    > WHERE company_cus = ' "& Request.Form ("company_cus") &" ' "
    >
    > End If
    >
    > What could be the problem?
    >

  • DRG-50901: text query parser syntax error

    The query
    SELECT * FROM ij
    where
    CONTAINS (ij.summary, 'ATTENZIONE!') > 0 
    Returns an error:

    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle text error:
    DRG-50901: text analysis on line 1, column 13 query syntax error


    Why?

    There is a TEXT index on the column of synthesis:
    CREATE INDEX IJL_SUMMARY_IX ON IJ
    (SUMMARY)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('
        lexer           MITO_LEXER
        wordlist        DEFAULT_WORDLIST
        stoplist        IJL_STOPLIST
        storage         IJL_TEXT_STORAGE
        SYNC (EVERY "SYSDATE + 10/1440")')
    PARALLEL ( DEGREE 4 INSTANCES 1 );
    where is the MITO_LEXER

    BEGIN
    CTX_DDL.create_preference ("mito_lexer", "BASIC_LEXER");
    CTX_DDL.set_attribute ('mito_lexer', 'INDEX_STEMS', 'ITALIAN');
    -MITO-318: the asterisks text Index research
    CTX_DDL.set_attribute ('mito_lexer', 'printjoins', ' *');
    END;
    /

    Because mark exclamation (""! "") is a reserved operator, soundex of sense and must appear before the word, it applies to.

  • Query syntax error

    Hi all

    I get the syntax error: ORA-00905: lack of keyword
    kindly can someone correct me, where I'm wrong.
      
    SELECT rt.estimated_time, rt.start_date, rt.actual_date, rt.end_date,
           rt.task_status_id, rt.resource_id, rt.billable, rt.actual_date,
           rt.actual_end_date, rt.actual_time, t.ID AS task_id, t.project_id,
           p.final_date, c.NAME AS category_name, ts.NAME AS task_status_name,
           ts.state_machine_order, c.billable AS billable_category, po.value1,
           pr.NAME AS project_name, u.username, t.requeriment_id, t.created_by,
           t.category_id, t.task_id AS parent_task_id, t.NAME AS task_name,
           req.iteration, tpl.instance_id, p.iteration AS task_iteration,
           req.req_desc
      FROM pd_resource_task rt, pd_tool_user u, pd_task t
     LEFT OUTER JOIN (select id, iteration, description as REQ_DESC from pd_planning) 
    as req on req.id = t.requeriment_id, pd_planning as p
    LEFT OUTER JOIN (select instance_id, related_task_id from pd_custom_node_template) 
    as tpl on p.id = tpl.related_task_id, pd_category c, pd_project pr, pd_task_status ts
    LEFT OUTER JOIN (select substr(id,21) 
    as task_status_id, value1 from pd_preference where user_id='3'
    and id like 'home.taskList.order.%' order by value1) as po on ts.id = po.task_status_id 
    where t.id = p.id  and t.category_id = c.id and rt.project_id = t.project_id 
    and rt.task_id = t.id and rt.task_status_id = ts.id and rt.project_id = pr.id 
    and t.is_parent_task = 0 and rt.resource_id = '3' 
    and rt.resource_id = u.id and (p.final_date is null or p.final_date > '2011-08-23 13:57:23.737') 
    order by po.value1 asc, ts.state_machine_order asc, rt.start_date desc ;
    Thank you
    Prakash P

    You're welcome Prakash, please mark the thread as finished/responded to finish followed them...

    Edited by: lifexisxnotxsoxbeautiful Vithalani August 30, 2011 04:22

  • Query of queries error

    I use the same data source to create a query of queries, but one of my questions is not recognized. The codes and messages are the following:

    You do not use the datasource with a query of query property
    tag. When you do a query of query you are dealing with record sets
    memory. Delete the "datasource" setting in the third tag.

  • MySQL stored procedure syntax errors

    I have a request online, I want to use transactions either commit all updates of db or anything. The code I created is as follows, not only am I getting an error of syntax on lines 5 and 16, but frankly I do not know that the code is really going to do what I want. Please let me know if you see syntax errors and explain them.

    CREATE PROCEDURE increase_maint_priority
        (maint_item INT, new_priority INT, cur_priority INT, center_id INT)
     
    BEGIN
        START TRANSACTION; -- line 5 syntax error
        -- start updates
        UPDATE maintitem SET priority = (priority+1) 
            WHERE priority > cur_priority
            AND priority <= new_priority
            AND centerID = center_id;
            
        UPDATE maintitem SET priority = new_priority
            WHERE id = maint_item;
        
        COMMIT;
    END; -- line 16 syntax error
    

    Thank you in advance for helping a newb to stored procedures.

    If you want to help me to know if this code will actually work for what I want, that the following describes the situation.

    Main idea: business location apply for maintenance at their Center. Applications can be added anywhere in the list of priority (1 = highest priority). They can also change the priority of an application at any time.

    Previously I was using php to control a loop of update mysql queries (ouch, I know now, 2 sql statements could do the trick) and we live lately priorities in double, and other problems which seem to be very likely related to the update of the priorities of several elements.

    Ex: moving priority 6 to priority 1 requires 1 update query because the current priority of the 6th point, but a second query (or loop of several others since I am very new to the drafting 2 years ago sql statements) to update the other priorities.

    Thus, the desire for transaction method.

    Once again, thanks in advance for any help on this matter.

    PS - I use MySQL workbench to write this and it's where to find errors.

    I do not use MySQL and its syntax is slightly different from the other DBMS stored procedures. In all cases, once you eliminate the warning, you also add a handler to ensure that updates roll back in case of error:

    http://khanrahim.WordPress.com/2010/05/16/transaction-with-stored-procedure-in-MySQL-serve r.

  • DB connectivity Kit: syntax error in a SELECTION of data from joined tables

    Hello everyone

    I'm putting in labview a SQL query on joined tables.

    As an example I take a database to store the data of basketball 2on2 matches, which tables are

    corresponds to (matchId, Thomas, teamB)

    teams (teamId,PlayerAname, PlayerBname, nationality)

    nationalities (NatId, natName)

    To get an array of result with the game as well as the names of player as well as their nationality, I use this query on MySQL (which works on command line interface)

    SELECT MatchID,
    T1. PlayerAName, t1. PlayerBName, n1.natName,
    T2. PlayerAName, t2. PlayerBName, n2.natName
    MATCHES m
    INNER JOIN teams t1 ON t1.teamID = m.teamA
    INNER JOIN teams t2 ON t2.teamID = m.teamB
    INNER JOIN nationalities L1 ON n1.natID = t1.nationality
    INNER JOIN nationalities n2 ON n2.natID = t2.nationality

    When I put it in labview, using the block 'select data', I get a syntax error as shown in the attached screenshot.

    Am I something mistanking using the JOIN examples statements or aliases?

    Thanks in advance!

    The select VI is designed to be a simple way to select from a table. I doubt that he can do joins (and would not certainly need the 'FROM', even if it can). What you can do instead calls the query execute VI and give him the complete SQL query. I don't remember if it returns the data in the recordset object, so you must do so separately.

  • sql syntax error code

    Hello

    I'm trying to run a script sql in Toad and I feel say syntax error:

    ORA-00907: lack of right parenthesis

    I tried different ways to solve this problem, but can't. Here is the sql script I'm running and get the result. Please any help would be appreciated.

    SELECT Metric_Name,

    DECODE (Metric_run_mode, 1, ' on)
    Ask ', 2, 'Regular') Run_Mode,
    Max_Run,

    Min_Run,

    Avg_Run,

    number_of_runs,

    Max_Run-Avg_Run,

    Avg_Run-Min_Run,

    Avg_Run * number_of_runs,.

    NUM_RECORDS

    )

    (SELECT Metric_Name, Metric_run_mode, )
    MAX (Runtime_In_Seconds) Max_Run,

    MIN (Runtime_In_Seconds) Min_Run,

    Round (AVG (Runtime_In_Seconds), 2) AS Avg_Run,

    Count (*) AS number_of_runs,

    Max (NUM_RECORDS) NUM_RECORDS

    OF

    (SELECT DISTINCT
    B.Metric_Name,

    B.Metric_run_mode,

    ROUND ((A.Result_Stored-A.Request_To_Run) * 24 * 60 * 602) AS
    Runtime_In_Seconds,

    Success_code,

    A.NUM_RECORDS

    Of
    SI_INFOLET_RUN_STATISTICS has,
    Si_Metrics_T B

    WHERE
    a.INFOLET_ID = B.METRIC_ID and (select in b.metric_id

    separate input_metric_id of si_metric_columns where metric_id = (select
    metric_id si_metrics where metric_name =' REM MS REPAIR ACTION
    PLAN ");"

    Thanks in advance.

    See in this query, you have a group by clause.

  • "VMware converter-all-4.3.0 - 292238.exe NetBSD conversion starts do not/vmware-sysinfo - lin32.sh" received the error code (2) result:. / vmware-sysinfo-lin32: 1: syntax error: "(" unexpected

    Someone at - it successfully converted NetBSD? Thank you.

    Need to VMWARE Converter: Support for NetBSD 3.0 and later, please. I get the below error

    VMware Converter Standalone GUI show me this message: failed to query the source of linux computer

    = vmware-converter-worker - 5.log =.

    [#3] [2011-02-02 09:23:15.300 03084 info "App"] Results of the query to the host 172.30.2.48
    [#3] [2011-02-02 09:23:20.494 03084 error "App"] [Converter Agent SysinfoQuery] while trying to run "C:\Program VMware vCenter Converter Standalone\plink.exe - noprompt - stdin - Pei 22 [email protected] cd nokeycheck /tmp/.vmware-sysinfo-udhrkaaejqfyrfgf/;.» "/ vmware-sysinfo - lin32.sh" received the error code (2) result:. / vmware-sysinfo-lin32: 1: syntax error: "(" unexpected
    [#3]
    [#3] [2011-02-02 09:23:20.494 03084 error "App"] [Converter Agent SysinfoQuery] received an error code (2) of the ssh client which is dealt with later
    [#3] [2011-02-02 09:23:20.494 03084 error "App"] [Converter Agent SysinfoQuery] vmware-sysinfo execution failed; return code: 2; result:. / vmware-sysinfo-lin32: 1: syntax error: "(" unexpected
    [#3]
    [#3] [2011-02-02 09:23:20.494 03084 error "App"] [Converter Agent SysinfoQuery] Query(): Took exception, cleanup before you bail out ([converter Agent SysinfoQuery] implementation of vmware-sysinfo failed; return code: 2; result:. / vmware-sysinfo-lin32: 1: syntax error: "(" unexpected)
    [#3] )
    [#3] [2011-02-02 09:23:21.296 03084 error "App"] [Converter Agent SysinfoQuery] while trying to run "C:\Program VMware vCenter Converter Standalone\plink.exe - noprompt - stdin - Pei 22 [email protected] cat /tmp/.vmware-sysinfo-udhrkaaejqfyrfgf/vmware-sysinfo.log nokeycheck" received the error code (1) result: Cat: /tmp/.vmware-sysinfo-udhrkaaejqfyrfgf/vmware-sysinfo.log: no such file or directory
    [#3]
    [#3] [2011-02-02 09:23:21.296 03084 error "App"] [Converter Agent SysinfoQuery] received an error code (1) of the ssh client which is dealt with later
    [#3] [2011-02-02 09:23:21.296 03084 error "App"] Converter SysinfoQuery the Agent failed to retrieve the log file. return code: 1; result: Cat: /tmp/.vmware-sysinfo-udhrkaaejqfyrfgf/vmware-sysinfo.log: no such file or directory
    [#3]
    [#3] [2011-02-02 09:23:21.998 03084 error "App"] SysInfo query failed with error [converter Agent SysinfoQuery] implementation of vmware-sysinfo failed; return code: 2; result:. / vmware-sysinfo-lin32: 1: syntax error: "(" unexpected
    [#3]
    [#3] [2011-02-02 09:23:21.998 03084 info "App"] Programmed timer cancelled, succeeds StopKeepAlive
    [#3] [2011-02-02 09:23:32.240 04928 info "App"] [Converter.Worker.DiagnosticManagerImpl] build LogBundle.

    You are using a generic NetBSD kernel?

    so I think that it is similar to the Open and FreeBSD.

    hotclone is the waste of time - it won't work.

    Use Coldclone - or dd the entire disk - write a descriptor for him then and use it as vmdk.

    In the other BSD systems I boot first time in single user mode - as everything else probably does not work.
    Can I fix fstab and etc/rc.conf if necessary

    I'm in a hurry - if you need details for dd-road let me know and I explain a bit...

    Ulli

  • Syntax error when you use 'let '.

    HI gentlemen,

    I have a small XQuery file that works A1 if I do not use leash $p... However, the scheme is deeply nested and I tried to do for the sake of readability. Now I always get a syntax error - it will put in place with 'let' and 'element' together. Here is a test for a single line. By removing $p and re - his replacement by its content, it's OK.
    <?xml version="1.0" encoding='windows-1252'?>
    <!--<?xml-stylesheet type="text/xsl" href="icd.xsl"?>-->
    <page xmlns:xsql="urn:oracle-xsql"  connection="gksconnection">
    <xsql:include-xml xmlns:xsql="urn:oracle-xsql">
    SELECT XMLSerialize(DOCUMENT
    XMLQuery(
      'xquery version "1.0"; (: :)
       declare namespace n1="urn:ehd/001"; (: :)
       declare namespace n2="urn:ehd/icd/001"; (: :)
    
    let $p := /n1:ehd/n1:body/n2:icd_stammdaten/n2:kapitel_liste/n2:kapitel
    
       element h 
       {  
         /n1:ehd/n1:header/n1:provider/n1:organization/n1:id/@EX,
         element kap 
         {
           $p[n2:gruppen_liste/n2:gruppe/n2:diagnosen_liste/descendant::n2:diagnose/n2:icd_code/@V="{@icd_code}"]/n2:nummer,
           /n1:ehd/n1:body/n2:icd_stammdaten/n2:kapitel_liste/n2:kapitel[n2:gruppen_liste/n2:gruppe/n2:diagnosen_liste/descendant::n2:diagnose/n2:icd_code/@V="{@icd_code}"]/n2:bezeichnung,
           /n1:ehd/n1:body/n2:icd_stammdaten/n2:kapitel_liste/n2:kapitel[n2:gruppen_liste/n2:gruppe/n2:diagnosen_liste/descendant::n2:diagnose/n2:icd_code/@V="{@icd_code}"]/n2:von_icd_code,
           /n1:ehd/n1:body/n2:icd_stammdaten/n2:kapitel_liste/n2:kapitel[n2:gruppen_liste/n2:gruppe/n2:diagnosen_liste/descendant::n2:diagnose/n2:icd_code/@V="{@icd_code}"]/n2:bis_icd_code,
           element group 
           {
              /n1:ehd/n1:body/n2:icd_stammdaten/n2:kapitel_liste/n2:kapitel/n2:gruppen_liste/n2:gruppe[n2:diagnosen_liste/descendant::n2:diagnose/n2:icd_code/@V="{@icd_code}"]/n2:bezeichnung,
              /n1:ehd/n1:body/n2:icd_stammdaten/n2:kapitel_liste/n2:kapitel/n2:gruppen_liste/n2:gruppe[n2:diagnosen_liste/descendant::n2:diagnose/n2:icd_code/@V="{@icd_code}"]/n2:von_icd_code, 
              /n1:ehd/n1:body/n2:icd_stammdaten/n2:kapitel_liste/n2:kapitel/n2:gruppen_liste/n2:gruppe[n2:diagnosen_liste/descendant::n2:diagnose/n2:icd_code/@V="{@icd_code}"]/n2:bis_icd_code, 
              element diag
              {
                 /n1:ehd/n1:body/n2:icd_stammdaten/n2:kapitel_liste/n2:kapitel/n2:gruppen_liste/n2:gruppe/n2:diagnosen_liste/descendant::n2:diagnose[n2:icd_code/@V="{@icd_code}"]
              }
           }
         }
       }'
      PASSING xml_document
      RETURNING CONTENT
    )
    AS CLOB INDENT SIZE = 2
    ) as result
    FROM icd
    where id = {@idno} 
    </xsql:include-xml>
    </page>
    Can someone help me find the cause of the error? Unfortunately, I need some 'header' < chapter > and < group > data too, which lies over the "core" of the query: < diagnose > node. That's why I chose the technique of qualification.

    Thank you, best regards

    Miklós HERBOLY
     RESULT
     --------------------------------------------------------------------------------
     
       
         
       
                                                                                                                         
    

    OK, you get the empty elements on 11.2.0.2, so there is certainly a problem on this version.
    The fact that the NO_XML_QUERY_REWRITE indicator work means that there is a problem with the optimizer tries to use the internal binary XML structure to deal with the XQuery.

    I can't say much more than that, but since the test case is simple enough, you probably connect a SR with Oracle Support on that one.

Maybe you are looking for