Oracle 10g trigger to pass variable to xmltype.existsnode() function

Hi all,
Could anyone please help me on this? It is kind of urgent.
I created a trigger below, it compiled successfully, but when I tried to insert a xml document into oracle 10g db, I got error message says:
550- Error Response
ORA-00604: error occurred at recursive SQL level 1
ORA-30625: method dispatch on NULL SELF argument is disallowed
ORA-06512: at "CONTENTDB.VALIDATE_LINK", line 11
ORA-04088: error during execution of trigger 'CONTENTDB.VALIDATE_LINK'
550 End Error Response
My trigger is:
CREATE OR REPLACE TRIGGER VALIDATE_LINK
BEFORE insert on TABLE_LINK
FOR each row
DECLARE
v_key VARCHAR2(1000);
v_count NUMBER(5);
xmldata XMLType;
begin
xmldata := :new.sys_nc_rowinfo$;
IF xmldata.existsnode('/link/key') = 1 THEN
v_key := xmldata.extract('/link/@key').getStringVal();
select count(*) into v_count from table_link WHERE (existsNode(object_value,'/link[key=v_key]') = 1 )
and (existsNode(object_value,'/link/publishingElements[TestingFlag="true"]') = 1);
if (v_count >= 1) then
raise_application_error (-20001, 'TestingFlag can only have one true value.');
end if;
end if;
end;
I have questions regarding above trigger:
1) it seems extract() doesn't work in statement below: v_key := xmldata.extract('/link/@key').getStringVal();
2) can I pass a variable v_key into xmltype.existsnode() function? if yes, what is the right format to do so?
Thanks a lot.
Honson

Hi Mark,
Thanks for your comments, I have added checking for xmltype object is not null logic. and my initial problem was fixed, the only last problem I am having now is xmltype.extract().
CREATE OR REPLACE TRIGGER VALIDATE_LINK
BEFORE insert on table_LINK
FOR each row
DECLARE
v_key VARCHAR2(4000);
v_count NUMBER(5);
xmldata XMLType;
v_tmp VARCHAR2(4000);
begin
xmldata := :new.sys_nc_rowinfo$;
if (xmldata is not null) then
IF xmldata.existsnode('/link/key') = 1 THEN
v_key := xmldata.extract('/link/key').getStringVal();
v_tmp := '/link[key=' || v_key || ']';
select count(*) into v_count from cibc_link WHERE (existsNode(object_value,v_tmp) = 1 )
and (existsNode(object_value,'/link/publishingElements[TestingFlag="true"]') = 1);
if (v_count >= 1) then
raise_application_error (-20001, 'TestingFlag can only have one true value.');
end if;
end if;
end if;
end;
I am expecting this statement:
v_key := xmldata.extract('/link/key').getStringVal();
return v_key := content.link.viewPrintableVISACreditCard
but now it always returns like this:
v_key := <key>content.link.viewPrintableVISACreditCard</key>
I don't want the xml tag <key></key> returned by extract().getStringVal() function.
Could you or anyone please help?
Thanks.
Honson

Similar Messages

  • Can I call host file ( Unix Shell script ) from Oracle 10g trigger

    Hi,
    I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
    thanks & regards
    parag

    user12009546 wrote:
    Hi,
    I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
    thanks & regards
    paragIf you are in 10g, you can simple call shell script from DBMS_SCHEDULER:
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'TEST_SCRIPT',
    job_type => 'EXECUTABLE',
    job_action => 'PATH_OF_YOUR_SCRIPT',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=MINUTELY; INTERVAL=1',
    enabled => TRUE,
    comments => 'Shell script from Oracle'
    END;
    /

  • How can I pass variable to eventdriven startElement() function?

    I am new to java and SAX. Could anybody tell me how to pass variable to eventdriven startElement function? I tried the following code but didn't work.
    public class ReadXmlSax extends DefaultHandler
    String elementName;
    String requestName;
    Vector v = new Vector();
    public Enumeration getAttribute(String sFileName, String sTagName, String sAttrName)
         Enumeration e;
         elementName=sTagName;
    requestName=sAttrName;
    File f = new File(sFileName);
    // Use an instance of ourselves as the SAX event handler
    DefaultHandler handler = new ReadXmlSax();
    // Use the default (non-validating) parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
    // Parse the input
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse(f, handler);
    } catch (Throwable t) {
    t.printStackTrace();
    e = v.elements();
    return(e);
    //===========================================================
    // SAX DocumentHandler methods
    //===========================================================
    public void startDocument()
    throws SAXException
    public void endDocument()
    throws SAXException
    public void startElement(String namespaceURI,
    String sName, // simple name
    String qName, // qualified name
    Attributes attrs)
    throws SAXException
              //System.out.println(elementName);
              if (qName.equals(elementName))
                   String serverName = attrs.getValue("",requestName);
                   v.addElement(serverName);
    }

    I attached the main call the ReadXmlSax class. I added the
    "system.out.println(elementName);" in the function getAttribute and startElement as well. I got printing out "name" for elementName from function getAttribute but got others printing out "null" for elementName from function startElement. Any suggestions? thanks
    import java.io.*;
    import java.util.*;
    import ReadXmlSax;
    public class ReadElement
         public static void main(String argv[])
              ReadXmlSax r = new ReadXmlSax();
              Enumeration e = r.getAttribute("dre.xml","server","name");
              try{
                   while (e.hasMoreElements()) {
                   System.out.println((String)e.nextElement());}
              }catch(Throwable t){
                   t.printStackTrace();
    <strong>test</strong>

  • Oracle 10g  OCA  exams pass question

    Please does anyone know any website where oracle 10g pass exam are posted for free or if anyone has got some pass exams could you post them please.
    Thanks in advance

    You only wanted to pass OCA certifiation by getting dump of questions.
    It would be more worthy that you make practice and once you are confident with the subject, then appear for exam, dont simply depend on dummy question to pass OCA. Believe me, this is worthless.
    Hint: search at yahoo groups for ocpfree.
    Jaffar

  • Oracle 10g EE - Spatial Index, C Interfacing & Custom C Functions

    Hi everyone,
    I'm doing a research project concerning indexing and I'd like to do some testing using Oracle DB.
    My questions are:
    1) I've noticed here (http://www.oracle.com/database/product_editions.html) that Spatial is not included in EE, is this just the complex spatial functions? Is the R-tree (or some other spatial index) still available for simple queries?
    2) I've read that Pro*C is the simplest way to use Oracle from C, however Pro*C does not exist in 10g, only OCI. Is there a simpler way to use Oracle from C other than OCI?
    3) How do I go about creating custom functions which are written in C (for speed reasons)?
    If not all of these are possible in EE, which version of Oracle would I need?
    Thanks heaps,
    Martin.

    From the binaries point of view Spatial is included in the Enterprise Edition, the fact that it says it is an option means you have to buy a license additional from the enterprise Edition license to be able to use it.
    You can find several demos based on MapViewer which are written in java, so IMO Pro*C is not the best suitable way to start working with Spatial Data, I suggest you to consider Java instead.
    ~ Madrid
    http://hrivera99.blogspot.com/

  • Pass variables in symbols to function

    I'd appreciate some quick help on how to pass a variable I set in a symbol to a function in the compositionReady code. 
    Right now for each button in a menu I have the code: 
    case 'item1':
    sym.getComposition().getStage().clearStage();  //this is a function in compositionReady
    sym.getComposition().getStage().getSymbol("object_details").$("item1").show();
    sym.getComposition().getStage().getSymbol("object_details").getSymbol("item1").play(0);
    break;
    here is the code in compositionReady:
    sym.clearStage = function() {
    sym.getComposition().getStage().$("grid").hide();
    sym.getComposition().getStage().$("othermaps").hide();
    Is there a way to pass the value 'item1' to the function so that I'm not writing the same code over and over? 
    Thus:
    case 'item1':
    sym.getComposition().getStage().clearStage("item1");
    break;
    and in compositionReady:
    sym.clearStage = function(itemValue) {
    sym.getComposition().getStage().$("grid").hide();
    sym.getComposition().getStage().$("othermaps").hide();
    sym.getComposition().getStage().getSymbol("object_details").$(itemValue).show();
    sym.getComposition().getStage().getSymbol("object_details").getSymbol(itemValue).play(0);
    I know my syntax is totally wrong.  Please help me to see this.  Thank you. 

    this way you can make your codes much shorter :
    case 'item1':
    x.clearStage("item1");
    break;
    //and in compositionReady:
    Stage = sym.getComposition().getStage()
    x = {
    clearStage:function(z){
    Stage.$("grid").hide();
    Stage.$("othermaps").hide();
    Stage.getSymbol("object_details").$(z).show();
    Stage.getSymbol("object_details").getSymbol(z).play(0);
    regards
    Zaxist

  • Retrieval of xmltype data from oracle 10g to java

    Hi
    Right now we are facing an issue on xmltype retrieval from oracle 10g to java.
    I used xmltype column.getClobval() to get the xml content, but unable to do the parse to get the xml data.
    So i tried getStringval(), getting the xml content as string format and here in this case also, i didn't get document object.
    Here is the code snippet:
    String sql = "SELECT node_id,node_desc,parent_node_id,e.report_xml.getStringval() FROM TABLE_STRUCTURE e";
    st = con.createStatement();
    rs = st.executeQuery(sql);
    while (rs.next()) {
    Object value[] = { rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4) };
    list.add(value);
    DOMParser parser = new DOMParser();
    parser.parse(rs.getString(4));
    doc = (Document) parser.getDocument();
    System.out.println(": DOM = " + doc.getClass().getName());
    Please do guide in this scenario.
    Thanks in advance.
    Sirisha

    Please see below link
    http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10790/xdb11jav.htm

  • How set the oracle 10g path in xp environment variables

    am new to java.
    am practicing the jdbc, but while running the program it compied, but it does not execute the program.
    it says
    package oracle.jdbc.driver does not exist
    DriverManager.getregister(new oracle.jdbc.driver.OracleDriver());
    then how to set the path of oracle 10g in xp environment variables.
    plz send any body the answer.
    its urgent.

    tster wrote:
    sunnyyld wrote:
    then how to set the path of oracle 10g in xp environment variables.right click on my computer -> properties -> advanced -> environment variables.
    Not that it would work, as the kid doesn't seem to understand what exactly it's doing wrong.
    Had it worked through some basic tutorials it would have understood so I'm not going to tell it, just tell it to work through some basic tutorials.

  • Oracle 10g Pivot query

    Hi,
    I want to create a view. Sales amounts, countries and products will be showed in this view.
    Report result will be like below:
    Products
    Countries Sales_Amount
    TV Ipad Iphone Netbook Notebook EbookReader
    England 1000 1200 1400 3000 5000 200
    Germany 800 1000 1300 2800 6000 400
    France 1100 1100 1500 2400 3000 500
    Number of products are not limited. New prodcuts can be added by the time.
    Customer is using Oracle 10g. So I can not use pivot function which cames with Oracle 11g.
    If the number of products is limited, I can write sql by decode operators.
    But I can not find how to implement pivot function in Oracle 10g with unlimited column values.
    Do you have any comment?
    Thanks,Regards

    From the SQL and PL/SQL FAQ:
    "This is not easily possible as the number of columns returned by an SQL must be known before any data is fetched, it would have to be done dynamically.
    See these threads:
    Franks pivoting, static and dynamic
    Dynamic Columns Pipelined"
    SQL and PL/SQL FAQ

  • Query Regarding Rich Text Editor in Oracle 10G

    Hello.
    Can anyone let me know is their any privilege in Oracle 10g that we Incorporate the Rich Text Editor functionality. Currently we are working on Laboratory / Radiology Template based Reports in which they are requesting their should be option through which we can simply Cut and Paste our organized TEXT(REPORT) which are formatted in MS WORD with Bold,Underline and in Bullets format, it should simply paste in Editor and we can view a Template based report with formatted REPORT.
    We are using Oracle 10G and it's Applet based Application. Any clue how can we Accomplish this? Any Suitable Suggestion?
    Thanks

    Sorry, I referred this already.. This also returns the HTML text. But i don't want the HTML text. I want Normal Text what i enter in the Editor. But as of now all the editors are returning HTML text. So in the front end also it is showing HTML text only.
    I entered the text in Editor as
    System Defaulted Note
    Quote entered
    But editor returns as below and the same way it is showing in the Front end application instead of above text.
    <html>
    <head>
    </head>
    <body>
    System Defaulted Note
    <p>
    Quote entered
    </p>
    </body>
    </html>

  • Passing variables to a procedure inside a database trigger

    Hi,   I am new to oracle Forms . I am having a table in database . For that table i had written a database trigger which will fire after insert or update . I am using a procedure inside the Trigger . I want to pass arguments to the procedure which is being called in the trigger . The variables which i want to pass to the procedure are one is a primary key and the other is a normal cloumn which are in the same table for which the trigger is written. Can anybody help me regarding this.?

    > But when i m calling it with forms i m getting an error
    You cannot call a database trigger from forms. A trigger is part of the table, e.g.:
    create trigger my_trigger
    before insert or update or delete on my_table
    for each row

  • URGENT !!!!!!!!!How to pass parameters to Forms from Reports(Oracle 10g)

    Hai
    I can call a form named "ABC" from one Report, using "hyperlink" . The URL is
    http://....../forms90/f90servlet?form=c:/ABC&userid=a/a@a
    Now I want to pass 2 parameters (that are received in that report) to the form ABC.
    I am using Oracle 10g.
    What to do?
    Please reply soon.
    I am eagerly waiting for the solution.
    Please Help.
    Bye

    Hai
    Thank u for the reply.
    Is it possible to pass the variable instead of values.
    My report receives 2 parameters named p1 & p2. Actually I want to pass that parameters to the form from the report.
    I have tried as You said.
    //http/.........&otherparams=param1=:p1+param2=:p2
    Then the form receives the ":p1" as the value, it does not take the value of that variable p1.
    Please Reply Soon.
    Bye...

  • Oracle 10g express edition ..ampersand substitution variable

    when i enter the ampersand substitution variable and run the script in the oracle 10g express edition it is giving me the error of (ORA-01008: not all variables bound)...can someone please indicate what the problem is..
    thank you

    i am running the script in the browser but when i run it it does not give me the possibility to enter the value and that error which i mentioned before comes instantly
    reuben

  • Need Urgent Help with trigger in Oracle 10g

    Hello frd,
    I am working on my DBMS Project in VB 6.0 that is Tollbooth management system
    i have to insert one trigger for my project so i had decided to insert time trigger.
    I have total 3 table UserLogin, Vehice and Vehicle_Data
    the 3rd table Vehicle data contain the following fields
    Vehicle_Type, Vehicle_No, Tax_Time, Source, Destination and Tax
    Now i had done coding for tax when you select Vehicle Type, Source and Destination the Tax Field will automatically fillup and all the data will Saved in Oracle table but now my problem is that i want to create trigger for Tax_Time column When any new data inserted current time will stored in that column
    I had create one but it gives error
    create trigger time after insert on vehicle_Data
    for each row
    begin
    insert into Vehicle_Data(Tax_Time) values(to_char(sysdate, 'HH:MI:SSAM DD_MON_YYYY'));
    end;
    Note: I am Using VB 6.0 and Oracle 10g Express Edition

    I had create one but it gives errorWelcome to the forum and many many thanks for not posting the full error message, that is really helpful, since we're all a 100% sure what's going on now (yes, that was ironic ;) ).
    Let me guess: a mutating table error?
    Read:
    http://www.oracle-base.com/articles/9i/MutatingTableExceptions.php
    http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551198119097816936
    But before that, actually you should read:
    http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html

  • I create trigger but not display massage after insert in oracle 10g

    I create trigger but not display massage after insert in oracle 10g
    **CREATE OR REPLACE TRIGGER TableName**
    **AFTER INSERT OR DELETE OR UPDATE ON test**
    **BEGIN**
    **if inserting then**
    **dbms_output.put('Message');**
    **end if;**
    **END;**

    What user interface are you using?
    If the tool doesn't support the SQL*Plus syntax (set serveroutput on), it probably has an option somewhere to enable DBMS Output. Not even knowing what tool you're using, it's impossible for us to guess where that option might be configured.
    As others have suggested, using DBMS Output to test code is less than ideal because you're dependent on the application you're using to display it to you and not every application can or will do that. If you want to use DBMS_Output, you may need to switch to a different GUI (SQL Developer or SQL*Plus are both free utilities from Oracle). Otherwise, you'd probably be better off having the trigger do something that you can subsequently query (i.e. write a row to a log table).
    Justin

Maybe you are looking for

  • Error while creating outbound Native MQ adapter Service

    I have created a BPEL process to produce text message into an MQ using native MQ adapter. Here is my oc4j-ra <connector-factory location="eis/MQ/MQSeriesAdapter" connector-name="MQSeriesAdapter"> <config-property name="hostName" value="192.168.50.57"

  • MacBook Pro shows 356gb of App Storage

    My MacBook Pro shows 356gb used for apps but when I click Get Info for the Applications folder it only shows 9gb used. 9gb to 356gb is a significant jump.. Is there any way I could delete this or find the 300gb+ excess of storage is?

  • AEBS w/Quicksilver G4, OS 9 iMac and a Dell PC Win2000

    I cannot get my Dell PC running Win2000 to connect to the internet via my Airport Extreme Base Station. I configured it with my G4. The G4 and the iMac are connected to via a switch and ethernet cables. They both access the internet just fine. The De

  • Oracle Control Problem

    hi i'm new in oracle and i know that my question might be quite simple but i cannot manage this problem. here's my question i have two table (lets say A(name,number,code) and B (task,event) ) and A's number and B's task have same values. what i'm try

  • Maxtor 3200 v Apple Mac - a love not made in heaven!

    I have a Maxtor Personal Storage 3200 external HD which I was using as a Time Machine. The ex-HD is connected to the Mac directly via a USB cable. Recently, the Time Machine has stopped backing up files full stop. I have tried the following steps, bu