I wirte code in java and database connection with oracle. I run some script and get this error.My script work in toad but not work in my project
url include .
Replace '{4}'
with CHR(123)||'4'||CHR(125)
in your script.
You may be able to get around this by following the answer of another StackOverflow post: Create Java on Oracle database with JDBC
A summary is:
CallableStatement stat = conn.prepareCall(sql);
stat.setEscapeProcessing(false);
stat.execute();
The middle line is what you seem to be missing. I couldn't figure it out until I found that post.
It appears that several of the REPLACE calls do not have enough arguments. Counting from the left, the first REPLACE has two arguments. The second only has one argument. The third has two arguments. The fourth only has one argument. The fifth (last) has two arguments. In Oracle the REPLACE function requires at least two arguments. I'm not able to determine if this is the cause of the error as you haven't posted a complete statement, but I'd certainly expect the lack of proper arguments to REPLACE to be a problem.
Share and enjoy.
It's all about {
and }
. You do not use them. Ojdbc won't parse it. Use different token instead of them.
This is probably due to the JDBC Escape syntax (see section 13.4 of the JDBC 4.1 specification). A JDBC driver should handle escapes between {
and }
and translate the escaped standard function, outer join etc to the database specific format.
As far as I know a driver should only parse the escapes if it occurs in the statement body itself, and not when it is inside text in the statement (as it is in your example). So to me this looks like a bug in the JDBC escape processing of your driver.