Oracle text & xpath / binding variables in php

Hello,
I am using Oracle 10g XE.
Here is the php code for which I have a problem :
$stmt=oci_parse($con, "SELECT NRSS FROM XNRSS WHERE CONTAINS(NRSS, '(HASPATH(/nrss/channel/item/identifier[@assetId=:ASSETID]))')>0");
oci_bind_by_name($stmt, ":ASSETID", $i)) echo "erreur";
This code does not work and I think the reason is that I don't use correctly the variable :ASSETID inside the xpath '(HASPATH(/nrss/channel/item/identifier[@assetId=:ASSETID]))'
How should I use the variable ?
Thanks for your help
Eve

HASPATH and INPATH are not part of XML DB. They offer XPATH like search capabilities based on text indexes.
The XDB way would be
existsNode(NRSS, '/nrss/channel/item/identifier[@assetId=' || :ASSETID || '])')>0";

Similar Messages

  • Oracle.xdo11g.xpath.XPathException: Variable not defined

    Hello,
    I got two pivot tables in the RTF Word PlugIn, when I take the second one out, the HTLM output shows fine, when I out the second one in, I get the error "oracle.xdo11g.xpath.XPathException: Variable not defined". I used the wizard to create the tables.
    If I upload the layout and try to execute the report online, I get this error" oracle.xdo.XDOException: java.lang.reflect.InvocationTargetException"
    anyone an Idea how I can add two pivot tables to my template without causing xml errors?

    I got those two in a WORD table and as soon as I put the second one in the table (a word layout table by putting my pivot table in it) the error comes.

  • How to pass Text value/bind variable in Export CSV (FLOW_EXCEL_OUTPUT)

    I am using the following in Report Definition -> Header
    <tr>
    <td>
    Download
    </td>
    </tr>
    This will give me the standard output in Excel and it will contain columns only specified in SQL query.
    I want to import all other bind variables, which I am using in the report (these are not the columns in SQL query). These variables I want to display only once at the top of the Excel.
    thanks,
    deepak

    You can create a csv file manually. See this posting:
    http://spendolini.blogspot.com/2006/04/custom-export-to-csv.html
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • HELP: Bind Variable does't work in SQL statement

    I am trying to connect a text item bind variable into the where
    clause of an SQL statement. Specifically into an INSERT
    statement and SELECT statement. It gives me an message box
    error, saying it is unable to insert. There is no Oracle error
    number associated with it. Is this a bug? Has this happened to
    anyone else. PLEASE HELP! URGENT!
    null

    I assume this is a forms problem. You need to check out the
    dbms_error_code and dbms_error_text to get your oracle error.
    You can trap and report these types of errors using an on-error
    trigger. Also, if you are using the default menu then check
    out help -> display error immediately after the form reports
    unable to insert ...... This should give you enough information
    to solve your problem, or at least point you in the right
    direction.
    Daniel Jensen (guest) wrote:
    : I am trying to connect a text item bind variable into the where
    : clause of an SQL statement. Specifically into an INSERT
    : statement and SELECT statement. It gives me an message box
    : error, saying it is unable to insert. There is no Oracle error
    : number associated with it. Is this a bug? Has this happened to
    : anyone else. PLEASE HELP! URGENT!
    null

  • Can Oracle convert literals to bind variables?

    Good morning everyone.
    I have a procedure similar to this in our database:
        FUNCTION Get_Tag_Element_Id_For_Set(Element_Attr_Id_Table_In   in    ATTRIBUTE_TABLE_ID_TAB) RETURN NUMBER IS
          v_Select_Statement                    VARCHAR2(32767);
          v_Element_Id                             ELEMENT.Element_Id%TYPE;
        BEGIN
          FOR I IN 1..Element_Attr_Id_Table_In.COUNT LOOP
            IF v_Select_Statement IS NULL THEN
              v_Select_Statement := 'SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Element_Attribute_Id = ' || Element_Attr_Id_Tab_In(i);
            ELSE
              v_Select_Statement := v_Select_Statement || ' intersect ' ||
                                    'SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Element_Attribute_Id = ' || Element_Attr_Id_Table_In(i);
            END IF;
          END LOOP;
          EXECUTE IMMEDIATE v_Select_Statement INTO v_Element_id;
          RETURN v_Element_Id;
        END;What this does is to create a query similar to this:
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 1 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 2 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 3 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 4 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 5;
    I am using Dynamic SQL because the number of intersect pieces can vary from 1 to 15 and in the future it can grow.
    The problem that I have is that because the literals are part of the string, the query is being hard parsed every single time. In our production environment this means 100s of thousands of times per day which according to our DBA has added 15% plus to our average load. I know that I can come up with a rewrite to avoid this, but I was wondering if there is a parameter I can set at the session or at the database level where the database itself can convert this kind of query into one with bind variables.
    Thanks,
    Tom
    Edited by: Thomas Morgan on May 3, 2013 8:21 PM

    Thomas Morgan wrote:
    Basically I have an XML document.
    The document has ELEMENTS.
    ELEMENTS can have attributes.
    There is a many to many relationship between ELEMENT and ATTRIBUTES so I have a XREF table to represent this relationship.
    When I receive a new document, I need to determine if a group of ATTRIBUTES already exist together in the XREF table so I have to find their common ELEMENT_ID or NULL in which case I would create a new ELEMENT and associate the new set of attributes to the new ELEMENT.
    Since the number of attributes can vary from 1 to around 15 for now, I had to dynamically build the query that find the common ID(intersect) if it exists.
    Here is some DDL and inserts:
    CREATE TABLE ELEMENT(ELEMENT_ID NUMBER NOT NULL);
    CREATE TABLE ELEMENT_ELEMENT_ATTRIBUTE_XREF(Element_Id NUMBER NOT NULL, Element_Attribute_Id NUMBER NOT NULL);
    ALTER TABLE ELEMENT_ELEMENT_ATTRIBUTE_XREF ADD CONSTRAINT ELEMENT_ATTR_MANY_2_MANY_PK PRIMARY KEY(Element_Id, Element_Attribute_Id);
    ALTER TABLE ELEMENT ADD CONSTRAINT ELEMENT_PK PRIMARY KEY(Element_Id);
    INSERT INTO ELEMENT VALUES(1);
    INSERT INTO ELEMENT VALUES(2);
    INSERT INTO ELEMENT VALUES(3);
    INSERT INTO ELEMENT VALUES(4);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(1, 1);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(1, 2);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(2, 1);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 1);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 3);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 4);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 5);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(4, 6);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(4, 7);
    So for instance if I passed an array (Attribute ID Tab) containing ELEMENT_ATTRIBUTE_ID list 6 and 7 I would get 4 as the answer.
    Hope this helps,
    Thanks,
    TomAwesome, thanks!
    I'm not sure this works 100% for what you need, but I thought I'd give it a shot. I've used a built in array (sys.odcinumberlist) that you should have access to on your installation (assuming you have a relatively recent version of Oracle).
    I left out the part where you would loop through the array you are currently passing in to your procedure to build up this new array that you can use in a SQL statement.
    Cheers,
    create or replace procedure maybe_this
       in_list           sys.odcinumberlist
    is
       l_commonality     number;
    begin
       begin
          select
             distinct
                xref.element_id
          into
             l_commonality
          from
                table(cast(in_list as sys.odcinumberlist))  list
            ,  element_element_attribute_xref   xref
          where
             xref.element_attribute_id = list.column_value;
          dbms_output.put_line('match on element_id = ' || l_commonality);
       exception
          when too_many_rows or no_data_found
          then
             dbms_output.put_line('no match');
       end;
    end;
    ME_TUBBZ?exec maybe_this(sys.odcinumberlist(1,2));
    no match
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    ME_TUBBZ?exec maybe_this(sys.odcinumberlist(6,7));
    match on element_id = 4
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01

  • How to pass a value to a bind variable in a query report in oracle apex

    Hi Guys,
    I have requirement to send weekly reports via email to some users. The users should receive their own records in the report. The user details is stored in a table. What I am planning to do is to create a report query in oracle apex to generate the report and then run a function/procedure via a scheduler to email the report to respective users. Now my query is ............. is it possible to pass a value (user name) to the report query to pull records of only that user? I know we can have bind variables in the report query but I have no idea how to pass a value for bind variables from a function/procedure.
    Can anyone help me on this issue or suggest a better approach?
    Thanks,
    San

    You need to use dynamic sql
    But please keep in mind that since you're using Oracle you may be better off posting this in some Oracle forums
    This forum is specifically for SQL Server
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Oracle bind variable

    Can i use an item which type is image as bind variable in the insert statement?
    When i pass image item of oracle form as a bind variable in the insert statement then "Bad bind variable error" occurs.
    Please help me.
    - ashraf

    Hello,
    No, you cannot. If the image item points to a database BLOB column, Forms will store the image in this column at commit time.
    Francois

  • Oracle BI Publisher - Passing multiple wildcard search to a bind variable

    Hi,
    Please help me in resolving the below mentioned issue:
    I have developed a report in oracle BI Publisher with a SQL query.
    While scheduling the report to run I used to pass mutilple parameters like CGAMSVC08,RLCSVC51
    If the pass the parameter with wildcard search like C% it works.
    When I pass two or more parameter values with wildcard search like C%,R% its not working.
    Could you please let me know how should I give the bind variable in the SQL query. Currently I'm paramater like the one shown below for passing multiple paramaters:
    Where (',' || :PRMRETRID || ',' like '%,'||RL.RETROFIT_ID|| ',%')
    Edited by: user1101445 on May 23, 2012 2:02 AM

    HI Tyler.
    Well, here's the latest.
    I found this little gem in the BIEE 10.1.3.3.3 Release Notes Documentation...
    This issue applies to Versions 10.1.3.3, 10.1.3.3.1, 10.1.3.3.2, and 10.1.3.3.3.
    Reports that use the BI Publisher data template as the data model may fail with the
    following error: "Data not defined."
    This error will occur if you defined a parameter in your data template but you do not
    pass a value to it via the user interface. If you do not specify this parameter in the "Parameters" section of the report definition that you created using the BI Publisher Edit Report interface, then you will receive the error.
    To work around this issue, either define the parameter in the Edit Report interface or remove the parameter from the data template.
    That bit is now working.
    Having set this up and using your guide it works if my SOAP parameters declaration passes a single value like this...
    <parameterNameValues>
    <item>
    <name>P_INVOICE_ID</name>
    <multiValuesAllowed>true</multiValuesAllowed>
    <values>
    <item>16641</item>
    </values>
    </item>
    </parameterNameValues>
    But if I try and pass two or more like this...
    <parameterNameValues>
    <item>
    <name>P_INVOICE_ID</name>
    <multiValuesAllowed>true</multiValuesAllowed>
    <values>
    <item>16641,18421</item>
    </values>
    </item>
    </parameterNameValues>
    BIP states "java.sql.SQLException: ORA-01722: invalid number"
    My SQL where clause is..
    <sqlStatement name="Q1">
    <![CDATA[select * from vw_invoice_summary
                   where invoice_summary_id IN (:P_INVOICE_ID)]]>
    </sqlStatement>
    And the BIP error records the parameter value as P_INVOICE_ID 16641,18421 (which are legit invoice IDs)
    In summary, works if I pass one invoice ID, fails if I pass two or more.
    Any ideas? Or do you reckon this is now a post for the BIP forum?
    Kind regards.
    Simon

  • Using bind variables in Oracle SQL developer

    Hi all,
    i am using Oracle SQL developer. i want to use the bind variable in my sql.
    variable myid number :=1;
    select * from mds_3618_request where id = :myid;
    but i am getting the below error.
    Error starting at line 2 in command:
    select * from mds_3618_request where id = :myid
    Error report:
    SQL Error: Missing IN or OUT parameter at index:: 1
    Does Oracle SQL developer support bind variables in the SQL statements?
    thanks in Advance
    Vali Shaik

    You are probable going to get a quicker answer on this forum : SQL Developer
    -- Andy

  • Same Oracle Bind Variable Name in 2 VOs not permitted?

    Hi,
    JDeveloper Studio Edition Version 10.1.3.3.0.4157
    I have 2 different Entity based VOs, those VO's use similar Entities but their WHERE is clause is different, one VO doesn't extend the other one.
    I have used Oracle (first time use for me) named bind type variables with identical names in both where clause.
    When I try to define a bind variable ex. TariffIdParam in the second VO the wizard shows me an error:
    Variable name is a reserved word or a variable or attribute of the given name already exists ...
    Does that mean that an Oracle Bind Variable Name must me unique in the whole application?
    Partial where clause:
    VO1
    DeliveryDetailGroup.DELIVERY_TARIFF_ID = :TariffIdParam
    VO2
    DeliveryDetailGroup.DELIVERY_TARIFF_ID = :TariffIdParam
    Thanks
    Fred

    I created the second VO by using "File save as".
    To resolve the problem in the new xml file I replaced the references to the other VO.
    Regards
    Fred

  • Oracle ODBC Driver adds bind variable when browsing whole table in Access

    Hi, we are looking for some reasons why we may see this behavior in the Oracle ODBC driver (10gR2 and 11g) when using Microsoft Access (2003 or 2007)...
    1) Link a table from the Oracle database.
    2) Double-click the newly linked table to "browse" it.
    Oracle sends the following statement to the server:
    {color:#0000ff}select * from linked_table where primary_key = :b1{color}
    It then proceeds to read the entire table.
    If I tell Microsoft Access that there is no primary key, the query gets sent as:
    {color:#0000ff}select * from linked_table{color}
    And the query comes back as soon as the first 100 or so rows are fetched which is quite quickly.
    ADDITIONAL NOTES:
    1) If the table has a primary key or unique constraint, Microsoft Access automatically assigns that as the primary key.
    2) We can stop the behavior in #1 if we wrap a view around it which prevents Access from discovering that information and then it prompts for a primary key definition.
    3) If we use the Microsoft ODBC driver, the bind variable is not added no matter what the primary key defintiion is.
    We're stumped and are looking for solutions and/or workarounds without having to wrap all of our tables in views to hide the fact that there is a primary key.
    Thanks,
    Steve

    Thanks for the response, Greg.
    The specific question I am seeking an answer for (sorry it was not clear on my first message) is this:
    Why does the Oracle driver add the bind variable to the query only when the primary key is defined?
    The Microsoft ODBC driver does not add the bind variable with or without a primary key defined.
    You asked how I traced this statement and what I am doing is launching the query in Access and then using TOAD to view the V$SESSION and V$SQL_TEXT_WITH_NEWLINES views. All I do is change the driver. This is just for a simple browse table (double-click on the table) which should send
    select * from table
    However, whenever I use the Oracle ODBC driver (with a primary key defined) it sends
    select * from table where primary_key = :1
    If I remove the primary key on the table definition, the Oracle driver sends
    select * from table
    What is it about the primary key that could cause that behavior?
    I don't think it is the MDAC/Jet level because this is the conversion to the native SQL statement not the Jet version. I know the Oracle driver has to do that part because you have those workaround options like don't add the RULE hint, etc. That's not part of the Jet engine.
    Hope that helps. I'm just baffled over this one and wish I knew where to go next.

  • Bind Variable in Oracle Standard Report

    hi experts
    i'm using oracle 10g r2 , working on oracle erp r12 ebs
    i have a standard report where i add some bind variables but the code is too complex and most of the data retrieved from formula column define in oracle standard report . how to add bind variable in this scenrio??

    I think you want to post in the appropriate EBS sub forum. This one is specifically to do with SQL and PL/SQL, so not everyone here will have knowledge of EBS.

  • Bind variable with search parameter in Oracle BI Publisher 10

    Search list for a search parameter in Oracle BI EE works fine when the query doesn't contain a bind variable (parameter identifier). But when a bind variable is introduced in the constraint of search list query, it keeps on searching endlessly. For example,
    -- this doesn't work
    select col1
    from table
    where table.col2 = :I_param_bind_var
    -- this works
    select col1
    from table
    where table.col2 = 'xyz'
    Using such bind variable in the list of values for menu parameters works fine. Is it an issue regarding publisher or am I missing something?
    Edited by: 933296 on Aug 21, 2012 1:38 AM

    <?param@begin:Show_Location;'Yes';'string';'Yes,No'?>
    it will give the Parameter Show_Loactaion with drop down Yes and No.
    and to display <?$Show_Location?>
    <?param@begin:dept;'PAY'?>
    <?$dept?>

  • Use of bind variables with the oracle db - to improve library cache perform

    Dear Friends,
    We are using oracle 9.0.1.1.1 db server - the performance of the db was pathetic and upon investigation it was revealed that the library cache was over loaded with sql hard parses generated by not using bind variables. We are using vb as a front end with oracle and our connection object in vb is created using ole db for oracle provided by oracle (installed from oracle client custom - programmer option).
    I would appreciate if any body can tell how can we use bind variables in vb to connect to oracle such that the hard parses can be changed into soft parses.
    Your effort to bring some peace in my life is worth comendable and I would be very obliged for your time and help.
    Thanks a lot.
    Bye
    Take care.
    qj

    Generally, you would use bind variables by changing statements that are written like this
    select * from emp where empno=6678 and ename='Jones'
    so that they're written like
    select * from emp where empno=? and ename=?
    How you then bind these question marks to the particular values you want depends on the API you're using (ADO? OLE DB directly?, etc). If you have a support contract, there are plenty of examples for any API on metalink.oracle.com
    Justin

  • Possible for Oracle to consider constraints when using bind variable?

    Consider the following table with a check constraint listing the possible values of the column
    create table TEST_TABLE(
    my_column varchar2(10));
    insert into TEST_TABLE select 'VALUE1' from dba_objects;
    alter table TEST_TABLE
    add constraint TEST_TABLE_CHK1
    check (my_column in ('VALUE1', 'VALUE2'));
    begin dbms_stats.gather_table_stats(ownname=>user,tabname=>'TEST_TABLE');END;Let's see the number of logical I/O's needed for the following SQL statements.
    (The value was obtained by the delta ofselect m.value from v$mystat m, v$statname n
    where name='session logical reads' and m.statistic#=n.statistic#)
    If string lateral is used:
    declare
       n number;
    begin
      select count(*) into n from test_table where my_column='VALUE1';
    end;
    Consistent Gets: 21
    declare
       n number;
    begin
      select count(*) into n from test_table where my_column='VALUE2';
    end;
    Consistent Gets: 21
    declare
       n number;
    begin
      select count(*) into n from test_table where my_column='VALUE3';
    end;
    Consistent Gets: 0Oracle can eliminate the table if it knows the queried value can't satisfy the constraint. Good.
    (Actually, the execution plan for the last query included the 'FILTER' operation.)
    However, if bind variable is used:
    declare
       n number;
       x varchar2(10);
    begin
      x := 'VALUE1';
      select count(*) into n from test_table where my_column=x;
    end;
    Consistent Gets: 21
    declare
       n number;
       x varchar2(10);
    begin
      x := 'VALUE3';
      select count(*) into n from test_table where my_column=x;
    end;
    Consistent Gets: 21Oracle can't eliminate the table using the constraint. I can understand that because bind variables are used, Oracle can't directly eliminate the table when generating the execution plan. However, is it possible to eliminate the table, or at least employ some shortcut in runtime? If not, will this be a performance loss compared with using values laterals when check constraint exists?
    (And is it possible to use autotrace on PL/SQL block in sqlplus?)
    Oracle:
         10.2.0.4 SE
         11.2.0.2 SE
    OS:
         RHEL5

    However, is it possible to eliminate the table, or at least employ some shortcut in runtime? I can't see how to do this. Oracle has a sqltext that has an embedded bind variable in it. And for this sqltext it has an execution plan in the shared pool that will be used irrespective of the actual bound values at runtime.
    Maybe in 11G, with adaptive cursor sharing / plan bind awareness, Oracle might be smart enough to introduce a second execution plan for the VALUE3 case.
    If not, will this be a performance loss compared with using values laterals when check constraint exists?Only if you submit the dumb query and search for records with VALUE3... Normally your application code would not hold/generate these queries.
    Will it?
    For columns whose values are bound by a CHECK constraint, one might even consider to never use bind variables, since very likely you will have few versions of queries that use these columns.
    Not?
    Edited by: Toon Koppelaars on Jun 22, 2011 1:20 PM

Maybe you are looking for

  • Photoshop CC 2014 having a problem with display driver then crashes computer

    Since the Photoshop update in October most of the time when I open Photoshop CC 2014, either my computer crashes with the driver state power failure or the program is able to boot and provide an error message involving a problem with the display driv

  • Alternate and span modes do not work as documented

    Odd Aperture behaviour of Secondary Monitor. According to Apple: Alternate: Displays the currently selected photo in the Secondary Viewer. The Secondary Viewer shows only one photo, even when you have the Main Viewer set to display multiple photos. N

  • Question re current 50% off movie packages promotion

    quick question...at the current time, they are offering 50% off most of the combo premium movie packages (HBO, Cinemax, Starz, showtime, encore, etc.) it says half off the refular price for 12 months, then you pay the regular price starting month 13.

  • Mail not working/stops

    When I open my e-mail the arrow forms a rainbow colored bal/circle and keeps turning. It is not possible to click anything in the Mail program. Others programs are in order and can be used, but Mail cannot be used. I have deleted and re-installed Mai

  • Need help connecting an iPod Touch to WRT54G

    I have a WRT54G version 6 router.  My laptop finds the network and connects easily.  My new iPod Touch finds the network, I enter the password (I'm using WPA), it looks like it is connected, but all the settings are blank.  I have used the iPod at a