a weird logical fault ?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: a weird logical fault ?

  1. #1
    Join Date
    Jun 2005
    Posts
    1

    Unhappy a weird logical fault ?

    I am trying to receive and parse the following xml, and insert elements into fields in my database.
    I am using a function that looks similar to this:

    DECLARE
    v_counter NUMBER;
    v_brukerid varchar2(10);
    v_mld_id varchar2(5);
    v_xml xmltype;

    BEGIN

    v_xml := '
    meldinger--
    user--tom--/user
    melding--
    id--73--/id
    --/melding
    melding--
    id--74--/id
    --/melding
    --/meldinger';


    IF v_xml.existsnode(v_xmlsti || '/brukerid') = 1 THEN
    v_user := fnc_hentverdi (v_xml,'/meldinger/brukerid/text()');
    END IF;

    v_counter := 1;

    while v_xml.existsnode('/meldinger/melding['|| v_counter ||']') = 1 LOOP

    v_mld_id := fnc_hentnrverdi (v_xml,'/meldinger/melding/id/text()');

    INSERT INTO table1 (field1, field2)
    VALUES (v_mld_id, v_brukerid);

    v_counter := v_counter + 1;

    END IF;

    which I would expect to give

    table1
    -------------
    tom 73
    tom 74

    but it gives as output

    table1
    -------------
    tom 7374
    tom 7374

    I have done the same routine before, and then it worked fine.
    Last edited by Therese Sande; 06-20-2005 at 09:29 AM.

  2. #2
    Join Date
    Jun 2005
    Posts
    2
    how about if you change this:

    v_mld_id := fnc_hentnrverdi (v_xml,'/meldinger/melding/id/text()');

    to

    v_mld_id := fnc_hentnrverdi (v_xml,'/meldinger/melding['|| v_counter ||']/id/text()');

    ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width