XML query returns empty when tags no data

Hi all

I have a problem that I can't solve.

I have the following query:
 select
            xmlelement
            (
               "users",
               xmlagg
               (
                  xmlelement
                  (
                     "user",
                     xmlelement
                     (
                        "username",
                        e.pin
                     ),
                     xmlagg
                     (
                        xmlelement
                        (
                           "details",
                           xmlforest
                           (
                              e.password as "password"
                             ,e.first_name as "forename"
                             ,e.surname as "surname"
                             ,'0' as "retired"
                             ,e.email_address as "email"
                             ,e.telephone_number as "phone"
                             ,'No External Ref' as "externalRef"
                             ,add_months(sysdate,+60) as "expiryDate"
                           )
                        )
                     )
                  )
               )
            ) xml_out
         from   aqaost_examiners e
         group by e.pin;
The query returns the XML code in the desired structure.

But the problem I have is that when there is no data found by the query, I always get a single row returned by the following: < user > < / users >

I tried so many things to try to have the query return nothing if there is no data available, but I can't do without something else goes wrong (to mess up the XML structure, etc.).

Please is - can anyone help or point me in the right direction?

I thank very you much in advance!

Robin

Hello

Peter,

This is the GROUP that does this.

Actually no, the GROUP BY refers to the deepest XMLAgg and is required if e.pin is not unique.

Let it out, and you also seem to have of many XMLAGG (?)

That's assuming that e.pin is unique within the table (which is probably a fair assumption in this case).

In fact, the behavior comes from the XMLAgg in the foreground:

SQL> select xmlelement("users",
  2           xmlagg(
  3             xmlelement("user",
  4               xmlelement("username", e.empno)
  5             , xmlelement("details",
  6                 xmlforest(
  7                   e.ename as "name"
  8                 , e.job as "job"
  9                 )
 10               )
 11             )
 12           )
 13         ) xml_out
 14  from scott.emp e
 15  where 1 = 0
 16  ;

XML_OUT
-------------------------------------

 

As with other global functions (such as SUM or AVG) adding a GROUP OF 'something' solves the problem:

SQL> select xmlelement("users",
  2           xmlagg(
  3             xmlelement("user",
  4               xmlelement("username", e.empno)
  5             , xmlelement("details",
  6                 xmlforest(
  7                   e.ename as "name"
  8                 , e.job as "job"
  9                 )
 10               )
 11             )
 12           )
 13         ) xml_out
 14  from scott.emp e
 15  where 1 = 0
 16  group by null
 17  ;

no rows selected

Robin,
So the more intimate XMLAgg is really necessary, you can use a subquery:

select xmlelement("users", v.users)
from (
  select xmlagg(
           xmlelement("user",
             xmlelement("username", e.empno)
           , xmlagg(
               xmlelement("details",
                 xmlforest(
                   e.ename as "name"
                 , e.job as "job"
                 )
               )
             )
           )
         ) as users
  from scott.emp e
  group by e.empno
) v
where v.users is not null
;

Tags: Database

Similar Questions

  • copy of XSLT creates a xml that returns empty while trying to access the elements using XPATH

    Hello

    I'm doing a copy - of the function by using the XSLT in jdev. That's what I do

    < xsl: param name = "appdataDO" / >

    < xsl: template match = "/" >

    < ns1:applicationData >

    < ns1:applicationId >

    < xsl: value-of select = "$appdataDO / ns1:applicationData / ns1:applicationId" / >

    < / ns1:applicationId >

    < xsl: copy-of select = "/ fslo:ExternalapplicationData / fslo:ApplicationsHDRAddInfo" >

    < / xsl: Copy - of >

    < / ns1:applicationData >

    < / xsl: template >

    < / xsl: stylesheet >

    After that, I can see the document created in the flow of process like this:

    < ns1:applicationData >

    < ns1:applicationId > MMMM < / ns1:applicationId >

    < ns2:ApplicationsHDRAddInfo >

    < ns3:genericFromBasePrimitive > iuoui < / ns3:genericFromBasePrimitive >

    < ns4:EstimatedMarketValue > 77 < / ns4:EstimatedMarketValue >

    Jih < ns4:PropertyInsuranceFee > < / ns4:PropertyInsuranceFee >

    hjh < ns4:LoanOriginationFee > < / ns4:LoanOriginationFee >

    KKKKK < ns4:RegistrarFee > < / ns4:RegistrarFee >

    hjh < ns4:LoanCashInFee > < / ns4:LoanCashInFee >

    < ns4:LoanPaidInCashFlag > cddffgd < / ns4:LoanPaidInCashFlag >

    < / ns2:ApplicationsHDRAddInfo >

    < / ns1:applicationData >

    But whenever I am trying to extract all nodes output I get an empty result. I can copy the whole dataset in the same type of variable.

    But I am unable to get the individual elements using XPATH.

    I tried to use the exslt for all nodes and xslt 2.0 without success.

    Namespaces may be the culprit here. The test in the jdev method can produce a result, but during the execution, the xpath expression returns empty.

    I created another transformation where I try to copy the data from the DataObject precious a simple string in an another data object.

    This is the test sample source xml transformation created by jdev when testing with all the namespaces, where I try to copy the data into a simple string in an another data object.

    " < applicationData xmlns: xsi =" http://www.w3.org/2001/XMLSchema-instance "xsi: schemaLocation =" http://xmlns.Oracle.com/bpmpa/FS/ulo/types file:/C:/JDeveloper/NewAPP/Xfrm/xsd/ApplicationData.xsd "xmlns =" http://xmlns.Oracle.com/bpmpa/FS/ulo/types "> "

    applicationId289 < applicationId > < / applicationId >

    < ApplicationsHDRAddInfo >

    " < genericFromBasePrimitive xmlns =" http://xmlns.Oracle.com/BPM/PA/Extn/types/BasePrimitive "> genericFromBasePrimitive290 < / genericFromBasePrimitive > .

    " < EstimatedMarketValue xmlns =" http://xmlns.Oracle.com/BPM/PA/Extn/headerCategories/ "> 291 < / EstimatedMarketValue > .

    " < PropertyInsuranceFee xmlns =" http://xmlns.Oracle.com/BPM/PA/Extn/headerCategories/ "> PropertyInsuranceFee292 < / PropertyInsuranceFee > .

    " < LoanOriginationFee xmlns =" http://xmlns.Oracle.com/BPM/PA/Extn/headerCategories/ "> LoanOriginationFee293 < / LoanOriginationFee > .

    " < RegistrarFee xmlns =" http://xmlns.Oracle.com/BPM/PA/Extn/headerCategories/ "> RegistrarFee294 < / RegistrarFee > .

    " < LoanCashInFee xmlns =" http://xmlns.Oracle.com/BPM/PA/Extn/headerCategories/ "> LoanCashInFee295 < / LoanCashInFee > .

    " < LoanPaidInCashFlag xmlns =" http://xmlns.Oracle.com/BPM/PA/Extn/headerCategories/ "> LoanPaidInCashFlag296 < / LoanPaidInCashFlag > .

    < / ApplicationsHDRAddInfo >

    < / applicationData >

    And the xslt transformation

    < xsl: template match = "/" >

    < ns1:DefaultOutput >

    < ns1:attribute1 >

    < xsl: value-of select = "/ fslo:applicationData / fslo:ApplicationsHDRAddInfo / custom: LoanOriginationFee" / >

    < / ns1:attribute1 >

    < / ns1:DefaultOutput >

    < / xsl: template >

    The result is an empty attribute1. Any help will be appreciated.

    Please remove attributeFormDefault = "qualified" elementFormDefault = "qualified" in your XSD

    Please visit the following link:

    http://www.oraclefromguatemala.com.gt/?p=34

  • AOP "Query was empty" [from: cannot insert data with the PDO function]

    Now try to DELETE a record.  I select a list and go to the routine to delete.  The record appears, but when I delete, I get an error saying

    Fatal error : Eception exception 'Exception PDOException' with message ' SQLSTATE [42000]: syntax error or access violation: 1065-query was empty ' in /home1/sainttim/public_html/DeleteRec.php:53 stack trace: home1/sainttim/public_html/DeleteRec.php(53) #0: PDOStatement-> execute (Array) #1 {main} thrown in /home1/sainttim/public_html/DeleteRec.php online 53

    I do not understand why the query is empty because the data are displayed on the screen, but assume that I see on the screen is not what is in the table ($_POST ['delete']).  I'm stuck!

    My code:

    $OK = false;

    $deleted = false;

    If (isset($_GET['varpage'])) {}

    $varpageSend = $_GET ['varpage'];

    $NextPage = ' DisplayText.php? varpage = ". $varpageSend;"»

    }

    If ((isset($_GET['recid'])) & & ($_GET ['recid']! = "")) {}

    $delrec = $_GET ['recid'];

    }

    on the other

    {

    $error = "record does not exist!"

    }

    If (isset($_GET['recid']) & &! $_POST)

    {

    prepare the SQL query to view folder

    $sql = "SELECT home_key, enriched, h_date, h_seq, h_col, p_heading, p_text, h_hide FROM Homepage_text WHERE home_key =?";

    RS1 $= $sainttim-> prepare ($sql);

    $OK = $rs1-> execute (array($_GET['recid']));

    $row = $rs1-> fetch();

    $home_key = $row ["home_key"];

    $textpage is "enriched" $row;.

    $h_date = $row ["h_date"];

    $h_seq = $row ["h_seq"];

    $h_col = $row ["h_col"];

    $p_heading = $row ["p_heading"];

    $p_text = $row ["p_text"];

    $h_hide = $row ["h_hide"];

    If ($h_hide == 0) {}

    $h_hide = 'n';

    }

    else {}

    $h_hide = 'y ';

    }

    If (isset ($rs1) & &! $OK) {}

    $error = $rs1-> errorInfo();

    If (isset($error[2])) {}

    store the error message if the request fails

    $error = $error [2];

    }

    }

    }


    If (isset($_POST['delete']))

    {

    NEW code

    $deletesql = "DELETE FROM Homepage_text WHERE home_key =?';"

    $stmt = $sainttim-> prepare ($deleteSQL);

    $deleted = $stmt-> execute ($row);

    If (! $deleted)

    {

    $error = "There is a problem to remove the record.";

    }

    else {}

    Header ('Location: '. $deleteGoTo);

    "exit";

    }

    }


    Form:

    Entry < h1 > delete of <? PHP echo $varpageSend;? > Page < / h1 >

    <? PHP if (isset ($error)) {}

    echo "class < p > 'errormsg' = > error:". " $error. "< /p > ';

    } ? >

    < are method = "POST" name = "form1" id = "form1" >

    < table class = "DisplayTable" align = "center" >

    < b >

    < td align = "right" > Page: < table >

    < td > <? PHP echo $textpage? > < table >

    < /tr >

    < tr valign = 'of basic">

    < td align = "right" > Date: < table >

    < td > <? PHP echo $h_date? > < table >

    < /tr >

    < b >

    < td align = "right" > sequence: < table >

    < td > <? PHP echo $h_seq? > < table >

    < /tr >

    < b >

    < td align = "right" > Col: < table >

    < td > <? PHP echo $h_col? > < table >

    < /tr >

    < b >

    < td align = "right" > title: < table >

    < td > <? PHP echo $p_heading? > < table >

    < /tr >

    < b >

    < td align = "right" > text content: < table >

    < td > <? PHP echo $p_text? > < table >

    < /tr >

    < b >

    < td align = "right" > content hide? : < table >

    < td > <? PHP echo $h_hide? > < table >

    < /tr >

    < b >

    < display td = "hidden" > < input value = <? PHP echo $delrec? > name = 'deletekey"id ="deletekey"/ > < table >

    < display td = "hidden" > < table >

    < /tr >

    < b >

    < td align = "right" > < a href = "DisplayText.php? varpage = <?" PHP echo $Thistextpage;? > "> < span class ="Red"> CANCEL </span > < /a > < table >.

    < td align = "left" > < input name = "remove" id = 'delete' type = 'submit' class = 'GreenButton"value ="Confirm deletion"/ > < table >

    < /tr >

    < /table >

    < / make >

    The reason why the query is empty lies in the lack of uniformity in the spelling of your variable to the prepared statement:

    $deletesql = "DELETE FROM Homepage_text WHERE home_key =?";

    $stmt = $sainttim-> prepare ($deleteSQL);

    The query is stored in the form of $deletesql, but the value you pass to the prepare() method is $deleteSQL. PHP variables are case-sensitive. Use is $deletesql in both cases, or store the query as $deleteSQL.

  • XML Query, returning null - matter of possible namespaces

    I have the following XML
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
       <s:Body>
          <CodesByTypeResponse xmlns="urn: WA.Ecy.ADS.CombinedCode.Services">
             <CodeList xmlns:a="http://schemas.datacontract.org/2004/07/WA.Ecy.ADS.CombinedCode.Service.DataAccess" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>116</a:CombinedCodeId>
                   <a:CombinedCodeValue>01</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>ADAMS</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>117</a:CombinedCodeId>
                   <a:CombinedCodeValue>02</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>ASOTIN</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>118</a:CombinedCodeId>
                   <a:CombinedCodeValue>03</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>BENTON</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>119</a:CombinedCodeId>
                   <a:CombinedCodeValue>04</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>CHELAN</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>120</a:CombinedCodeId>
                   <a:CombinedCodeValue>05</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>CLALLAM</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>121</a:CombinedCodeId>
                   <a:CombinedCodeValue>06</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>CLARK</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>122</a:CombinedCodeId>
                   <a:CombinedCodeValue>07</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>COLUMBIA</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>123</a:CombinedCodeId>
                   <a:CombinedCodeValue>08</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>COWLITZ</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>124</a:CombinedCodeId>
                   <a:CombinedCodeValue>09</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>DOUGLAS</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>125</a:CombinedCodeId>
                   <a:CombinedCodeValue>10</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>FERRY</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>126</a:CombinedCodeId>
                   <a:CombinedCodeValue>11</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>FRANKLIN</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>127</a:CombinedCodeId>
                   <a:CombinedCodeValue>12</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>GARFIELD</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>128</a:CombinedCodeId>
                   <a:CombinedCodeValue>13</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>GRANT</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>129</a:CombinedCodeId>
                   <a:CombinedCodeValue>14</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>GRAYS HARBOR</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>130</a:CombinedCodeId>
                   <a:CombinedCodeValue>15</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>ISLAND</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>131</a:CombinedCodeId>
                   <a:CombinedCodeValue>16</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>JEFFERSON</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>132</a:CombinedCodeId>
                   <a:CombinedCodeValue>17</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>KING</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>133</a:CombinedCodeId>
                   <a:CombinedCodeValue>18</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>KITSAP</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>134</a:CombinedCodeId>
                   <a:CombinedCodeValue>19</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>KITTITAS</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>135</a:CombinedCodeId>
                   <a:CombinedCodeValue>20</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>KLICKITAT</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>136</a:CombinedCodeId>
                   <a:CombinedCodeValue>21</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>LEWIS</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>137</a:CombinedCodeId>
                   <a:CombinedCodeValue>22</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>LINCOLN</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>138</a:CombinedCodeId>
                   <a:CombinedCodeValue>23</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>MASON</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>139</a:CombinedCodeId>
                   <a:CombinedCodeValue>24</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>OKANOGAN</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>140</a:CombinedCodeId>
                   <a:CombinedCodeValue>25</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>PACIFIC</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>141</a:CombinedCodeId>
                   <a:CombinedCodeValue>26</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>PEND OREILLE</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>142</a:CombinedCodeId>
                   <a:CombinedCodeValue>27</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>PIERCE</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>143</a:CombinedCodeId>
                   <a:CombinedCodeValue>28</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>SAN JUAN</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>144</a:CombinedCodeId>
                   <a:CombinedCodeValue>29</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>SKAGIT</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>145</a:CombinedCodeId>
                   <a:CombinedCodeValue>30</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>SKAMANIA</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>146</a:CombinedCodeId>
                   <a:CombinedCodeValue>31</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>SNOHOMISH</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>147</a:CombinedCodeId>
                   <a:CombinedCodeValue>32</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>SPOKANE</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>148</a:CombinedCodeId>
                   <a:CombinedCodeValue>33</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>STEVENS</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>149</a:CombinedCodeId>
                   <a:CombinedCodeValue>34</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>THURSTON</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>150</a:CombinedCodeId>
                   <a:CombinedCodeValue>35</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>WAHKIAKUM</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>151</a:CombinedCodeId>
                   <a:CombinedCodeValue>36</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>WALLA WALLA</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>152</a:CombinedCodeId>
                   <a:CombinedCodeValue>37</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>WHATCOM</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>153</a:CombinedCodeId>
                   <a:CombinedCodeValue>38</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>WHITMAN</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
                <a:CombinedCodeEntity>
                   <a:CombinedCodeId>154</a:CombinedCodeId>
                   <a:CombinedCodeValue>39</a:CombinedCodeValue>
                   <a:CombinedCodeDescription>YAKIMA</a:CombinedCodeDescription>
                   <a:CombinedTypeCodeId>7</a:CombinedTypeCodeId>
                   <a:IsActiveFlag>true</a:IsActiveFlag>
                   <a:CreatedDate>2009-03-04T17:55:13.943</a:CreatedDate>
                   <a:ModifiedByName>CombinedCodeSSIS</a:ModifiedByName>
                   <a:ModifiedDate>2009-03-04T17:55:13.943</a:ModifiedDate>
                   <a:CreatedByName>CombinedCodeSSIS</a:CreatedByName>
                </a:CombinedCodeEntity>
             </CodeList>
          </CodesByTypeResponse>
       </s:Body>
    </s:Envelope>
    I'm recovering the value of Code and Description.

    I am using the following query - where the get_combined_Code function returns the above XML code
    select x.*
    from (
    select facsite_pkg.get_combined_code('county') xml from dual) t, 
    xmltable(xmlnamespaces('a' as "a"),
    '//a:CombinedCodeEntity' passing t.xml.extract('//a:CombinedCodeEntity',
      'xmlns:a="http://schemas.datacontract.org/2004/07/WA.Ecy.ADS.CombinedCode.Service.DataAccess" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"')
    columns code_id varchar2(10) path 'a:CombinedCodeValue',
    code_description varchar2(100) path 'a:CombinedCodeDescription') x
    This query returns no records.

    I first tried this without the namespace clause, but this failed with the error: ORA-19228: XPST0008 - undeclared identifier: 'a' local-name of the prefix ' a: CombinedCodeEntity'

    I also tried to make the namespace clause
     xmlnamespaces('urn:WA.Ecy.ADS.CombinedCode.Services' as "a") 
    but the end result is the same.

    Any thoughts on where things have gone wrong?

    Thank you, Tony

    use:

    xmlnamespaces('http://schemas.xmlsoap.org/soap/envelope' as "s",
                           'http://schemas.datacontract.org/2004/07/WA.Ecy.ADS.CombinedCode.Service.DataAccess' as "a")
    

    Amiel

  • Date query return empty

    EVENTDATE = 07/10/2004 15:25:06

    Hi, I have the following query that is return nothing / white how can I find the file above using query below

    SELECT * FROM TESTDATE
    WHERE to_DATE(event_dte_tme,'YYYY/MM/DD fmHH:MI:SS PM') between to_date('2004/10/12 3:25:06 PM','YYYY/MM/DD fmHH:MI:SS PM') and  to_date('2004/10/07 3:25:06 PM','YYYY/MM/DD fmHH:MI:SS PM')
     

    So why you use to_date in date field... Simply delete to_date and run the below...

    SELECT * FROM TESTDATE

    WHERE the event_dte_tme between to_date('2004/10/06 3:25:06 PM','YYYY/MM/DD fmHH:MI:SS PM') and to_date('2004/10/12 3:25:06 PM','YYYY/MM/DD fmHH:MI:SS PM')

    Thank you

    Ann

  • XML QUERY returning no values

    I have the following. I can not all the values of the meldeblatt node.

    DECLARE

    CLOB donnees_xml

    : = ' < ? XML version = "1.0" encoding = "UTF-8"? >

    < oestat gemeinde = "612" version = "1" >

    < betriebnr betrieb "4" = >

    < meldeblatt mblattnr = bearbeiter '51356' = 'ATLAS' ankunft = abreise '2015-04-21' = '2015-04-22' abgeplant = '2015-04-22' reisegruppe = "0" >

    < landschl lschlnr = "0" anzpers = "4" / >

    < gastart gastart = "N" anzpers = "1" / >

    < gastart gastart = 'F' anzpers = '3' / >

    < gast gastlfdnr = '1' gasttyp = vorname "HG" = "Jim" name = "Smith" gebdatum = "1974-06-03" sex = '2' herkunftsland = '0' strasse = 'Dorfstrasse 3' strasse2 = "' nation = tro"UEA"="Fluehli"= please"6173"staatsang ="UEA"/ >"

    < gast gastlfdnr = '2' gasttyp = vorname 'KI' = 'John' name = "Smith" gebdatum = '2007-03-30' sex = '0' herkunftsland = '0' strasse = 'Dorfstrasse 3' strasse2 = "' nation = tro"UEA"="Fluehli"= please"6173"staatsang ="UEA"/ >"

    < gast gastlfdnr = '3' gasttyp = «KI» vorname = 'Jane' name = "Smith" gebdatum = '2011-09-19' sex = '0' herkunftsland = '0' strasse = 'Dorfstrasse 3' strasse2 = "' nation = tro"UEA"="Fluehli"= please"6173"staatsang ="UEA"/ >"

    < gast gastlfdnr = "4" gasttyp = vorname 'KI' = 'Henry' name = "Smith" gebdatum = '2009-12-11' sex = '0' herkunftsland = '0' strasse = 'Dorfstrasse 3' strasse2 = "' nation = tro"UEA"="Fluehli"= please"6173"staatsang ="UEA"/ >"

    < / meldeblatt >

    < / betrieb >

    < / gemeinde > ';

    BEGIN

    I'm

    IN (SELECT lschlnr

    ankunft

    abreise

    abgeplant

    bearbeiter

    landschl

    x2.gastlfdnr

    x2.strasse

    FROM XMLTABLE ("gemeinde/betrieb"

    PASSAGE xmltype (donnees_xml)

    Lschlnr of VARCHAR COLUMNS (2000) PATH 'andschl/@lschlnr '.

    , ankunft VARCHAR2 (200) PATH 'meldeblatt/@ankunft '.

    , abreise VARCHAR2 (200) PATH 'meldeblatt/@abreise '.

    , abgeplant VARCHAR2 (200) PATH 'meldeblatt/@abgeplant '.

    , bearbeiter VARCHAR2 (200) PATH 'meldeblatt/@bearbeiter '.

    , landschl VARCHAR2 (200) PATH 'meldeblatt/landschl/@lschlnr '.

    XMLTYPE PATH "meldeblatt" gastinfo) xm

    XMLTABLE)

    'meldeblatt '.

    PASSAGE gastinfo

    COLUMNS strasse2 VARCHAR2 (2000) PATH ' / gast/@strasse2'

    , gastlfdnr VARCHAR2 (2000) PATH ' / gast/@gastlfdnr'

    , strasse VARCHAR2 (2000) PATH ' / gast/@strasse'

    (x 2))

    LOOP

    Dbms_output.put_line ('lschlnr->'

    || i.lschlnr

    || "ankunft->.

    || i.Ankunft

    || "abreise->.

    || i.Abreise

    || "gastlfdnr->".

    || i.gastlfdnr

    || "Straße->.

    || i.Strasse

    );

    END LOOP;

    END;

    The problem is this part:

    strasse2 VARCHAR2 (2000) PATH ' / gast/@strasse2'

    From the PATH expression a slash device 'find the gast node at the root of the context item', but here the context item is the 'meldeblatt' node, so the path expression target no node.

    The other problem is that step 'gast' should be in the main XQuery expression, if you want to iterate through the sequence of nodes 'gast '.

    This should be what you want:

    ...

    XMLTABLE)

    ' / meldeblatt/gast.

    PASSAGE gastinfo

    PATH of COLUMNS strasse2 VARCHAR2 (2000) '@strasse2 '.

    , gastlfdnr PATH VARCHAR2 (2000) '@gastlfdnr '.

    , strasse PATH VARCHAR2 (2000) '@strasse '.

    ) x 2

  • reload the page when SQL query returns a value

    Hello world

    the title of this discussion may seem strange, but I'll try to explain why I need this:

    A user has the ability to connect on my APEX application. There are several tabs in my application that are visible only if a certain SQL statement returns a value which is not the case by default. The user has also the ability to download a file that is transferred to an external system that analyzes the file and writes the data in the database. During this writing process - which may take several minutes - conditions for some of the tabs to show the will becomes real (-> the query will return a value). When the user refreshes the page manually, the tabs will be displayed. However, I want the tabs will appear automatically when the condition is met.

    Is it possible to refresh the page as soon as the query returns a value? It is perhaps possible to check it on the client side and trigger a refresh of the page when the condition is met. It would be even better if only the tabset has been updated, but refreshing the full page is fine as well.

    Thank you!

    Here is an overview of how it can be done

    This is possible thanks to a dynamic action being performed on a timer.

    View default tabs and dynamic action hide them on loading the page if they are not to be considered

    Create a dynamic action that will execute your query every 5 seconds or more

    If the query returns data, you can use the dynamic action to show your tabs using javascript

  • Query of query count (column) returns empty not zero

    This seems to be a bug in 7,0,1,116466 and 8,0,1,195765

    Query of query count (column) or count (*) returns empty not zero when there is no match. Correctly returns a number when there is query matches.

    For example select count (i_id) of PersonnelQuery where i_id < 100

    Where does a report these?

    scottcook,

    It's a known bug in ColdFusion 6.x which apparently has not been set.

    Bug in CF6 (see the comments section of the page linked below)
    http://livedocs.Adobe.com/ColdFusion/6.1/htmldocs/using_29.htm

    Workaround
    http://www.bennadel.com/blog/244-ColdFusion-query-of-queries-odd-count-behavior.htm

    Report it as a bug
    http://www.Adobe.com/cfusion/mmForm/index.cfm?name=wishform

  • If the data is empty when you use to_date(?,'yyyy/mm/dd') insert a file into db

    online form insert the? is user input, if the user entered the following works find, but if the input file is empty insert get an error, how to handle
    If the data is empty when you use to_date(?,'yyyy/mm/dd')
    Thank you

    Be more specific.

    You try to insert this in a column that is defined as not null?

    If so, you can choose a default value for the value that you want to use if the user leaves the field to the white screen.

    Or, better yet, use the validation of the front to prevent them from going into an empty space (or perhaps failed it there).

    However, if you still want to do it in the DB:

    Insert into table1 (non_null_date_col)
    values (to_date (nvl (?, '' 2199/12/31), "dd/mm/yyyy"));

  • Data browser displays folder as the store empty when it is not

    Hi all

    I used VMware Converter to essentially clone a virtual machine, we, this has allowed me to reduce the drive down, in any case when the navigation data store, I can see the folder but the contents is empty, the original virtual machine is ok, but the cloned VM, you can see the files for.

    If I go in the settings for the virtual machine and click hard disk 1 disk file appears as:--

    Model - Win 2003 Standard R2/template - Win 2003 Standard R2 hard

    But if I navigate this \Template - record Win 2003 Standard R2 data store is dead empty.

    This server starts fine, and if you use WINSCP to navigate the file structure, you can see the files there, then how is the data store browser cannot see them?

    I tried to use Vmotion to move the virtual machine to a new SATA2, SATA3 data store, but the same thing happened, empty folder.

    Someone at - he found this bug before or fixed?

    Stew

    Hello

    Never seen anything like this. Maybe that's how you named the VM... Try something without hyphen or space as well. I use the dashboard all the time, but never spaces. Spaces used to end up causing confusion.

    Are you sure that you look at the appropriate data store? Go to your store Configuration data and do a refresh?

    Using VIC directly to the host or VIC via vCenter?

    Best regards
    Edward L. Haletky
    VMware communities user moderator
    ====
    Author of the book ' VMWare ESX Server in the enterprise: planning and securing virtualization servers, Copyright 2008 Pearson Education.
    Blue gears and SearchVMware Pro items - top of page links of security virtualization - Security Virtualization Round Table Podcast

  • Add a string when the query returns all records

    DB version: 11.2

    create table t (empname varchar2 (25), salary number, varchar2 (20) months, number of over_time);

    insert into values t ('JOHN', 2000, "NOVEMBER2014", 0);

    insert into values t ('KATE', 2000, "NOVEMBER2014", 300);

    insert into values t ('HANS', 5000, "NOVEMBER2014", 100);

    insert into values t ("KRISHNA", 2500, "NOVEMBER2014", 0);

    insert into values t ("SIEW", 3000, "NOVEMBER2014", 0);

    commit;

    SQL > select * from t;

    EMPNAME MONTHS SALARY OVER_TIME

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

    JOHN 2000 NOVEMBER2014 0

    KATE 2000 NOVEMBER2014 300

    HANS 5000 NOVEMBER2014 100

    KRISHNA 2500 NOVEMBER2014 0

    SIEW 3000 NOVEMBER2014 0

    SQL > select * from t where MONTH = 'NOVEMBER2014' and OVER_TIME! = 0 ;

    EMPNAME MONTHS SALARY OVER_TIME

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

    KATE 2000 NOVEMBER2014 300

    HANS 5000 NOVEMBER2014 100

    What I need is:

    If the query above returns at least one record, it should display the line ' Yes. We have one or more employees who worked overtime in November2014'

    before the documents are printed

    Thus, the expected production is

    Yes. We have one or more employees who worked overtime at the November2014

    EMPNAME MONTHS SALARY OVER_TIME

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

    KATE 2000 NOVEMBER2014 300

    HANS 5000 NOVEMBER2014 100

    If the query returns no records then usual 'no rows selected' isn't enough

    Lothar G.f. says:

    In fact, sql * more is no good tool for use considered.

    Really?  It may be a good reporting tool if you learn to use it as such...

    for example

    SQL > ttitle left 'Yes. We have one or more employees who worked overtime in November2014.
    SQL > select * from emp where empno = 1234;

    no selected line

    SQL > select * from emp where empno = 7788;

    Yes. We have one or more employees who worked overtime at the November2014
    EMPNO, ENAME, JOB HIREDATE DEPTNO COMM SAL MGR
    ---------- ---------- --------- ---------- -------------------- ---------- ---------- ----------
    7788, SCOTT, ANALYST, 7566 19 APRIL 1987 00:00:00 3000 20

    This is just a basic example.  It is possible to get SQL * more to ask for the required criteria and that the title could adjust according to this criterion, as well as the query building on it also.

    However, the OP did not specify SQL * as the reporting tool, so there is little interest providing a complete solution which, until they specify what user interface that they are actually using.

  • bad results for the search for context on the empty element tags

    I use Oracle DBMS 11.1 and 11.2 and created an index on an XML column context (article group: PATH_SECTION_GROUP).
    When you enter a query like

    SELECT count (*) FROM my_table t WHERE contains (t.co_xml,'hasPath(/tag1/tag2)') > 0

    I get bad results if tag2 is an empty element tag (< tag2 / >) that appears somewhere in the
    XML instance, but is NOT directly under tag1.

    For example, the following XML instance is (but shouldn't!):

    < a >
    blah blah < tag3 > < tag1 > < / tag3 > < / tag1 >
    blah < tag4 > < tag2 / > < / tag4 >
    < /a >

    This seems to happen only for the empty element tags. Is this a known bug and does anyone know of a workaround?

    Thank you in advance for your help!
    Roman

    Like you, I've been looking in the wrong places, bug of thought, rather than documented behavior. Finally, I came across the following excerpt from the next section of the documentation on haspath in Oracle text reference.

    http://download.Oracle.com/docs/CD/B28359_01/text.111/b28304/cqoper.htm#i997393

    Limits

    Because of the way in which XML data section are saved, false match may appear with XML sections that are completely empty as follows:

    
    

    A query of HASPATH(A/B/E) or HASPATH(A/D/C) falsely corresponds to this document. This type of fake correspondent can be avoided by inserting some text between the empty tags.

  • How to know what sub query returns multiple rows

    Hi all

    Someone can give me hints, how to know what sub query returns many rows in the following query.
    /* Formatted on 2011/05/17 19:22 (Formatter Plus v4.8.8) */
    SELECT a.*, ROWNUM AS rnm
      FROM (SELECT DISTINCT '1' AS "Page View", ou.org_unit_name AS "Org",
                            prxm.mbr_idntfr AS "Beneficiary ID",
                               md.last_name
                            || ', '
                            || md.first_name AS "Beneficiary Name",
                            pci.idntfr AS "Tracking No.",
                            TO_CHAR (TRUNC (req.pa_rqst_date),
                                     'MM/dd/yyyy'
                                    ) AS "Request Date",
                            sts.status_name AS "Status",
                            req.pa_rqst_sid AS "Request #",
                            prxm.mbr_sid AS "Mbr_sid",
                            TO_CHAR
                                  (TRUNC (req.pa_revision_date),
                                   'MM/dd/yyyy'
                                  ) AS "Last Updated",
                            TO_CHAR (psd.TO_DATE, 'MM/dd/yyyy') AS "TO_DATE",
                            prxpl.prvdr_lctn_iid AS "PRVDR_LCTN_IID",
                            pd.prvdr_sid AS "PRVDR_SID", 'Y' AS "State View",
                            DECODE
                               ((SELECT DISTINCT pd.national_prvdr_idntfr
                                            FROM pa_request_x_provider_location prxplo
                                           WHERE prxplo.pa_rqst_sid =
                                                                   req.pa_rqst_sid
                                             AND prxplo.oprtnl_flag = 'A'
                                             AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                0, (SELECT prxplo.prvdr_lctn_idntfr
                                      FROM pa_request_x_provider_location prxplo
                                     WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                       AND prxplo.oprtnl_flag = 'A'
                                       AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                NULL, (SELECT prxplo.prvdr_lctn_idntfr
                                         FROM pa_request_x_provider_location prxplo
                                        WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                          AND prxplo.oprtnl_flag = 'A'
                                          AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                (SELECT DISTINCT pd.national_prvdr_idntfr
                                            FROM pa_request_x_provider_location prxplo
                                           WHERE prxplo.pa_rqst_sid =
                                                                   req.pa_rqst_sid
                                             AND prxplo.oprtnl_flag = 'A'
                                             AND prxplo.pa_prvdr_type_lkpcd = 'RR')
                               ) AS "NPI/ID",
                            DECODE
                               ((SELECT pd.org_bsns_name
                                   FROM pa_request_x_provider_location prxplo
                                  WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                    AND prxplo.oprtnl_flag = 'A'
                                    AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                NULL, (SELECT    pd.last_name
                                              || ', '
                                              || pd.first_name
                                              || ' '
                                              || pd.middle_name
                                         FROM pa_request_x_provider_location prxplo
                                        WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                          AND prxplo.oprtnl_flag = 'A'
                                          AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                (SELECT pd.org_bsns_name
                                   FROM pa_request_x_provider_location prxplo
                                  WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                    AND prxplo.oprtnl_flag = 'A'
                                    AND prxplo.pa_prvdr_type_lkpcd = 'RR')
                               ) AS "Prvdr Name",
                            TO_CHAR (psd.from_date,
                                     'MM/dd/yyyy'
                                    ) AS "Srvc From Date",
                            TO_CHAR (req.validity_start_date,
                                     'MM/DD/YYYY'
                                    ) AS "Due Date",
                            (fn_get_busniess_days (TRUNC (req.validity_start_date))
                            ) AS "Days<br>Left",
                            req.pa_mode_type_lkpcd AS "Source",
                            TO_CHAR (TRUNC (wmdtl.rtng_date),
                                     'MM/dd/yyyy'
                                    ) AS "Assigned On",
                            NVL (wmdtl.assigned_to_user_name,
                                 'Not Assigned'
                                ) AS "Assigned To",
                            req.org_unit_sid AS "OrgUnitSid",
                            TO_CHAR
                                 (wmdtl.modified_date,
                                  'MM/dd/yyyy hh24:mi:ss'
                                 ) AS "WTRD_MODIFIED_DATE",
                            TO_CHAR (wmdtl.rtng_date,
                                     'MM/dd/yyyy'
                                    ) AS "WTRD_RTNG_DATE",
                            req.status_cid AS "PA_STATUS_CID",
                            TO_CHAR (req.modified_date,
                                     'MM/dd/yyyy'
                                    ) AS "PA_REQ_MODIFIED_DATE",
                            prs.state_pa_srvc_type_code
                                                     AS "STATE_PA_SRVC_TYPE_CODE",
                            wmdtl.wm_pa_task_rtng_dtl_sid
                                                        AS "WM_TASK_RTNG_DTL_SID",
                            wmdtl.assigned_to_user_acct_sid
                                              AS "WTRD_Assigned_to_user_acct_sid",
                            (fn_get_busniess_days (TRUNC (req.validity_start_date))
                            ) AS "Days<br>LeftSort",
                            wmdtl.assigned_to_org_unit_sid
                                                  AS "WTRD_Assigned_to_OrgUntSid",
                            DECODE
                               ((SELECT COUNT (*)
                                   FROM pa_request_status prs
                                  WHERE prs.pa_rqst_sid = req.pa_rqst_sid
                                    AND prs.status_cid = 5
                                    AND prs.oprtnl_flag = 'I'),
                                0, 'N',
                                'Y'
                               ) AS "SHOW_UTILIZATION"
                       FROM   pa_request req,
                             pa_certification_identifier pci,
                             status sts,
                             pa_request_x_member prxm,
                             wm_pa_task_routing_detail wmdtl,
                             pa_service_date psd,
                             org_unit ou,
                             pa_request_service prs,
                             pa_request_x_provider_location prxpl,
                             provider_location pl,
                             provider_detail pd,
                             provider p,
                             mbr_dmgrphc md
                      WHERE req.oprtnl_flag = 'A'
                        AND req.status_cid NOT IN
                                     (20, 30, 70, 25, 80, 96, 85, 5, 97, 98, 101)
                        AND req.org_unit_sid IN
                               (3057, 3142, 3058, 3143, 3059, 3144, 3060, 3145,
                                3061, 3146, 3062, 3147, 3063, 3148, 3064, 3149,
                                3065, 3150, 3066, 3151, 3067, 3152, 3068, 3153,
                                3069, 3154, 3070, 3155, 3071, 3156, 3072, 3157,
                                3073, 3158, 3074, 3159, 3075, 3160, 3076, 3161,
                                3077, 3162, 3078, 3163, 3079, 3164, 3080, 3165,
                                3081, 3166, 3082, 3167, 3083, 3168, 3084, 3169,
                                3085, 3170, 3086, 3171, 3087, 3172, 3088, 3173,
                                3089, 3174, 3090, 3175, 3091, 3176, 3092, 3177,
                                3093, 3178, 3094, 3179, 3095, 3180, 3096, 3181,
                                3097, 3182, 3098, 3183, 3099, 3184, 3100, 3185,
                                3101, 3186, 3102, 3187, 3103, 3003, 75000104,
                                75000108, 2006, 75000103, 75000102, 75000113,
                                75000111, 75000109, 2001, 2009, 75000105,
                                75000107, 2004, 2010, 2013, 2014, 2005, 2011,
                                75000112, 2002, 1001, 2012, 75000106, 2007,
                                75000101, 2003, 75000110, 2008, 3001, 3002, 3019,
                                3104, 3020, 3105, 3021, 3106, 3022, 3107, 3023,
                                3108, 3024, 3109, 3025, 3110, 3026, 3111, 3027,
                                3112, 3028, 3113, 3029, 3114, 3030, 3115, 3031,
                                3116, 3032, 3117, 3033, 3118, 3034, 3119, 3035,
                                3120, 3036, 3121, 3037, 3122, 3038, 3123, 3039,
                                3124, 3040, 3125, 3041, 3126, 3042, 3127, 3043,
                                3128, 3044, 3129, 3045, 3130, 3046, 3131, 3047,
                                3132, 3048, 3133, 3049, 3134, 3050, 3135, 3051,
                                3136, 3052, 3137, 3053, 3138, 3054, 3139, 3055,
                                3140, 3056, 3141)
                        AND req.pa_rqst_sid = prs.pa_rqst_sid
                        AND prs.oprtnl_flag = 'A'
                        AND prs.pa_rqst_srvc_sid = psd.pa_rqst_srvc_sid
                        AND psd.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = pci.pa_rqst_sid
                        AND pci.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = prxm.pa_rqst_sid
                        AND prxm.oprtnl_flag = 'A'
                        AND md.oprtnl_flag = 'A'
                        AND md.status_cid = 2
                        AND TRUNC (SYSDATE) BETWEEN md.from_date AND md.TO_DATE
                        AND prxm.mbr_sid = md.mbr_sid
                        AND ou.org_unit_sid = req.org_unit_sid
                        AND ou.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND prxm.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND pci.pa_rqst_sid = prxm.pa_rqst_sid
                        AND pci.pa_rqst_sid = wmdtl.subsystem_task_sid
                        AND pci.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND prxpl.pa_prvdr_type_lkpcd = 'RR'
                        AND prxpl.oprtnl_flag = 'A'
                        AND req.status_cid = sts.status_cid
                        AND sts.status_type_cid = 3
                        AND sts.oprtnl_flag = 'A'
                        AND prxpl.prvdr_lctn_iid = pl.prvdr_lctn_iid
                        AND p.prvdr_sid = pd.prvdr_sid
                        AND p.prvdr_sid = pl.prvdr_sid
                        AND pd.oprtnl_flag = 'A'
                        AND pd.status_cid = 2
                        AND TRUNC (SYSDATE) BETWEEN pd.from_date AND pd.TO_DATE
                        AND wmdtl.subsystem_task_sid = req.pa_rqst_sid
                        AND wmdtl.subsystem_lkpcd = 'PA'
                        AND wmdtl.oprtnl_flag = 'A'
                        AND req.pa_rqst_date > (SYSDATE - 365)
                                       ORDER BY TO_DATE ("Request Date", 'MM/dd/yyyy hh24:mi:ss') DESC,
                            "Beneficiary Name" ASC) a
     WHERE ROWNUM < 102;
    Kind regards
    Prakash P

    Published by: BluShadow on May 17, 2011 15:01
    addition of {noformat}
    {noformat} tags around the code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    3360 wrote:
    See point 9 of this section of the FAQ on how to format the code.

    SQL and PL/SQL FAQ

    I see that you did.

    No, I did. It's pretty easy to change if the code seems formatted anyway below. It's when I go to edit the message and find no sense because it is not formatted in all cases, I despair. {noformat} :) {noformat}

  • If a view object query returns no rows, can the vacuum to be tested at all?

    All those who know or have also experienced:

    I guess that the answer should be Yes, but I tried anyway, I still didn't worked. Here is the code (it's a method behind a command button, a bean of support (I use JDeveloper 10.1.3.4).) In the code, LoggedInStudent is the name of a view object; ZBLCModule is the name of the application module):
        public String commandButton1_action() {
            FacesContext fc = FacesContext.getCurrentInstance();
            ValueBinding vb = fc.getApplication().createValueBinding("#{data}");
            BindingContext bc = (BindingContext)vb.getValue(fc);
            DCDataControl dc = bc.findDataControl("ZBLCModuleDataControl");
            ApplicationModule am = (ApplicationModule)dc.getDataProvider();
            ZBLCModuleImpl zblcam = (ZBLCModuleImpl)am;
            LoggedInStudentImpl studentsFound = (LoggedInStudentImpl)zblcam.getLoggedInStudent();
            
            String navCase = null;
            
            // Test (1): if the view cache is empty; always bombs up the application if it IS empty:
            if(studentsFound.getAllRowsInRange().length == 0) {
                navCase = "userNotFound";
            // (2) The following three tests gets to run only when the cache is not empty; they work fine.
            } else if (((Number)studentsFound.first().getAttribute("HoursAttm")).floatValue() == 0.0) {
                navCase = "noHours";
            } else if (((Number)studentsFound.first().getAttribute("Balance")).floatValue() > 0.0) {
                navCase = "notZero";
            } else if (!(studentsFound.first().getAttribute("Validated").equals(" "))) {
                navCase = "validated";
            } else {
                navCase = "zeroBal";
            }
            return navCase;
        }
    When the view object query returns a line, the whole of the application works without error. When the query returns no rows, test (1) always bombs toward the top of the application, prompting a Houston-30003 error.

    (1) test, I tried the following:
      if (studentsFound.getAllRowsInRange().length == 0)
      if (studentsFound.first() == null)
      if (studentsFound.getEstimatedRowCount() == 0)
      if (studentsFound.isDead()) //I do not know what isDead() does; just tried desperately.
      if (studentsFound.equals(null))
      if (studentsFound.getCurrentRow() == null)
    With each of these events, I got an error of Houston-30003. It does not matter what looks like the conditional test; It is important only when the objects from view cache is empty. If the view cache is not empty, everything, including the test (1), works very well. And when the cache is empty is not because of the failure of the connection to the database, but because the student is not in the data table and line are for the student.

    It is a requirement of the company to do something when the view object query returns no rows. Can it be tested at all? How?

    Or is there something wrong in the first lines in the method before the {color: green} String navCase = null; {color} line?

    Thank you very much for your help!


    Newman

    Hello

    What you have done, is to get a handle to the object that CAN execute queries to the database.
    However, you do not query the database.

    Just add:

      LoggedInStudentImpl studentsFound = (LoggedInStudentImpl)zblcam.getLoggedInStudent();
      //New line
      studentsFound.executeQuery();
    

    The code that Shay has given you is when you do not have a request for all module, but since you are talking about a command etc button I guess that the module of the application is already active.
    The line I gave you should be enough to make it work.

    I'd be careful with the

    studentsFound.hasNext();
    

    I suggest to use estimatedRowCount();

    -Anton

  • query returns different results depends on the length of the day

    Hello!

    I have a query:

    INSERT /*+ APPEND */ INTO pwa_process (
    id,
    id_session,
    id_customer,
    s2k_account,
    service_seq_num,
    msisdn,
    id_tariff,
    contract_end_date,
    last_contract_date,
    next_available_contract_date,
    tariff_name,
    description,
    description_long,
    imei_old,
    activation_date,
    id_customer_number,
    arpu,
    value0,
    value1,
    value2,
    value3,
    value4,
    value5,
    id_pricing_plan)
    WITH msisdns AS (SELECT msisdn ms FROM customer_number cn
    JOIN customer_s2kaccount cs ON cn.s2k_account = cs.s2k_account AND cs.id_customer = v_customerId)
    SELECT
    seq_pwa_process.NEXTVAL,
    v_sessionId,
    customer_s2kaccount.id_customer,
    customer_s2kaccount.s2k_account,
    customer_number.service_seq_num,
    msisdn.msisdn,
    tariff.id,
    NVL(CASE WHEN date_contract_end IS NULL AND le_contract_end_date IS NOT NULL OR (date_contract_end < le_contract_end_date)
             THEN le_contract_end_date
             ELSE NVL(date_contract_end, ADD_MONTHS(customer_number.date_start, customer_number.ada_availability))
        END, TO_DATE('01.01.1970', 'DD.MM.YYYY')) contract_end_date,
    CASE WHEN NOT customer_number.date_first_activation IS NULL AND customer_number.date_first_activation >      (CASE WHEN ada_priority = 1 THEN ada_date_pwa
            WHEN ada_priority <> 1 AND (date_pwa IS NULL AND exchange_date IS NOT NULL OR date_pwa < exchange_date) 
            THEN exchange_date 
            ELSE date_pwa 
      END) 
         THEN customer_number.date_first_activation
         ELSE   (CASE WHEN ada_priority = 1 THEN ada_date_pwa
            WHEN ada_priority <> 1 AND (date_pwa IS NULL AND exchange_date IS NOT NULL OR date_pwa < exchange_date) 
            THEN exchange_date 
            ELSE date_pwa 
      END) 
    END last_contract_date,
    ADD_MONTHS(CASE WHEN NOT customer_number.date_first_activation IS NULL AND customer_number.date_first_activation > NVL(  (CASE WHEN ada_priority = 1 THEN ada_date_pwa
            WHEN ada_priority <> 1 AND (date_pwa IS NULL AND exchange_date IS NOT NULL OR date_pwa < exchange_date) 
            THEN exchange_date 
            ELSE date_pwa 
      END) ,
                                                                                                                           NVL(customer_number.date_first_activation, NVL(customer_number.date_start, customer_number.date_effective)))
                    THEN customer_number.date_first_activation
                    ELSE NVL(  (CASE WHEN ada_priority = 1 THEN ada_date_pwa
            WHEN ada_priority <> 1 AND (date_pwa IS NULL AND exchange_date IS NOT NULL OR date_pwa < exchange_date) 
            THEN exchange_date 
            ELSE date_pwa 
      END) , NVL(customer_number.date_first_activation, NVL(customer_number.date_start, customer_number.date_effective)))
               END, customer_number.ada_availability - DECODE(NVL(customer_number.current_contract_type, 0), 2, DECODE(customer_number.reduced_contract_used, 0, NVL(customer_number.el_contract_calculated_reduc,0), 0), 0)) next_available_contract_date,
    tariff.name_ada,
    DECODE(msisdn_group.def_column, 0, msisdn.value0, 1, msisdn.value1, 2, msisdn.value2, 3, msisdn.value3, 4, msisdn.value4, 5, msisdn.value5, msisdn.value0),
    msisdn.value0 || ';' || NVL(msisdn.value1, '') || ';' || NVL(msisdn.value2,'') || ';' || NVL(msisdn.value3,'') || ';' || NVL(msisdn.value4, '') || ';' || NVL(msisdn.value5, ''),
    customer_number.imei,
    NVL(customer_number.date_first_activation, NVL(customer_number.date_start, customer_number.date_effective)) date_start,
    customer_number.id,
    NVL(s2kaccount.arpu1,0),
    msisdn.value0,
    msisdn.value1,
    msisdn.value2,
    msisdn.value3,
    msisdn.value4,
    msisdn.value5,
    customer_number.id_pricing_plan
    FROM customer_s2kaccount
    JOIN customer_number ON customer_number.s2k_account = customer_s2kaccount.s2k_account AND customer_number.service_state = 'AB'
    JOIN msisdn ON msisdn.msisdn = customer_number.msisdn
    JOIN TABLE(CAST(v_tmp_table AS ADA.NUMBER_TABLE)) ids ON ids.column_value = msisdn.id
    JOIN msisdn_group ON msisdn_group.id = msisdn.id_msisdn_group
    JOIN pricing_plan ON pricing_plan.id = customer_number.id_pricing_plan AND pricing_plan.is_for_pwa = 1
    JOIN tariff ON tariff.name = pricing_plan.id
    JOIN s2kaccount ON s2kaccount.s2k_account = customer_number.s2k_account
    LEFT
    JOIN (SELECT msisdn, exchange_date, ADD_MONTHS(exchange_date, MAX(prolongation)) le_contract_end_date
    FROM loyalty_exchange a, msisdns
    WHERE a.msisdn = msisdns.ms AND exchange_date >= ALL (SELECT exchange_date FROM loyalty_exchange b WHERE b.msisdn = a.msisdn)
    GROUP BY msisdn, exchange_date) le ON le.msisdn = customer_number.msisdn
    WHERE customer_s2kaccount.id_customer = v_customerId;
    This query returns different results in the morning (09:00) and afternoon (16:00) on the same database for the same input data (I have prepared a script to test).
    Oracle 9.2.0.6 @solaris
    I checked the query plans, but they look the same in the morning and the afternoon. I don't know where to look for a problem/bug.
    Please help me with suggestions. is in bug with join ansi? or a left outer join?

    Published by: batonoff on February 16, 2009 16:56

    Published by: batonoff on February 16, 2009 16:58

    Published by: batonoff on February 16, 2009 17:00

    I recommend you post your declaration in the {} code tags (without the spaces) so that we can actually read.

    You are absolutely positive that nothing has changed on the data between when you run in the morning and in the afternoon?

Maybe you are looking for

  • Delete the account of the deceased

    Hello We have no access to the Skype account with our deceased parent, job e-mail account has been deleted and we do not know the password. What documents will we provide allow you to delete the account? Concerning

  • Satellite 5200 701: how to replace CD player?

    Hello everyone. Sorry, I can't write with some errors.I have laptop satellite s5200-701, & a few days previously, cd-rom cd-rom has been breaking. "Views" on Windows, but the cd-rom device cannot read the CD or DVD. I drank new device (TEAC DW-224th)

  • Equium A100-027: after installing XP no sound

    After buying an Equium A100-027 with pre-installed Vista Home, I had to remove this in order to recharge with XP Pro SP2 to join to the domain of my company. Everything is installed properly and audio drivers are also present and work according to th

  • Upgrade of a socket AMD APU FM-1

    I have a DV7-6169NR of the APU A6 - 3400M. I found the instructions to change the APU, but no list of the APU support. Any Jack FM-1 APU will work in my laptop? Thank you B

  • HP14 TS NOTEBOOK PC: software of unknown device

    I recently downloaded a recovery image started my sytem with it after no recovery manager missedAllot if things changed thoBut I got a rear part by downloading their driversI always get this unknown device needs software update message with an exclam