ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SQL Update First Occurrence only?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL Update First Occurrence only?

    Hi Everyone,

    Please forgive me and let me know if this is posted twice, my first post didn't seem to work.

    I have an sql command that seems to be taking a long time to process. My RPG program processes ~ 500k records and runs in less than 1 minute, love my i.

    However when I execute the command below to update a flat file of XML the run time increases from 1 minute to 50-65 minutes.

    The command does a scan/replace in a db2 flat file that has xml in it. There are ~84k records in the xml file.

    I pretty sure my problem is that it scans all 84k records every execution of the sql command.

    Does anyone know how I can indicate that the update should stop after the first occurrence is found?

    Short of not using i, I am open to changing the command or process.

    Many thanks for your time and wisdom.

    BOO!
    Gary Barnes

    SQL COMMAND:
    update ssr101af set xml = Replace(xml,'[tsiitm0789','P005000610 PURGE BASE') where xml like '%[tsiitm0789%'

    Finds '[tsiitm0789'
    Replaces it with 'P005000610 PURGE BASE'
Working...
X