0

I'm having an issue with my query where I'm getting an error,

ORA-00923: FROM keyword not found where expected.

However, I think the FROM statement is in the right place, and it might be one of the other operators that's causing the error to be thrown.

SELECT 
column1, column2
ORDER BY column2 DESC
REPLACE(REPLACE('%(param1)s', 'a', 'b'), 'c', 'd'),
CASE WHEN REGEXP_INSTR('%(param1)s', '\\\') > 0 AND REGEXP_LIKE(column1.'%(param1)s') THEN 'Y' END REGEXP_MATCH,
CASE WHEN REGEXP_INSTR('%(param1)s', '\\\') = 0 AND column1 LIKE '%(param1)s' THEN 'Y' END LIKE_MATCH,
FROM TABLE1
WHERE (REGEXP_INSTR('%param1)s', '[|(\\\[]') > 0 AND REGEXP_LIKE(column1.'%(param1)s')) 
OR
(REGEXP_INSTR('%param1)s', '[|(\\\[]') = 0 AND column1 LIKE ('%(param1)s') 
OR ('%(param1)s' IS NULL)
1
  • By the way, replace is a function, not an operator. Commented May 1, 2020 at 22:21

1 Answer 1

2

Misplaced ORDER BY, dots instead of commas, missing closing brackets ... you should really pay more attention to what you do.

This should be OK as far as syntax is concerned. Will it do what you meant it to do, I have no idea.

  SELECT column1,
         column2,
         REPLACE (REPLACE ('%(param1)s', 'a', 'b'), 'c', 'd'),
         CASE
            WHEN     REGEXP_INSTR ('%(param1)s', '\\\') > 0
                 AND REGEXP_LIKE (column1, '%(param1)s')
            THEN
               'Y'
         END
            REGEXP_MATCH,
         CASE
            WHEN     REGEXP_INSTR ('%(param1)s', '\\\') = 0
                 AND column1 LIKE '%(param1)s'
            THEN
               'Y'
         END
            LIKE_MATCH
    FROM TABLE1
   WHERE    (    REGEXP_INSTR ('%param1)s', '[|(\\\[]') > 0
             AND REGEXP_LIKE (column1, '%(param1)s'))
         OR (       REGEXP_INSTR ('%param1)s', '[|(\\\[]') = 0
                AND column1 LIKE ('%(param1)s')
             OR ('%(param1)s' IS NULL))
ORDER BY column2 DESC
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.