Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. String manipulation in stored procedures (MySQL 5.1)

String manipulation in stored procedures (MySQL 5.1)

Scheduled Pinned Locked Moved Database
databasemysqlhelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sylv33
    wrote on last edited by
    #1

    Hello, I need to write a stored procedure in MySQL that loops through all rows in a table (the column types are TEXT and VARCHAR) and replaces certain characters in the column values with another character. For example, a certain column contains the text "ababa" and I want to change it to "acaca". I can't quite figure out the part about replacing a character in a string with another and could use some help with this! Thank you! Sylv

    L P 2 Replies Last reply
    0
    • S Sylv33

      Hello, I need to write a stored procedure in MySQL that loops through all rows in a table (the column types are TEXT and VARCHAR) and replaces certain characters in the column values with another character. For example, a certain column contains the text "ababa" and I want to change it to "acaca". I can't quite figure out the part about replacing a character in a string with another and could use some help with this! Thank you! Sylv

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Sylv33 wrote:

      the part about replacing a character in a string

      There's a Replace[^]-function in MySQL. You'd have to test if it also works for the TEXT-type field though :)

      I are Troll :suss:

      1 Reply Last reply
      0
      • S Sylv33

        Hello, I need to write a stored procedure in MySQL that loops through all rows in a table (the column types are TEXT and VARCHAR) and replaces certain characters in the column values with another character. For example, a certain column contains the text "ababa" and I want to change it to "acaca". I can't quite figure out the part about replacing a character in a string with another and could use some help with this! Thank you! Sylv

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        Sylv33 wrote:

        loops through all rows in a table

        The engine should do that; you shouldn't.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups