Empty query XMLTABLE results

I can successfully submit the SOAP request, retrieve the expected answer, store the answer in the column of XMLTYPE table but attempt to stored query XML using XMLTABLE response returns 0 rows.  I looked through other forum on this subject entries, suspect the problem, it's something simple/syntactic, have tried many things to fix, but without success.   Any help would be greatly appreciated.   I tried to provide relevant details below.   Thanks in advance!

Create the table with a column of type XMLTYPE to hold the SOAP call response:

CREATE TABLE unfilled_ss

(

ID NUMBER,

XMLTYPE data

);

Insert line in table created above with the answer of the function 'soap_call' as the value of the column of type XMLTYPE data:

insert into unfilled_ss

Select

2,

() soap_call

' < wsc:search >

< arg0 >

system of < user name > < / username >

password <>systempassword < / password >

<>criteria

< DmsShipL and vacuum >

< ShipmentHeader-ShipDate > > 10/07/2015 = < / ShipmentHeader-ShipDate >

< ItemWarehouseMaster stock_item > Y < / ItemWarehouseMaster-stock_item >

the territory < CustomerMaster > LMHS. CFHA; SMHS < / CustomerMaster-territory >

< / DmsShipL and empty >

< / criteria >

< LignesMax > 2 < / LignesMax >

< / arg0 >

< / wsc:search > ',

' http://elite-app.leesar.com/prod_841/WS/WmsWebService ',

' http://elite-app.leesar.com/prod_841/WS/WmsWebService '

)

Double;

Query the table above showing characters of the response XML "soap_call", inserted in the column of type XMLTYPE data:

SELECT id, substr(data,1,160) 'FIRST_FEW_CHARS_OF_XMLDOC' from unfilled_ss where id = 2;

ID FIRST_FEW_CHARS_OF_XMLDOC

---------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------

" 2 < envelope soap: xmlns:soap = ' http://schemas.xmlsoap.org/SOAP/envelope/ ">                                                                                          

< soap: Body >

< ns2:searchResponse xmlns:ns2 = "wsclient.wms.tecsys.com" >

< return >

Here's value for the column 'DATA' type response representing XMLTYPE SOAP appeal referenced above in full:

" < envelope soap: xmlns:soap = ' http://schemas.xmlsoap.org/SOAP/envelope/ ">

< soap: Body >

< ns2:searchResponse xmlns:ns2 = "wsclient.wms.tecsys.com" >

< return >

< status >

< code > 0 </postcode >

< description > success < / description >

< timestamp > 2015-07-10 10:45:16 < / timestamp >

< / status >

<>criteria

< DmsShipL and vacuum >

< ShipmentHeader-ShipDate > > 10/07/2015 = < / ShipmentHeader-ShipDate >

< ItemWarehouseMaster stock_item > Y < / ItemWarehouseMaster-stock_item >

the territory < CustomerMaster > LMHS. CFHA; SMHS < / CustomerMaster-territory >

< / DmsShipL and empty >

< / criteria >

< LignesMax > 2 < / LignesMax >

< result >

< DmsShipL and vacuum >

< ShipmentHeader-open > 1 < / open ShipmentHeader >

< > 01 warehouse < / warehouse >

< pps_num > 178625 < / pps_num >

< ShipmentHeader DateAndTimePpsWasPrinted > 2015-07-09 09:31:03 < / ShipmentHeader-DateAndTimePpsWasPrinted >

< LineNumber > 1 < / LineNumber >

< KitComponentLineNumber > 0 < / KitComponentLineNumber >

< element > 2002686 < / Item >

< AllocatedQuantity > 6,000 < / AllocatedQuantity >

< QuantityShippedInSellingUom > 0.000 < / QuantityShippedInSellingUom >

< QuantityShipped > 0.000 < / QuantityShipped >

< AssetItemQuantityReturned > 0.000 < / AssetItemQuantityReturned >

< SellingUom > PK < / SellingUom >

< ShipmentHeader-SalesOrderHeader-Order > 181035 < / ShipmentHeader-SalesOrderHeader-Order >

< Client-SalesInvoiceHeader-ShipmentHeader > 355000 < / ShipmentHeader-SalesInvoiceHeader-client >

< SalesOrderHeader-ShipmentHeader-CustomerPo > Lmackin < / SalesOrderHeader-ShipmentHeader-CustomerPo >

PK < ItemMaster-StockingUom > < / ItemMaster-StockingUom >

< WarehouseTransfer / >

< TransferLine-ToWarehouse / >

< TransferBackorder / >

< ShipmentLineChargeGrid > 0 | 2254373 < / ShipmentLineChargeGrid >

< CreatedOn > 2015-07-09 09:31:03 < / CreatedOn >

TECSYS < CreatedBy > < / CreatedBy >

< ModifiedOn > 2015-07-09 09:31:03 < / ModifiedOn >

TECSYS < ModifiedBy > < / ModifiedBy >

< VersionCounter > 1 < / VersionCounter >

< / DmsShipL and empty >

< DmsShipL and vacuum >

< ShipmentHeader-open > 1 < / open ShipmentHeader >

< > 01 warehouse < / warehouse >

< pps_num > 178628 < / pps_num >

< ShipmentHeader DateAndTimePpsWasPrinted > 2015-07-09 09:31:50 < / ShipmentHeader-DateAndTimePpsWasPrinted >

< LineNumber > 57 < / LineNumber >

< KitComponentLineNumber > 0 < / KitComponentLineNumber >

< element > 2069220 < / Item >

< AllocatedQuantity > 0.000 < / AllocatedQuantity >

< QuantityShippedInSellingUom > 0.000 < / QuantityShippedInSellingUom >

< QuantityShipped > 0.000 < / QuantityShipped >

< AssetItemQuantityReturned > 0.000 < / AssetItemQuantityReturned >

< SellingUom > RL < / SellingUom >

< ShipmentHeader-SalesOrderHeader-Order > 181041 < / ShipmentHeader-SalesOrderHeader-Order >

< Client-SalesInvoiceHeader-ShipmentHeader > 612000 < / ShipmentHeader-SalesInvoiceHeader-client >

< SalesOrderHeader-ShipmentHeader-CustomerPo > 417096_612105 < / SalesOrderHeader-ShipmentHeader-CustomerPo >

RL < ItemMaster-StockingUom > < / ItemMaster-StockingUom >

< WarehouseTransfer / >

< TransferLine-ToWarehouse / >

< TransferBackorder / >

< ShipmentLineChargeGrid > 0 | 2254481 < / ShipmentLineChargeGrid >

< CreatedOn > 2015-07-09 09:31:50 < / CreatedOn >

TECSYS < CreatedBy > < / CreatedBy >

< ModifiedOn > 2015-07-09 09:31:50 < / ModifiedOn >

TECSYS < ModifiedBy > < / ModifiedBy >

< VersionCounter > 1 < / VersionCounter >

< / DmsShipL and empty >

< / result >

dms_ship_l.unfilled < viewName > < / viewName >

< / return >

< / ns2:searchResponse >

< / soap: Body >

< / envelope soap: >

Here's my problem - when I try to use XMLTABLE at end of the contents of the request of the column 'DATA' as query tabular data, completed without error but no lines are returned:

with xml_table_data as

(

SELECT x.*

Of e unfilled_ss,.

XMLTABLE)

xmlnamespaces ('http://schemas.xmlsoap.org/soap/envelope' as "SOAP", "wsclient.dms.tecsys.com" like "ns2"),

' /: soap envelope / soap: Body / ns2:searchResponse / back/result/DmsShipL-empty '

PASSAGE e.data

COLUMNS

Varchar2 (50) warehouse PATH "/ DmsShipL/warehouse empty."

VARCHAR2 (50) PATH of the pps_num ' / DmsShipL-empty/pps_num, "

Point varchar2 (30) PATH ' / DmsShipL-vacuum/Item. "

Varchar2 (50) PATH of the SellingUom ' / DmsShipL-vacuum/SellingUom.

) x

where e.id = 2

)

Select count (*)

of xml_table_data;

COUNT (*)

----------

0

Thanks for the detailed test case.

You have typos in the mapping of namespaces.

Here's the good:

XmlNamespaces)

"http://schemas.xmlsoap.org/soap/envelope/" as "SOAP."

' wsclient. wms.tecsys.com' as "ns2.

)

SQL> SELECT  x.*
  2  FROM unfilled_ss e
  3     , XMLTABLE(
  4         XMLNamespaces(
  5           'http://schemas.xmlsoap.org/soap/envelope/' as "soap"
  6         , 'wsclient.wms.tecsys.com'  as "ns2"
  7         )
  8       , '/soap:Envelope/soap:Body/ns2:searchResponse/return/result/DmsShipL-Unfilled'
  9         PASSING e.data
 10         COLUMNS
 11           Warehouse  varchar2(50) PATH '/DmsShipL-Unfilled/Warehouse'
 12         , pps_num    varchar2(50) PATH '/DmsShipL-Unfilled/pps_num'
 13         , Item       varchar2(30) PATH '/DmsShipL-Unfilled/Item'
 14         , SellingUom varchar2(50) PATH '/DmsShipL-Unfilled/SellingUom'
 15       ) x
 16  WHERE e.id = 2 ;

WAREHOUSE    PPS_NUM   ITEM     SELLINGUOM
------------ --------- -------- -------------
01           178625    2002686  PK
01           178628    2069220  RL

Tags: Oracle Development

Similar Questions

  • query for results last 8 days

    anyone with a query for results last 8 days
    TIMESTAMPADD (SQL_TSI_DAY,-8, CURRENT_DATE), this results in just 1 day results only if I run this query is it display 8th day back results only.

    I want all 8 results back days.
    what someone request for it...

    Published by: user12255470 on April 28, 2010 07:19

    This works very well for me:

    SELECT "D0 time." "" Saw_0 T00 calendar Date ","recipes of F1. " "" Recipes 1-01 (all in all) ' saw_1 'Sample Sales' WHERE 'Time D0. "' T00 calendar Date" BETWEEN TIMESTAMPADD(SQL_TSI_DAY,-8, CURRENT_DATE) AND TIMESTAMPADD (SQL_TSI_DAY-1, CURRENT_DATE) ORDER BY saw_0

    concerning

    John
    http://www.obiee101.blogspot.com/

  • need help with query xmltable

    Hello team,

    I have a problem by querying the xml file. Unable to get the correct result.

    XML:

    " < = xmlns:env env:Envelope ' http://schemas.xmlsoap.org/SOAP/envelope/ "xmlns:wsa =" " http://www.w3.org/2005/08/addressing ">

    < env:Header >

    < wsa: MessageID > urn: 93D110E0D6CD11E5BF8FC7751D1F819E < / wsa: MessageID >

    < wsa: ReplyTo >

    < wsa:Address > http://www.w3.org/2005/08/addressing/anonymous < / wsa:Address >

    < / wsa: ReplyTo >

    < / env:Header >

    < env:Body >

    " < = xmlns:client retrieveSubscriberDetailResponse ' http://xmlns.Oracle.com/SBLMVNE/MVNERetrieveSubscriberDetail/MVNERetrieveSubscriberDetailProcess "xmlns =" http://xmlns.Oracle.com/SBLMVNE/MVNERetrieveSubscriberDetail/MVNERetrieveSubscriberDetailProcess ">

    < customer: header >

    < customer: InterfaceName / >

    < customer: InterfaceId / >

    < customer: CorrelationId > Interface Sync n / < / customer: CorrelationId >

    < customer: ResultCode > 0 < / customer: ResultCode >

    < customer: ResultDescription > success < / customer: ResultDescription >

    < / customer: header >

    < customer: subscribers >

    < customer: Subscriber >

    < customer: subscriberId > 3891907 < / customer: subscriberId >

    < customer: serviceNo1 > 639372000342 < / client: serviceNo1 >

    < customer: serviceNo2 / >

    < customer: serviceNo3 > 515024400960403 < / client: serviceNo3 >

    < customer: serviceNo4 >

    < / customer: Subscriber >

    < / customer: subscribers >

    < / retrieveSubscriberDetailResponse >

    < / env:Body >

    < / env:Envolope >

    Here's my query:

    Select x.* tmp_soap_data t,

    xmltable (xmlnamespaces ('http://schemas.xmlsoap.org/soap/envelope/"as"ns1","http://www.w3.org/2005/08/addressing"as"ns2", ))

                             ' ( http://xmlns.Oracle.com/SBLMVNE/MVNERetrieveSubscriberDetail/MVNERetrieveSubscriberDetailProcess ' as 'ns3'),

    ' ns1:Envelope / ns1:Body/retrieveSubscriberDetailResponse/ns3:subscribers '

    in passing t.lob_data

    path of columns subs_id varchar2 (100) ' / ns3:Subscriber / ns3:subscriberId') x;

    but the result is NULL.

    I'm on the right track with my request?

    Best regards

    Nelz Ki

    It works

    WITH tmp_soap_data as (select xmltype('
      
        
          
            
              3891907
              639372000342
              
              515024400960403
              
      
        
      
       
    ') lob_data from dual)
    -- Above is dummy setup to mimic your data tables
    select x.*
      from tmp_soap_data t,
           xmltable(xmlnamespaces('http://schemas.xmlsoap.org/soap/envelope/' as "ns1",
                                  'http://xmlns.oracle.com/SBLMVNE/MVNERetrieveSubscriberDetail/MVNERetrieveSubscriberDetailProcess' as "ns3"),
                    'ns1:Envelope/ns1:Body/ns3:retrieveSubscriberDetailResponse/ns3:subscribers/ns3:Subscriber'
                    passing t.lob_data
                    columns
                    subs_id varchar2(100) path 'ns3:subscriberId') x;
    

    You were close.

    I made several minor changes.  Been cut down XML to remove the nodes not used for readability, typos corrected in the node names, removed the namespace ns2 is not mentioned in the XPath expressions, changed XPath primary as assuming that the client node: Subscriber could repeat, changed the XPath for the subs_id accordingly noticed that the node retrieveSubscriberDetailResponse uses the same URI for two namespaces, has added the ns3 prefix to retrieveSubscriberDetailResponse in the Xpath expression since it resides is in a default namespace and prefix ns3 points to this default namespace.

  • Need help creating a query XMLTABLE

    I'm fairly new to XML parsing in Oracle and am struggling to write correctly a XMLTABLE query that can parse the XML response from a SOAP Web service. I read some documents, but nothing seems to cover the kind of disorder that below, I'm working with.

    If there is someone who has the experience to deal with this kind of SOAP response, any help would be greatly appreciated. I think I'm not declaring namespaces correctly.

    Here is the command that I have so far, which is far from running:
    select *
    from XMLTABLE(xmlnamespaces(
        'http://www.w3.org/2003/05/soap-envelope/' as "soapenv"
       ,'http://<server>/webservice/soap/server.php?wstoken=LONGENCRYPTEDTOKEN' as "ns1"
       ,'http://xml.apache.org/xml-soap' as "ns2"
       ,'http://www.w3.org/2003/05/soap-encoding' as "enc"
       ,'http://www.w3.org/2003/05/soap-rpc' as "rpc"
    ),
    '/soapenv:Envelope/soapenv:Body/ns1:moodle_course_create_coursesResponse/rpc:result/ns2:item'
    PASSING ('XML SHOWN BELOW')
    COLUMNS
        ID VARCHAR2(10) PATH '???????') a
    Here's the sanitized XML code:
    <?xml version="1.0" encoding="UTF-8"?>
                <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
                              xmlns:ns1="http://<server>/webservice/soap/server.php?wstoken=LONGENCRYPTEDTOKEN"
                              xmlns:ns2="http://xml.apache.org/xml-soap"
                              xmlns:enc="http://www.w3.org/2003/05/soap-encoding"
                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                    <env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">
                        <ns1:moodle_course_create_coursesResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
                            <rpc:result>return</rpc:result>
                            <return enc:itemType="ns2:Map" enc:arraySize="2" xsi:type="enc:Array">
                                <item xsi:type="ns2:Map">
                                    <item>
                                        <key xsi:type="xsd:string">id</key>
                                        <value xsi:type="xsd:int">14756</value>
                                    </item>
                                    <item>
                                        <key xsi:type="xsd:string">shortname</key>
                                        <value xsi:type="xsd:string">testname5</value>
                                    </item>
                                </item>
                                <item xsi:type="ns2:Map">
                                    <item>
                                        <key xsi:type="xsd:string">id</key>
                                        <value xsi:type="xsd:int">14757</value>
                                    </item>
                                    <item>
                                        <key xsi:type="xsd:string">shortname</key>
                                        <value xsi:type="xsd:string">testname6</value>
                                    </item>
                                </item>
                            </return>
                        </ns1:moodle_course_create_coursesResponse>
                    </env:Body>
                </env:Envelope>

    Hello

    SOAP-RPC is delicate, that the name of the resultset object is given in a separate element.

    Here, you will need to do this:

    SQL> var xmlresp clob
    SQL> BEGIN
      2   :xmlresp :=
      3  '
      4  
     10      
     11          
     12              return
     13              
     14                  
     15                      
     16                          id
     17                          14756
     18                      
     19                      
     20                          shortname
     21                          testname5
     22                      
     23                  
     24                  
     25                      
     26                          id
     27                          14757
     28                      
     29                      
     30                          shortname
     31                          testname6
     32                      
     33                  
     34              
     35          
     36      
     37  ';
     38  END;
     39  /
    
    PL/SQL procedure successfully completed.
    
    SQL> SELECT x.*
      2  FROM XMLTable(
      3         XMLNamespaces(
      4           'http://www.w3.org/2003/05/soap-envelope' as "soapenv"
      5         , 'http://server/webservice/soap/server.php?wstoken=LONGENCRYPTEDTOKEN' as "ns1"
      6         , 'http://xml.apache.org/xml-soap' as "ns2"
      7         , 'http://www.w3.org/2003/05/soap-encoding' as "enc"
      8         , 'http://www.w3.org/2003/05/soap-rpc' as "rpc"
      9         )
     10       , 'for $i in /soapenv:Envelope/soapenv:Body/ns1:moodle_course_create_coursesResponse
     11          return $i/*[name()=$i/rpc:result]/item'
     12          PASSING xmltype(:xmlresp)
     13          COLUMNS id        VARCHAR2(10) PATH 'item[key="id"]/value'
     14                , shortname VARCHAR2(30) PATH 'item[key="shortname"]/value'
     15       ) x
     16  ;
    
    ID         SHORTNAME
    ---------- ------------------------------
    14756      testname5
    14757      testname6
    

    BTW, you do not have to declare every single document, just namespace (s) you intend to use in the statement.

  • When I filled a form field using a query SQL result is displayed but not registered in the table.

    I write in the topic, I have created a form and in some of their fields, I used a SQL query to get information from a table based on the user who has been logging.

    The information displayed well, but when I press "Send button" loses information and the field in the table is shown empty.


    Anyone know what is happening?

    I enclose below a picture of the problem

    Concerning

    Problema DB APEX.jpg

    Hi ANTHONY,.

    ANTHONY wrote:

    I give you the credentials of my database, I hope you could do it works and most importantly, showing me what the error care...

    Feel free to change what you want in the application

    https://Apex.Oracle.com/pls/Apex/f?p=4550:1:2838412118981:

    BANCO_PRUEBAS

    ADMIN

    password

    It is interesting that, when I use APEX 5.0.1.00.06, I have some errors form appearing not using APEX 4.1.0.00.32

    Check your 77569 application-> Page 1. I have modified the page element attributes. Now it's working.

    Here are the changes (I will explain for P1_NOMBRE, did the same for the P1_APELLIDOS and P1_CATEGORIA):

    • 'Source' has become article attributed to him include:

    Source: Replacement always, value that exists in session state

    Source type: column database

    Source of value or an expression: NUMBER

    • The "Default" article now the following attributes:

    By default of Type: PL/SQL function body

    Default value:

    DECLARE
    
      L_NOMBRE B_LISTA_EMPLEADOS.NOMBRE%TYPE;
    
    BEGIN
    
      select NOMBRE
      into   L_NOMBRE
      from   B_LISTA_EMPLEADOS
      where  USERNAME = :APP_USER;
    
      RETURN L_NOMBRE;
    
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
      RETURN NULL;
    
    END;
    

    Kind regards

    Kiran

  • Comparison of XPath to a node empty in xmltable oddity

    Hello

    I'm on 11.2.0.3 and trying to figure out if I can do a comparison logic in my XMLTABLE. I thought I'd seen pretty much sussed, except when it came to compare to an empty node. Then things began to get weird when I was trying to work where my test went wrong.

    So it works:

    Select x.*
    from xmltable (' / has "passer-by xmltype (" < a > < b > < c > < d > < / d > < e > vale < /e > < / c > < / b > < / has > ' "))
    number of columns c_val_check path "count(b/c[d=""])."
    d_val_check path number 'count(b/c[e="vale"])') x;

    C_VAL_CHECK D_VAL_CHECK
    ----------- -----------
    1           1

    The same way:

    with sd as (select 1 id, xmltype ("< a > < b > < c > < d > < / d > < e > vale < /e > < / c > < / b > < / has > '") double col1)
    Select x.*
    the SD,.
    XMLTable ('/ ' in passing sd.col1)
    number of columns c_val_check path "count(b/c[d=""])."
    d_val_check path number 'count(b/c[e="vale"])') x;

    C_VAL_CHECK D_VAL_CHECK
    ----------- -----------
    1           1

    But it does not work on the d = "" test, even if the two xmls are the same as in the previous two examples: "

    with sd as (select 1 id, xmltype ("< a > < b > < c > < d > < / d > < e > vale < /e > < / c > < / b > < / has > '") col1 in double union all)
    Select 2 id, xmltype ("< a > < b > < c > < d > < / d > < e > vale < /e > < / c > < / b > < / has > '") double col1)
    Select sd.id, x.*
    the SD,.
    XMLTable ('/ ' in passing sd.col1)
    number of columns c_val_check path "count(b/c[d=""])."
    d_val_check path number 'count(b/c[e="vale"])') x;

    ID C_VAL_CHECK D_VAL_CHECK
    ---------- ----------- -----------
    1           0           1
    2           0           1

    And if I change the < c > < e > value to something different, which does not help also:

    with sd as (select 1 id, xmltype ("< a > < b > < c > < d > < / d > < e > vale < /e > < / c > < / b > < / has > '") col1 in double union all)
    Select 2 id, xmltype ("< a > < b > < c > < d > < / d > < e > val0 < /e > < / c > < / b > < / has > '") double col1)
    Select sd.id, x.*
    the SD,.
    XMLTable ('/ ' in passing sd.col1)
    number of columns c_val_check path "count(b/c[d=""])."
    d_val_check path number 'count(b/c[e="vale"])') x;

    ID C_VAL_CHECK D_VAL_CHECK
    ---------- ----------- -----------
    1           0           1
    2           0           0

    What I am doing wrong? I guess I am doing something stupid here, and is not an Oracle bug!

    Hello

    I guess I am doing something stupid here, and is not an Oracle bug!

    Well, maybe it is.

    To use the indicator NO_XML_QUERY_REWRITE works around the problem, as does using a slightly different predicate:

    SQL > with sd as (select 1 id, xmltype ('vale') double col1)

    2 Union all the

    3 select 2 id, xmltype ('vale') double col1

    4              )

    5 Select sd.id, x.*

    6 of the sd,

    7 xmltable ('/ ' in passing sd.col1)

    path number 8 columns c_val_check ' count (b/c [not (d / text ())]). "

    9 number of d_val_check path 'count(b/c[e="vale"])') x;

    ID C_VAL_CHECK D_VAL_CHECK

    ---------- ----------- -----------

    1           1           1

    2           1           1

  • Need to query the result with two different of a same attribute values

    Hi all

    I have a search query where I need the query result when an attribute have two different values (e.g.: want the query result when the attribute 'status' is equal to 1 and 2)

    And also, the user will be able to search by any State result.

    What is the best way to implement this.

    Thank you
    DK

    The solution to this use case is to put the part by default ((statut == 1 ou statut == 2) and: bindUserInput is null) as part of the query and the Pratt of the query to run when a value is entered by the user in a view criteria. East view criteria (Status ==: bindUserInput) and the value of the checkbox to ignore the values null. If the binding variable: bindUserInput is null, only the portion of the query is running, if the binding variable is not null, the display criteria is added at the request of three and three default components will not return any line.

    Timo

  • Query search results

    I need some advice of best practices.  I don't know if there is a better way to do what I'm trying to accomplish.  The execution time is very high, that's why I'm looking for alternatives.  I look forward to the advice to help reduce the execution time.  If all goes well, I can explain this clearly because I do not see it clearly.  I'll just use a form field for this example, however, there are about 10 options for search field.

    Several items (checkboxes) can be selected for a field.  I use CODES for my example.

    The cfquery on the results page uses a display that has been created in the database.  This point of view joined a (company) several other tables primary table (i.e., codes) who eventually number of records for a single company.  In the cfquery, I use to just joined tables to see if this company has one of these records.  It seems to be the work and do not take too much time.  In order to generate results, a distinct society is used because several lines could be returned for a single company, and I don't want that each company output once.

    So I want to get out information about the company.  I would like also to the output of the various codes for returned for each company.  So, I have to make a small request in the main query of exit to get these documents.  Because there are so many options of search box, this is where I think that execution time is slowing down because it is has a loop very each company returned (800 +) and several search fields means different queries.  Here is a sample code.

    I am open to all ideas and grateful.  Sincerely.

    < cfquery datasource = "xxx" name = "Company" >

    Choose a separate business

    of vwCompany

    which active = 'true '.

    CFIF isdefined ("code") and code QNE "> and IN code (< cfqueryparam value =" #form.code # "list =" Yes "' >") < / cfif >

    < / cfquery >

    < cfoutput query = "company" >

    < CFQUERY DATASOURCE = "xxx" NAME = "getCodes" >

    SELECT *.

    OF tblCodes

    WHERE IN the code (< cfqueryparam value = "#form.code #" >)

    < / CFQUERY >

    #company #.

    codes: #valuelist (getcodes.code) #.

    < / cfquery >

    Select distinct society, codes

    of vwCompany

    which active = 'true '.

    CFIF isdefined ("code") and code QNE "> and code ()

    from there, you can take separate compnay and get codes accordingly.

    Select a distinct society of company

    Select separate codes in the company where the company = #getDisCompany.Company [i] #.

  • How to create the query summary results

    Is there a SQL query that allows you to create a summary of the results based on the following source listed below products?

    Source...

    Mark object class
    7A English 65
    Math 7A 77
    7A PE 88
    7A Science 72
    7B English 68
    Math 7B 73
    PE 7 B 69
    7B Science 59
    7 c English 72
    Math 7 c 64
    7 C PE 76
    7 c Science 68
    7 d English 58
    7 d 89 math
    7 D EP 74
    7 d Science 81


    Output...

    English mathematics Science PE class
    7 A 65 77 88 72
    7 B 68 73 69 59
    7 72 64 76 68
    7 58 89 74 81

    Thanks, AjN

    Hello

    Welcome to the forum!

    Whenever you have questions, please post CREATE TABLE and INSERT statements for your sample data, so that people who want to help you can recreate the problem and test their ideas.
    Always tell what version of Oracle you are using.

    What you asked is called a Pivot , and here's a way to do it:

    SELECT       class
    ,       MIN (CASE WHEN subject = 'English'  THEN mark END)     AS english
    ,       MIN (CASE WHEN subject = 'Maths'    THEN mark END)     AS maths
    ,       MIN (CASE WHEN subject = 'PE'       THEN mark END)     AS pe
    ,       MIN (CASE WHEN subject = 'Science'  THEN mark END)     AS science
    FROM       table_x
    GROUP BY  class
    ORDER BY  class
    ;
    

    The above query will work in Oracle 8.1 (and), but from Oracle 11.1, there is a better way: SELECT... PIVOT .

    For more info on pivots, see the FAQ:
    SQL and PL/SQL FAQ

  • How to query this result?

    with main as (

    Select '-1' kisi, '10' thread from dual

    Select '-1', '20' from dual

    Select '-1', '30' from dual

    Select '5', '40' from dual

    Select '-1', '50' from dual

    Select '-1', '60' from dual

    Select '4', '70' from dual

    Select '4', '80' from dual

    Select '-1', '90' from dual

    Select '-1', '99' from dual order by 2)

    Select Kisi , thread from main order by thread;

    Result must be




       

    Kisi
    min_threadmax_thread-1103054040-1506047080-19099

    If you do not have a sort column:

    with the hand in the form)

    Select kisi '-1', '10' double thread.

    Union all select '-1 ', ' 20' double '.

    Union all select '-1 ', ' 30' double '.

    Union all select '5', '40' double

    Union all select '-1 ', ' 50' double '.

    Union all select '-1 ', ' 60' double '.

    Union select all '4', '70' from dual

    Union select all '4', '80' of the double

    Union select all '-1 ', ' 90' the double '.

    Union select all "(-1 ', ' 99' double ordering by 2).

    Select kisi, min (thread), max (thread) in)

    Select sum (flag) on grp wire, kisi, (drive by wire)

    de)

    Select decode (kisi, lag (kisi) over (order by wire), 0, 1) flag

    kisi

    wire

    of the hand

    )

    )

    Grp group, kisi;

  • Storage - empty overview, no results

    We conducted a test of:

    2.0 Update 1

    Version 2.0.5 - 2171746

    and storage - section of the overview of the VMware vSphere default dashboard is empty.  We have Hitachi storage.

    What is needed to complete this section of the dashboard?  The other sections of SCSI storage latency/errors and SCSI sense Codes are met.

    Thanks for the reply but the caching of the web browser is apparently not a problem.  View all storage section has always been empty, since deployment and I just opened a fresh IE browser that I had never used to access newspapers insight and unfortunately the view section of storage set is always empty.  In addition, the vcops is not involved.

  • same query returns results different game

    Hi all
    I use 10g db.
    I have a query as below
      SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EIH_EFF_DATE
         FROM EMP_INC_HEADER,EMP_INC_DETAILS
        WHERE EIH_EMP_CODE = EID_EMP_CODE
          AND EIH_EFF_DATE = EIH_EFF_DATE
          AND EIH_STATUS   = 'P'
          AND EID_EMP_CODE = '003848'
     GROUP BY EID_INCR_CODE,EIH_EFF_DATE
     ORDER BY EID_INCR_CODE,EIH_EFF_DATE;
    that leads to the exit
          AMT EID_INCR_CODE   EIH_EFF_D
    --------- --------------- ---------
         2000 BASIC           21-SEP-10
         2000 BASIC           23-SEP-10
         2000 BASIC           15-OCT-10
         2000 BASIC           21-OCT-10
         1200 HTRAN           21-SEP-10
         1200 HTRAN           23-SEP-10
         1200 HTRAN           15-OCT-10
         1200 HTRAN           21-OCT-10
          800 OTHERS          21-SEP-10
          800 OTHERS          23-SEP-10
          800 OTHERS          15-OCT-10
          800 OTHERS          21-OCT-10
    I have question
    SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EID_EFF_DATE
     FROM EMP_INC_HEADER,EMP_INC_DETAILS
     WHERE EIH_EMP_CODE = EID_EMP_CODE
     AND EIH_EFF_DATE = EID_EFF_DATE
     AND EIH_STATUS = 'P'
     AND EID_EMP_CODE = '003848'
     GROUP BY EID_INCR_CODE,EID_EFF_DATE
     ORDER BY EID_INCR_CODE,EID_EFF_DATE;
    leading to 
    
          AMT EID_INCR_CODE   EID_EFF_D
    --------- --------------- ---------
          500 BASIC           21-SEP-10
          500 BASIC           23-SEP-10
          500 BASIC           15-OCT-10
          500 BASIC           21-OCT-10
          300 HTRAN           21-SEP-10
          300 HTRAN           23-SEP-10
          300 HTRAN           15-OCT-10
          300 HTRAN           21-OCT-10
          200 OTHERS          21-SEP-10
          200 OTHERS          23-SEP-10
          200 OTHERS          15-OCT-10
          200 OTHERS          21-OCT-10
    
    12 rows selected.
    second request is back is correct. as shown in the table.
    but my question what is the difference between my first and second query.
    What's different (I don't get any idea).
    If one is to have an idea please share it with me.

    Thank you...

    GD says:

    SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EIH_EFF_DATE
    FROM EMP_INC_HEADER,EMP_INC_DETAILS
    WHERE EIH_EMP_CODE = EID_EMP_CODE
    AND EIH_EFF_DATE = EIH_EFF_DATE
    AND EIH_STATUS   = 'P'
    AND EID_EMP_CODE = '003848'
    GROUP BY EID_INCR_CODE,EIH_EFF_DATE
    ORDER BY EID_INCR_CODE,EIH_EFF_DATE;
    

    Salvation;
    Why the following criteria exist in the query?

    AND EIH_EFF_DATE = EIH_EFF_DATE
    

    Kind regards
    Mennan

  • Photo cloned. Open empty file: cloning result contaminated. May need to uninstall/reinstall the software of 13 items

    Should I uninstall/reinstall 13 elements if it is contaminated?

    Moving to Photoshop Elements

  • How to determine if event.result is empty?

    I have a remoteObject call that returns the results of the query (event.result).  I am interested to know how to I can determine whether event.result is empty (no return value).

    if(Event.Result == null) did not work for me.

    Now, I know that I could pass the values of the event.result to an arrayCollection collection and ask if ac.length == 0, but I would avoid it if possible.

    Any help is appreciated.  Thank you.

    If event.result is an array, you can check event.result.length == 0.

  • How to speed up the time to query result

    When executing the following query, the result comes after 22 seconds.

    How I minimize this time? Please suggest.
    SELECT DISTINCT
           PERIOD_NO,
           ITEM_CODE,
           ITEM_NAME,
           SUM(CASE WHEN LEVEL_TYPE IN 'SUB ZONE' THEN WD_FORECAST_QTY_BU / CNV / ML ELSE 0 END)TOT_FRCST
    FROM   SHEET_HEAD, SHEET_DETAIL, ITEM_DETAIL
    WHERE  WH_SYS_ID = WD_WH_SYS_ID 
    AND    ITEM_CODE = WD_ITEM_CODE(+)
    AND    PERIOD_NO BETWEEN :PERIOD1 AND :PERIOD2
    AND    WH_REVISION_NO = 0 
    AND    WH_LEVEL_CODE NOT IN (SELECT WH_LEVEL_CODE FROM SHEET_HEAD WHERE WH_REVISION_NO = 1)
    GROUP BY   ITEM_CODE, ITEM_NAME, WH_PERIOD_NO
    Sanjay

    Hello

    with speed suggest it would be always be expirement with indexing on parameters, after that first scans all what is currently happening in what concerns analyses of full table etc. which are "more expensive."

    Level of the specific actions on your code, that what follows comes out too expensive; -

    AND    WH_LEVEL_CODE NOT IN (SELECT WH_LEVEL_CODE FROM SHEET_HEAD WHERE WH_REVISION_NO = 1)
    

    Here, I would see if you can rewrite, perhaps with a left join / auto join to achieve the same ends, compare the timings, you might be surprised.

    Kind regards

    Robert.

Maybe you are looking for