Script that searches and updates/deletes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mslabelle
    New Member
    • Jun 2007
    • 1

    Script that searches and updates/deletes

    I’m new to Oracle (PL/SQL), and have very little real world experience.

    But I’ve been met with a challenge.
    It’s quite interesting and I know I can meet it with a little help/direction.

    We have a table in our database that works as a reference….
    It has 2 columns. The first contains ID values, and the second contains about a 40 line SQL query that when run generates reports.

    Needless to say, I have to write a script that searches each of the rows for a particular string within the SQL codes. If the string is found, it is to be deleted. (Or perhaps an Update would work better here. Substituting the old code for a new version of the code WITHOUT the string).

    Anyway, I have no idea how to do this.

    I’d appreciate whatever help I can get.
    Thanks.

    (PS: hope this was clear)
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Hi
    mslabelle
    Welcome to TSDN.

    You have reached the right place for knowledge shairing.

    Here you will find a vast resource of related topics and code.

    Feel free to post more doubts/questions in the forum.

    But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

    It will help Experts in the forum in solving/underestanding your problem in a better way.

    Please follow the posting guidelines in every new post/reply.

    Regards

    Debasis

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      For the purpose u need to write a procedure.

      Write a cursor with in the procedure to read data from the specified table .

      in the procedure pass 2 parameters

      1. for the search string
      2. the new value to update with.

      if it is found update else do nothing or any other logic u want to implement.

      Try with the above logic and do post back with your code next time.

      Comment

      Working...