Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012
    Posts
    13

    Unanswered: How to find whether the Exact string is present or not in a given string

    Hi,

    I'm facing some problem even after using INSTR function in Oracle.

    The problem is

    I have written the logic in the PL/SQL block which appends all the values fetched in a loop on the basis of whether the string is present or not.

    For ex:

    The first value fetched from the select query first is ABCDEFG which gets appended to a variable
    The next value fetched is AB even this has to be appended to the variable since this exactly doesn't match with ABCDEFG.
    The next value fetched is BCDEF even this has to be appended to the variable since this exactly doesn't match with ABCDEFG.
    The third Value fetched is ABCDEFG this will not get appended presently according to the logic which is correct.

    So can you all please help me out in writing that piece of code to append the value fetched which doesn't exactly match with the existing string

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    I don't see a problem here.
    • you stored the first value into two variables - variable_1 and variable_2. Variable_1 won't change, you just leave it "as is". Use variable_2 for your "appending" operation.
    • keep fetching values
    • compare every fetched value with a value you stored into the variable_1. If they match, don't do anything. If they do NOT match, append the new value to the variable_2

Tags for this Thread

Posting Permissions

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