Update query for XML tag values

Discussion in 'MySQL' started by Windhan, Jan 10, 2008.

  1. Windhan

    Windhan New Member

    Joined:
    Jan 9, 2008
    Messages:
    11
    Likes Received:
    3
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Chennai
    Hi All,

    My Mysql Version is 5.0,

    I have XML in the table and i want to update a particular tag,

    For Ex:
    This is my XML,

    <order>
    <product>
    <Item>
    Crop
    </Item>
    .
    .
    .
    .
    .
    .
    <Item>
    doe
    </Item>
    <product>
    <order>

    Now I update the Item Tag value alone as same product and i need the output as,

    <order>
    <product>
    <Item>
    myproduct
    </Item>
    .
    .
    .
    .
    .
    .
    <Item>
    myproduct
    </Item>
    <product>
    <order>

    How can update like this?, as my Version does not support XML functions.
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    You have to fetch the XML data, process it using a parser if required and the update the table with the new XML data. On-the-fly updation is not possible.
     
  3. Windhan

    Windhan New Member

    Joined:
    Jan 9, 2008
    Messages:
    11
    Likes Received:
    3
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Chennai
    Can't be this possible with a normal update query with MYSQL String Functions may be inside a Stored Procedure?

    :thinking:
     
  4. Windhan

    Windhan New Member

    Joined:
    Jan 9, 2008
    Messages:
    11
    Likes Received:
    3
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Chennai
    If i get a solution for my requirement here....that will be great
    :worried:
     
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    MySQL does not provide SQL operations but string operation is there but I am not sure that can help unless you have a very good at regular expressions
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice