Use quoted schema in an insert statement executed thorough PreparedStatement in Java
0
votes
1
answer
288
views
I created an unquoted table
my_table
under a quoted schema "Quoted_User"
.
When executing the statement
INSERT INTO "Quoted_User".my_table (custom_id) VALUES (DEFAULT)
using the Intellij Oracle browser it works, but when I'm performing the same statement through a PreparedStatement in Java Oracle is complaining that the schema is not existing. Here's the prepared statement Java line:
statement = connection.prepareStatement(insertSQL, new String[]{custom_id});
and here is insertSQL
as shown in the inspector:
INSERT INTO \"Quoted_User\".my_table (custom_id) VALUES (DEFAULT)
It's like Oracle is removing the quotes, and I can say this because I noticed the uppercase letters in the error message which are always returned when the object is considered to be case insensitive.
Error returned by Oracle:
java.sql.SQLSyntaxErrorException: ORA-04043: object "QUOTED_USER" does not exist
There should be a way to use quoted schema names with prepared statements I guess.
Thanks for your hints,
Mattia
Asked by Mattia Moretta
(3 rep)
Aug 24, 2019, 11:28 AM
Last activity: May 10, 2025, 08:03 PM
Last activity: May 10, 2025, 08:03 PM