?
Solved

Oracle xpath

Posted on 2011-03-02
15
Medium Priority
?
866 Views
Last Modified: 2012-05-11
Experts...

I created a function where in I pass the xml and am trying to update it within the function. It compiled fine but when I try to run it in an anonymous block I get this error
ORA-30625: method dispatch on NULL SELF argument is disallowed

here is my code

I have this xml in a variable v_xml

I pass it to a function

get_dtls_fn(i_xml xmltype)
return xmltype
IS
v_xml2 xmltype;
begin
select UPDATEXML(i_xml, '/decsn/fs/arp/text()', '5') into v_xml2 from dual;
return v_xml2;
end;

and when I call this function from an anonymous block like

set serveroutput on;
v_clob clob:=null;
v_xml1 xmltype;
begin
-- crdt_aplcn_oid,rte_one_fnc_src_id,crdt_dcsn_oid
v_xml1:=get_dtls_fn(v_xml);  -- v_xml I get if from another function call and this is a valid xml
v_clob := v_xml.getClobVal();
v_num:= 1;
dbms_output.put_line('vxml' || v_clob);
end;

I get the following error ORA-30625: method dispatch on NULL SELF argument is disallowed

what is the solution here    
0
Comment
Question by:chickanna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
  • 3
15 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 1000 total points
ID: 35020387
You need to look at what is being returned from:  get_dtls_fn(v_xml);

I cannot reproduce the error hardcoding your sample xml.
create or replace function get_dtls_fn(i_xml xmltype)
return xmltype
IS
  v_xml2 xmltype;
begin
select UPDATEXML(i_xml, '/decsn/fs/arp/text()', '5') into v_xml2 from dual;
return v_xml2;
end;
/

show errors

set serveroutput on;

declare
v_clob clob:=null;
v_xml1 xmltype;
begin
v_xml1:= xmltype('<decsn> <fs> <fstype> 2 </fstype> <fscmp>abc</fscmp> </fs> </decsn>');
v_clob := v_xml1.getClobVal();
dbms_output.put_line('vxml' || v_clob);
end;
/

Open in new window

0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35020405
I don't have your v_xml declaration or the procedure that is populating it so I can't verify that.

However, using the xml content from your previous question
I constructed this test case and it works.

Note I changed the "getclob"  to be for v_xml1  not v_xml


CREATE OR REPLACE FUNCTION get_dtls_fn(i_xml XMLTYPE)
    RETURN XMLTYPE
IS
    v_xml2   XMLTYPE;
BEGIN
    SELECT UPDATEXML(i_xml, '/decsn/fs/arp/text()', '5') INTO v_xml2 FROM DUAL;

    RETURN v_xml2;
END;


DECLARE
    v_clob   CLOB := NULL;
    v_xml1   XMLTYPE;
    v_xml    XMLTYPE
        := xmltype(
               '<decsn> <fs> <fstype> 2 </fstype> <fscmp>abc</fscmp> <arp>3.4</arp> </fs> </decsn>');
BEGIN
    v_xml1  := get_dtls_fn(v_xml);
    v_clob  := v_xml1.getclobval();
    DBMS_OUTPUT.put_line('vxml' || v_clob);
END;

Open in new window

0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35020410
>>You need to look at what is being returned from:  get_dtls_fn(v_xml);

duh...

I meant to say the function where you get  v_xml
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35020430
I can't even reproduce that error with completely different XML:

...
v_xml1:= xmltype('<moe> <larry> <curley> 2 </curley> </larry> </moe>');
...
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35020464
Note,  if your v_xml isn't properly initialized you'll get the error you are reporting.
I'd look at your OTHER routine that is supposed to be populating v_xml.

DECLARE
    v_clob   CLOB := NULL;
    v_xml1   XMLTYPE;
    v_xml    XMLTYPE;
       -- := xmltype(
         --      '<decsn> <fs> <fstype> 2 </fstype> <fscmp>abc</fscmp> <arp>3.4</arp> </fs> </decsn>');
BEGIN
    v_xml1  := get_dtls_fn(v_xml);   -- you'll get an error here because v_xml isn't initalized
    v_clob  := v_xml1.getclobval();
    DBMS_OUTPUT.put_line('vxml' || v_clob);
END;
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35020506
Please ignore what I posted in http:#a35020387

I copied/pasted wrong and sdstuber beat me to the code example.
0
 

Author Comment

by:chickanna
ID: 35020674
Okay.. experts .. here is what is happening.

The function where I get v_xml from is in a package called PKG_GET_RSO_DETAILS and the function name is get_rso_dtls which takes 3 input parameters.

I want to add the call to my function get_dtls_fn inside get_rso_details.

The current return value from get_rso_details is v_xml. I want to replace this with the call

v_xml:=get_dtls_fn(v_xml);

where inside the function get_dtls_fn the UPDATEXML statement is executed and an xmltype is returned.

my anonymous block is now

set serveroutput on;
declare v_xml xmltype;
v_clob clob:=null;
begin
v_xml:=PKG_GET_RSO_DETAILS.get_rso_dtls(54958300,'ABC',54945663);
v_clob := v_xml.getClobVal();
v_num:= 1;
dbms_output.put_line('vxml' || v_clob);
end;

When I execute this code I get the error
 ORA-30625: method dispatch on NULL SELF argument is disallowed
ORA-06512: at line 5

0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35020693
PKG_GET_RSO_DETAILS.get_rso_dtls(54958300,'ABC',54945663);


this function call is not returning a valid xmltype
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35020699
The only way I reproduce that error is if I pass null into the function you wrote.

You can either change your function to handle null input or ensure you don't pass a null into the function.

0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35020704
forgot the example:

...
v_xml:=get_dtls_fn(null);
...

0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35020707
You'll have to figure out where that function is going wrong.
Once it's fixed calling your get_dtls_fn function is a trivial addition.
0
 

Author Comment

by:chickanna
ID: 35020885
sdstuber, the call  PKG_GET_RSO_DETAILS.get_rso_dtls(54958300,'ABC',54945663);
is returning a valid xml. The last line in the function has return v_xml where v_xml is built before by a select statement. Only if I add a call to my function like

v_xml:=get_dtls_fn(v_xml);
return v_xml;

I get the error. If I dont add the call to my function and print out the xml I see the xml in the output. My function seems to be ok as all it is doing is getting an input xml and updating an element and returning an xmltype. don't you agree? Not sure how to correct this error.
0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 1000 total points
ID: 35020926
how do you know you are getting valid xml?

your last example code in http#35020674  produces the error but doesn't call your new function.
it only calls get_rso_dtls, and it gets the  error

So clearly your new function isn't the problem.

check if get_rso_dtls is returning NULL
0
 

Author Closing Comment

by:chickanna
ID: 35021422
Thank you experts. As you have written, the v_xml was returning null values in some cases. Once I fixed it my new function worked beautifully. Thanks again.
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35021459
How does the "Accepted" post contribute to the answer?  As indicated by slightwv, that post should be ignored.

I believe http:#35020464 would be more appropriate since it's the first post to mention that your other routine is returning something uninitialized (ie NULL)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question