With the help of the variable? operator in an XPath Expression

I try using the operator variable (?) in an Oracle statement used in a prepared where query clause. This is the query:
select xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID 
      from AUDITED_EVENT_XML_MIN e,
         XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
                '/xae:auditable-event'
                PASSING e.xml_event_content
                COLUMNS
                APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
                VERSION          VARCHAR2(255) PATH 'xae:version',
                EVENT_TYPE       VARCHAR2(255) PATH 'xae:event-type',
                SENDING_SITE     VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
                RECEIVING_SITE   VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
                EVENT_ID         VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
            where existsNode(E.XML_EVENT_CONTENT, '/xae:auditable-event[xae:event-type=?]','xmlns:xae="http://gov/va/med/datasharing/audit/endpoint/audit"') = 1
This code works when the? is replaced by 'aValue '. I need to use the? so that my Java client can pass a variable value in the query.
Is this a sustainable feature or I do something wrong?
I've seen examples in the Guide of the Oracle XML DB Developer where there was a? in an XPath expression.
I also tried '? "with the same question...

Here is the version information:
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Sep 10 18:41:55 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Any help would be greatly appreciated.
Thanks in advance...

Can someone tell me whether or not he is a legal substitution?

No, this is not legal.

? defines a placeholder for a variable binding, that of all he can do, binds a variable (value) at run time, it does not handle identifiers and especially the moving parts of the code.

You can use the concatenation to add the code fragment:

" ... AND " + myFilter + " ... remaining for the query string"

BTW, I see you are trying to create a paging query, but the ORDER BY is moved, it must be in the innermost query, not at the same level as ROWNUM:

SELECT PK_ID, EVENT_TYPE, OUTCOME, SENDING_SITE, RECEIVING_SITE, CREATED_TIME, EVENT_ID, PATIENT_ID
FROM (
  SELECT rownum as rn, PK_ID, EVENT_TYPE, OUTCOME, SENDING_SITE, RECEIVING_SITE, CREATED_TIME, EVENT_ID, PATIENT_ID
  FROM (
    SELECT aet.AUDITABLE_EVENT_XML_PK_ID AS PK_ID, xt.EVENT_TYPE, xt.OUTCOME, xt.SENDING_SITE, xt.RECEIVING_SITE, aet.CREATED_TIME as CREATED_TIME, xt.EVENT_ID, xt.PATIENT_ID
    FROM AUDITABLE_EVENT_XML aet,
         XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
           '/xae:auditable-event'
           PASSING aet.xml_event_content
           COLUMNS
             EVENT_TYPE       VARCHAR2(255) PATH 'xae:event-type',
             SENDING_SITE     VARCHAR2(255) PATH 'xae:sending-site',
             RECEIVING_SITE   VARCHAR2(255) PATH 'xae:receiving-site',
             EVENT_ID         VARCHAR2(255) PATH 'xae:event-id',
             PATIENT_ID       VARCHAR2(255) PATH 'xae:patient-id',
             OUTCOME          VARCHAR2(255) PATH 'xae:outcome'
         ) xt
    WHERE aet.CREATED_TIME BETWEEN ? AND ?
    AND (OUTCOME=0 or OUTCOME=1)
    ORDER BY CREATED_TIME desc
  )
  WHERE rownum <= ?
)
WHERE rn > ?

or using ROW_NUMBER():

SELECT PK_ID, EVENT_TYPE, OUTCOME, SENDING_SITE, RECEIVING_SITE, CREATED_TIME, EVENT_ID, PATIENT_ID
FROM (
  SELECT aet.AUDITABLE_EVENT_XML_PK_ID AS PK_ID, xt.EVENT_TYPE, xt.OUTCOME, xt.SENDING_SITE, xt.RECEIVING_SITE, aet.CREATED_TIME as CREATED_TIME, xt.EVENT_ID, xt.PATIENT_ID
       , ROW_NUMBER() OVER(ORDER BY created_time DESC) rn
  FROM AUDITABLE_EVENT_XML aet,
       XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
         '/xae:auditable-event'
         PASSING aet.xml_event_content
         COLUMNS
           EVENT_TYPE       VARCHAR2(255) PATH 'xae:event-type',
           SENDING_SITE     VARCHAR2(255) PATH 'xae:sending-site',
           RECEIVING_SITE   VARCHAR2(255) PATH 'xae:receiving-site',
           EVENT_ID         VARCHAR2(255) PATH 'xae:event-id',
           PATIENT_ID       VARCHAR2(255) PATH 'xae:patient-id',
           OUTCOME          VARCHAR2(255) PATH 'xae:outcome'
       ) xt
  WHERE aet.CREATED_TIME BETWEEN ? AND ?
  AND (OUTCOME=0 or OUTCOME=1)
)
WHERE rn <= ?
AND rn > ? 

Tags: Oracle Development

Similar Questions

  • Hello, please tell me, if iphone purchased at the Canada without a contract with the mobile operator, it will be subject to safeguards in Russia

    Hello, please tell me, if iphone purchased at the Canada without a contract with the mobile operator, it will be subject to safeguards in Russia

    You have the latest version of iOS installed and if you use not updated the software on the phone (jailbreak), the phone can't be hacked.

    Unauthorized modification of the iOS can cause security vulnerabilities, instability, reduced and another independence from...

  • Adjust the data in the database with the variables

    Hello

    For my internship, I have an assignment to read and set a database with the variables. This SQL server 2005 database contains variables of a controller. These are read and write variables. The assignment is to display the read variables and the user can adjust the variables of Scripture. The first part was "easy" because the forum contained a lot of examples of this. The second part is more difficult because the forum contains absolutely no example of this. Can I use LabVIEW 2010 and 2011, and also I downloaded the 30 day trial of the database connection tool. If it's useful, I can recommend my company to buy this package. Playback vi makes use of a UDL (Microsoft data link) connection.

    So you guys my question is: is it possible to adjust the specific variables in a database using LabVIEW? And maybe you can give me a little advice on this topic...

    Thanks in advance!

    Roy

    In SQL, the specific data are always selected with the keyword WHERE. In VI to update there is a link for options, you can for example add a constant 'WHERE id = 1457 and measure > 0.54 ".

    You can ofc. also build this chain through controls, settings and other means.

    If you prefer, you can use the Execute Query (under Advanced tab I think) to which you can send the complete query example "TestTable Update set name ="Zeus"where id > 14 and id.<>

    /Y

  • Filter Table ADF | with the Like operator

    Dear all,

    I use JDeveloper 12 c.

    I have an obligation to provide the filter on the table with the 'Like' operator

    I'm following Ashish Awasti method on it. Ashish Awasthi (Jdev/ADF) Blog: filter on af:table column programmatically, Invoke 'FilterableQueryDescriptor' t...

    All very well here. In "FilterableQueryDescriptor" default search operator is "begins by". Is it possible to change the operator "starts by ' to 'Like' operator.

    Please suggest.

    Thank you

    Vieira

    An addition: If the op just wants to use the like operator, it must use the data of the field in the table, as is. View implizite criteria build for filter uses

    (((Countries.COUNTRY_NAME COMME (: bindName ||))) (('%')) OR (: bindName IS NULL)))

    for the startswith operator.  Yes ther EI '%' added automatically. It should be replaced by

    (((Countries.COUNTRY_NAME COMME (: bindName)) OR (: bindName IS NULL)))

    to be a true sql 'like' operator. Then, the user must enter the filter with the '%' residue criteria to perform a generic search.

    Adding a '%' before the setting is counterproductive because it can be a bottleneck. The PB needs to do a full table scan to get the result!

    Then it would not behave as the sql like operator that you can search for '? URO % "for"europa". If, for example, a line with "western europe" is your setting ' %? % ships ' grab this line too.

    Timo

  • Hello. You will need to update Mac OS El Capitan. Currently have v.8 CS Photoshop and Lightroom 2 v.2.4. In order just to work with the new operating system, please inform for updating both.

    Currently have v.8 CS Photoshop and Lightroom 2 v.2.4. In order just to work with the new operating system, please inform for updating both.

    Hi R0w1% 40nd,

    Adobe Photoshop CS v.8 and Lightroom 2 v.2.4. are very old software and the operating system you are using is the most recent, so there may be compatibility issues that adobe has not tested these applications on newer operating systems.

    The installer for Adobe Photoshop CS v.8 and Lightroom 2 v.2.4. are no longer available.

    You can see the creative Cloud, creative cloud and rates membership plans | Adobe Creative Cloud

  • CReative cloeud works with the linux operating system?

    CReative cloeud works with the linux operating system?

    Adobe Creative Cloud

    Hello

    Unfortunately, the product Adobe Creative cloud does not work under LINUX. Please access the link as follows for the system requirements for Adobe Creative Cloud products.

    System requirements | Adobe Creative Cloud

    Thank you.

  • Photoshop CS 5.1 is compatible with the new operating system of El Capitan?

    Photoshop CS 5.1 is compatible with the new operating system of El Capitan?

    Ron, Photoshop CS5.1 should work with MAC El Capitan.

    Also, please see the following link: made CS5 Photoshop, Illustrator, InDesign works after upgrade Mac to El Captian?

  • Is it possible the reel with the variable column size?

    Hi, I'm queue to a CSV file with the following script (the SELECT real is different but similar, Oracle 10.2.0.3.0):
    SET COLSEP ';'
    SET FEEDBACK OFF
    SET LINESIZE 2000
    SET PAGESIZE 0
    SET TERMOUT OFF
    SET TRIMSPOOL ON
    SET VERIFY OFF
    
    SPOOL test.csv REPLACE
    
    SELECT 'COLUMN1', 'COLUMN2', 'COLUMN3' FROM dual UNION ALL
    SELECT 'value1', NULL, NULL FROM dual UNION ALL
    SELECT 'value2', NULL, NULL FROM dual;
    
    SPOOL OFF
    
    EXIT SUCCESS COMMIT
    Which produces the following output:
    COLUMN1;COLUMN2;COLUMN3
    value1 ;       ;
    value2 ;       ;
    Is it possible to get the following with the variable column size result
    COLUMN1;COLUMN2;COLUMN3
    value1;;
    value2;;
    I tried SET NULL "but I see no difference. Thanks in advance!

    Markus

    Hello

    SQL * Plus you button the output so that each column has a fixed length, which is exactly what you don't want.

    To get around this, concatenate all your data in a column VARCHAR2 fat with delimiters.

    For example, instead of

    SELECT    empno
    ,       ename
    ,       hiredate
    FROM       scott.emp
    ;
    

    Do something like

    SELECT    empno
    || ';' || ename
    || ';' || TO_CHAR (hiredate, 'DD-Mon-YYYY')
    FROM       scott.emp
    ;
    
  • How the coil with the variable?

    I need the motion of the coil with the variable filename.
    Concept as below:
    select HOST_NAME||'_'||INSTANCE_NAME||'_'||to_char(sysdate,'YYYYMMDD_HH24MISS')||'.txt' as Filename from V$INSTANCE;
    
    SPOOL c:\&Filename;
    When I run this script it will ask to input 'filename '.

    Please suggest.

    Kind regards
    Suradech

    There are many examples to achieve...

    http://tinyurl.com/2f7ukdr

    However, why the spool SQL * more to get an outing in the files, when you can export within PL/SQL to achieve the same and then dynamic file names making is really easy.

  • getURL() does not work with the variable

    I have a button that does two things:
    First of all, it opens a new Flash movie in a new window, using the line:

    getURL ("javascript:OpenBrWindow('/movie2.asp','MyMovie','status=0,scrollbars=1','865','690_','true')");

    It then redirects the original window to another URL by using the line:

    getURL (" http://www.mydomain.com")

    This works very well when the two lines are combined into an instance of button as follows:

    on (release) {}
    getURL ("javascript:OpenBrWindow('/movie2.asp','MyMovie','status=0,scrollbars=1','865','69_0','true')");
    getURL (" http://www.mydomain.com")
    }

    But if I set a variable to contain the first url, replace the url with the variable, the new window never opens.

    Here's the new code:
    It is located in frame 1:
    MyURL = "javascript:OpenBrWindow('/movie2.asp','MyMovie','status=0,scrollbars=1','865','690','tru_e')";

    This is the new code behind the button instance:
    on (release) {}
    getURL (myurl);
    getURL (" http://www.mydomain.com")
    }

    The second command, redirection, works, but a new window never opens to the other film.

    Any ideas?

    Thank you
    Beth

    Okay - with some trial and error I figured it. I discovered that the variables declared and populated in the timeline not copied to the button unless they are configured as global variables. Call of my variable _global.myurl did the trick.

  • XQuery insert node and assign the value based on an XPATH expression

    Hello

    I am trying to write a function that receives an XML as input parameters and return updated XML output

    -nodes are removed from the input XML code

    -a node must be inserted and the node value must be 1 or 0, based on an XPATH expression

    I discovered how to remove nodes, I discovered how to insert a new node, but I can not set the value of the conditionally inserted node an XPATH expression.

    Here's my current procedure and below a sample of one XML of entry. I use Oracle 12 c.

    CREATE OR REPLACE FUNCTION STRIP_XML
    (
      IN_XML IN SYS.XMLTYPE
    ) RETURN SYS.XMLTYPE AS
    p_result XMLType;
    BEGIN
      select
          xmlquery(
             'declare default element namespace "http://mad.evs.com/search"; (: :)
              copy $d := .
              modify (
      delete node $d//MainCategory/@logId,
               delete node $d/MainCategory/@id,
    -- a lot more of those delete node
     -- insert a node, but the value 1 is conditional
               insert node <DMZ>1</DMZ> after $d/MainCategory/SDataSection/EventDate)
              return $d'
            passing in_xml
            returning content
            ) into p_result
            from dual;
    
    
      RETURN p_result;
    END STRIP_XML;
    

    The condition for the value of is


    HASPATH (//DigitalAssets/DigitalAsset [@ available = "true" and @videoFormatId = "11"] / VideoLocations/Videorental [@typeId = "8"]) then 1 else 0


    It is complex because DigitalAssets/DigitalAsset is a collection. Here is an example of an XML to entry



    <MainCategory xmlns="http://mad.evs.com/search" id="9" logId="3349" logType="3">
      <Name>Sport</Name>
      <Serie id="163" externalId="557">
      <TitleAKA>UCL 2006/07</TitleAKA>
      <DigitalAssets available="true" som="20:28:49:05" dur="00:02:46:04" videoDurationMinutes="3">
         <DigitalAsset available="true" som="20:28:49:05" dur="00:02:46:04" videoDurationMinutes="3" videoFormatId="3">
            <VideoLocations>
                <VideoLocation id="3" path="003349MA.mxf" typeId="1" locationId="1" priority="0"/>
                <VideoLocation id="3" path="003349MA.mxf" typeId="2" locationId="1" priority="0"/>
                <VideoLocation id="3" path="003349MA.mxf" typeId="5" locationId="1" priority="0"/>
             </VideoLocations>
          </DigitalAsset>
          <DigitalAsset available="true" som="20:28:49:05" dur="00:02:46:04" videoDurationMinutes="3" videoFormatId="11">
             <VideoLocations>
                <VideoLocation id="101" path="003349MA.mpg" typeId="1" locationId="1" priority="0"/>
                <VideoLocation id="101" path="003349MA.mpg" typeId="2" locationId="1" priority="0"/>
                <VideoLocation id="101" path="003349MA.mpg" typeId="8" locationId="1" priority="0"/>
             </VideoLocations>
          </DigitalAsset>
      </DigitalAssets>
      <SDataSection xmlns="http://mad.evs.com/search">
        <EventDate>2006-08-09</EventDate>
        <LogType>3</LogType>
      </SDataSection>
    </MainCategory>
    


    In this case, because HASPATH expression could be set to true, the value of the added node must be 1.


    Any help or advice how I should fight against that would be appreciated. I have no experience with XML and XQuery, I create my function through from trial and error of the doc.


    Thanks and regards, Pierre

    Hi Pierre,.

    You can use the if-then-else statement, like this:

    Insert the node

    {

    If ($d/MainCategory/DigitalAssets/DigitalAsset[@available="true' and @videoFormatId = '11'] / VideoLocations/Videorental [@typeId = '8'])

    then 1

    0 otherwise

    }

    After $d, MainCategory, SDataSection, EventDate

    XSLT can be an alternative to the XQuery Update in this case.

  • Help with the variables!

    First of all, allow me to apologize for my screen name, I tried to 31 different names and none of them would work, pretty bad if you ask me.

    I tried a project for more than a year, who failed miserably after that I have had no help anywhere I asked, but the circumstances are bring me to take over this project.

    To expose my project, this is a great Simulator, created in Excel, and he got several very large databases in this regard. However the most simplest thing; variable, kept me from using flash to complete the project. I don't know how to explain it more simple, that I was just on the sites of more than a dozen on the first page of google that attempt to explain the use of variables and text boxes and none of them worked.

    Let me to you, my problem is that no matter what I try, I have dynamic text boxes that always return a value of NaN. I'll give my method to have an entry box return values for dynamic areas.

    My first step is to have a box of text, with the defined variable such as; rlevel and a dynamic as; text box points. I have a button that applies to text input in the dynamic area.

    It's the actionscript on the button;

    on (release) {}

    =(rlevel-1) points * 4;

    }

    It's pretty basic to start, but no matter the method I tried he always returns NaN. Another alternative, I've tried is defining the dynamic and input areas and other variables and do the math an individual variable;

    Level = x;

    points =(x-1) * 4

    on (release) {}

    bpoints = points;

    }

    Once more, this returns Nan in my box of text dynamic and undefined in my Inbox.

    I'm very fluent with the mathematical formula and I have a lot of additions to make, however as said I can't get beyond the most basic part of my project once more despite the continuation of many tutorials on the subject, that note saying to do exactly what I have made. An example of method as reference is the following;

    founded_date = 2000;

    closing_date = 2003;

    on {(press)

    founded_date closing_date = years_running;

    }

    This is no different that mine, and she always returns NaN. I did successfully a dynamic > entry text box function, just by;

    on (release) {}

    points = level

    }

    and the string level is returned correctly, he simply refuses to do so with a calculation. I'm very lost and confused and do not want to give up my plans once more. Kudo to ANYONE who can explain what is happening. I hope this time someone mind helping me.

    Chances are your first attempt to get a screen name would have stolen, but for some reason, their registration system rejects anything you enter... After some trial and error, I found that you just ignoring the message gets the name you want (unless it's really had).

    For all your troubles go with the textfield, I recommend to avoid the use of the var of the textfields and just manipulate their text property.  Name the instance textfields in the properties panel instead of specifying a var for them.  Let's say you a myPoints name and the other MonNiveau.  Your button code would look like...

    on (release) {}

    myPoints.text = String ((Number (myLevel.text)-1) * 4);

    }

    If AS2 is often very indulgent if you do not throw things like a string or a number, it just helps to ensure that things are designed to work correctly if you use them.  A textfield contains string values, so treat them as numbers, you throw as the Number(), and if the result is assigned to a textfield, casting while he is a String [] is appropriate.

    If you always go to AS3, it's not at all forgiving and textfields var element no longer exists.

  • Big problem with the variable PATH approx. need help!

    Hello
    I had a problem with the PATH environment variable. Instead of updating client Informatica & server paths PATH env variable, I created new PATH env variable and to establish client & server paths and saved. When I revisited this PATH Env variable, I was shocked to see the content of the PATH variable. I have to set back the old values like windows OS, DB etc paths paths. Could someone tell me how to make or do I have to reinstall the OS, DB, etc. Am on WIndows server 2003.

    I saved my PATH before configuring Informatica. Here's what I had:

    Path = C:\oracle\10gclient\bin; C:\OracleBI\server\Bin; C:\OracleBI\web\bin; C:\OracleBI\web\catalogmanager; C:\OracleBI\SQLAnywhere; C:\OracleBAM\ClientForBAM\bin;%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\OracleBAM\BAM; C:\Informatica\PowerCenter8.1.1\client\bin

    The critical components of the OS dependent PATH is % SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem.

  • I have HP DV6-1256tx, I want driver for my laptop compatible with the next operating system Windows 8...

    Hello. I have HP DV6-1256tx, I want drivers for my laptop compatible with the next Windows 8 operating system. How to download, can somebody help me please...

    Give me the link or something where I can download the drivers...

    Thank you

    Edriss Dave

    HP does not currently have drivers for Windows 8. You probably won't need them. Windows 8 is not coming. It's here!

    Just do the installation on a spare hard drive and bring the original HARD drive to a safe place.

    . Windows 8 has drivers built in for most laptops and desktop computers. I did have to look for a driver in two facilities. One was an HP mini and the other was a Toshiba laptop.

  • HP PSC 1100 COMPATIBILITY WITH THE WINDOWS OPERATING SYSTEM ERROR 8

    Dear team,

    My HP PSC 1100 PImprimante is not printing documents with windows system 8. I installed the original drive and the PC it accepts. but do not print.

    I tried installation wrong shhot online but found no printer PSC 1100 with the installer of windows 8 or shootre.

    kindly help me.

    Hello

    Don't forget to unplug the USB and uninstall any incompatible software from your PC, the original CD is not designed for Windows 8, any operating system is listed on the CD.

    Once the software was remove, follow these steps to get the latest version of the driver through the Microsoft Windows Update servers:

    http://support.HP.com/us-en/document/c03460648

    You can also try following the instructions in the following tool and check if this is useful:

    http://h10025.www1.HP.com/ewfrf/wc/softwareDownloadIndex?softwareitem=MP-122330-1&cc=us&DLC=en&LC=en&OS=4131&product=90787&sw_lang=

    Kind regards

    Shlomi

Maybe you are looking for