ORA-00936: missing expression
always indicates a syntax error. There are several bloomers in your posted code.
- The number of
)
must match the number of (
.
[
is not a recognised character in Oracle SQL. It's not clear what you're trying to achieve with them, so it's difficult to know how to suggest you fix this, but you need to get rid of them somehow.
- The
,(
construct is wrong.
Or rather apparent bloomers. Because when I attempted to correct your code the editor reversed my changes e.g. )
turned back to (
. When I pasted it into an ASCII editor I saw this ...
Replace(Replace(Replace(first_name, '?', '?'), '?','?'), '?', '?')
... which gives the correct count of )
and the correct nesting of REPLACE() calls.
Hypothesis: some kind of character set mistranslation. So the question is, is the SO editor introducing this corruption or are you experiencing this in your client too?
Incidentally the right side of the operation in ASCII is
REPLACE(REPLACE(REPLACE(['????'], '?', '?'), '?','?'),'?','?'))
So those rogue [
]
are real (I think) and you must remove them. Given that the other "errors" may just be artefacts of the SO Editor I think those square brackets are the thing you should focus on.