9 Replies Latest reply on Dec 3, 2009 6:18 PM by user11289444

    ORA-30625: method dispatch on NULL SELF argument is disallowed

    user11289444
      Hi,


      I have the following script when i=5 it returns the value it is not always but , depends on the " i" value dynamically based on my .xml
      if i use the below syntax i am getting ORA-30625: method dispatch on NULL SELF argument is disallowed, i tried by uncommenting the commented lines below but the i dont get any compilation error but it returns always null though in this case it has to return when my i = 5, any suggestion how to resolve the ORA error.




      declare

      l_xmltype XMLTYPE;
      p_file_name constant varchar2(50) :='xx.xml';
      v_temp varchar2(100);
      begin
      l_xmltype := XMLTYPE(bfilename('XMLDIR',p_file_name),
      nls_charset_id('AL32UTF8'));
      for i in 1..8 loop
      dbms_output.put_line('i'||i);
      --if l_xmltype.extract('/html/div/table/tbody/tr/td/b/text()') is null then
      --v_temp :=null;
      --dbms_output.put_line('v_temp:'||v_temp);
      --else
      v_temp :=l_xmltype.extract('/html/div/table/tbody/tr/td[i]/b/text()').getStringVal();
      dbms_output.put_line('v_tmp:'||v_temp);
      --end if;
      end loop;
      end;
      /
        • 1. Re: ORA-30625: method dispatch on NULL SELF argument is disallowed
          user11289444
          I am unable to print the tag here it is td, td square brace of i in the below syntax
          /html/div/table/tbody/tr/td[5]/text()
          • 2. Re: ORA-30625: method dispatch on NULL SELF argument is disallowed
            Jason_(A_Non)
            Without knowing what your input XML looks like, I'm going to guess that you only have 4 nodes for the Xpath you are looking for.

            Instead of hard-coding the number of times through the loop, use EXISTSNODE as shown in the second method in this previous example of mine at {thread:id=926354}

            Note: Wrap your code with a
             tag before/after it to retain formatting as shown in my example on that post.
            
            If using existsNode doesn't solve your problem, repost the PL/SQL that you are running along with a trimmed down version of the input XML that produces the problem.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
            • 3. Re: ORA-30625: method dispatch on NULL SELF argument is disallowed
              user11289444
              Hi,
              My XML is available in the below post..

              Unable to retrive the value of child

              in this example the bold tag may change on any of the date values so, my i value -index will be usually from 1 to 7 so the loop should repeat (days of the week), you can change the bold value to any one of the values to test this

              I tried some thing like this which you have mentioned..but still it is erroring out saying

              ERROR at line 1:
              ORA-06550: line 12, column 68:
              PLS-00306: wrong number or types of arguments in call to '>'
              ORA-06550: line 12, column 1:
              PL/SQL: Statement ignored


              declare
              -- Local variables here
              l_xmltype XMLTYPE;
              p_file_name constant varchar2(50) :='xx.xml';
              i number;
              v_rate varchar2(100);
              begin
              l_xmltype := XMLTYPE(bfilename('XMLDIR',p_file_name),
              nls_charset_id('AL32UTF8'));
              i:=1;
              dbms_output.put_line('i'||i);
              While l_xmltype.extract('/html/div/table/tbody/tr/td/b/text()') >0
              Loop
              v_rate :=l_xmltype.extract('/html/div/table/tbody/tr/td[i]/b/text()').getStringVal();
              dbms_output.put_line('v_rate:'||v_rate);
              i:=i+1;
              end loop;
              end;
              /
              • 4. Re: ORA-30625: method dispatch on NULL SELF argument is disallowed
                Jason_(A_Non)
                This snippet of your code
                While l_xmltype.extract
                should be
                While l_xmltype.existsNode
                As I mentioned before, when pasting SQL or PL/SQL into the forums, put the following line before/after the SQL and/or PL/SQL
                This will retain formatting and make it look like the code examples I have put into the forum.
                
                If you are trying to extract all the <td> entries, you will need two loops.  The first to get each <tr> entry and the second to get each <td> entry for a given <tr> entry.  I say that because in XPath terms
                /table/tbody/tr[1]/td[2] references Lunes
                while
                /table/tbody/tr[3]/td[2] references 9/13.3758                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                • 5. Re: ORA-30625: method dispatch on NULL SELF argument is disallowed
                  user11289444
                  Thank you..It worked..It was my mistake in copy paste

                  still i didnot understand the code how to paste..is this correct, i am just testing
                  Example
                  
                  { 
                  declare
                  i number;
                  Begin
                  dbms_output.put_line('dbms_output.put_line(l_xmltype.extract('/html/div/table/tbody/tr/td[2]/text()').getStringVal());
                  end;
                  }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                  • 6. Re: ORA-30625: method dispatch on NULL SELF argument is disallowed
                    Jason_(A_Non)
                    Close on your attempt to paste code.
                    Put the tag after the code as well. And by that I mean the word code wrapped with {

                    So in the plain text window when you are writing, it would look like this (without the space after the word code)
                    {code }
                    declare
                    i number;
                    Begin
                    dbms_output.put_line('dbms_output.put_line(l_xmltype.extract('/html/div/table/tbody/tr/td[2]/text()').getStringVal());
                    end;
                    {code }

                    which would result in
                    declare
                       i number;
                    Begin
                       dbms_output.put_line('dbms_output.put_line(l_xmltype.extract('/html/div/table/tbody/tr/td[2]/text()').getStringVal());
                    end;
                    The text in the first example has the same spacing format as the second example, but HTML hides the multiple spaces so they look different.
                    • 7. Re: ORA-30625: method dispatch on NULL SELF argument is disallowed
                      user11289444
                      i am just testing how to paste the code..please ignore

                      {code }
                      declare
                      i number;
                      begin
                      dbms_output.put_line('hai');
                      end;
                      {code }
                      • 8. Re: ORA-30625: method dispatch on NULL SELF argument is disallowed
                        user11289444
                        Testing...
                        declare
                        begin
                        null;
                        end;