How can I check SQL syntax for a JDBC statement without running the actual query?
jdbc, oracle, sql, syntax, verification
Solution
possibly issuing an explain plan for the statement would give you useful results.
another thought - but maybe harder is to edit the query to add (and rownum < 1) or something to make it run fast
Problem
I have an SQL statement (for an Oracle database) that takes a long time to run if it is valid. If it's not valid, it returns immediately with an error. I'd like to check that the syntax is valid without running the statement (via JDBC), for example behind a 'check statement' button. Is there a vendor-independent way of doing that? My first thought of simply defining the query as a PreparedStatement does not seem to cause any kind of compilation or error checking.