Remember once ORA-00909: invalid number of parameters

Today, when I was adding query conditions to a sql during development, I encountered ORA-00909: The number of parameters is invalid and an error was reported. Then I checked the sql and found that there was no problem with the parameters. Then I checked the information myself and found that if there was a spelling error in the SQL statement, this error would also be reported.

Later, I suddenly realized that it was my SQL spelling problem, because I had been using mysql to develop before. When using the CONCAT function to splice fuzzy narration, it was always CONCAT('%',?,'%') directly spelled like this, but I remembered that Oracle does not support it. To spell it this way, you need to rewrite CONCAT('%',?,'%') into CONCAT(CONCAT('%',?),'%'), because the CONCAT function in Oracle can only process two strings at a time. For splicing, if there are more than two, an error will be reported. I will record my error report and hope it will be helpful to friends who also encounter this problem.

Guess you like

Origin blog.csdn.net/qq_40647372/article/details/135966355