semi-colon weirdness when converting from mysql to Oracle



I've used mysql extensively, but now I'm converting to Oracle. My
inserts are working, but my queries are sensitive to the semi-colon
line termination. Is there a way to correct this without rewriting all
my queries?

For example, the following works for JDBC with mysql and Oracle's SQL
Command line tool. But using JDBC with Oracle throws an error:
ORA-00911: invalid character

SELECT distinct (clientName) FROM tm.ClientSessionInfo;

However, removing the semi-colon allows the query to work from JDBC
with Oracle:

SELECT distinct (clientName) FROM tm.ClientSessionInfo

I'm using oracle.jdbc.driver.OracleDriver 1.4 and Oracle 10.

The code is:
String query ="SELECT distinct (clientName) FROM tm.ClientSessionInfo;"
statement = connection.prepareStatement( query );
results = statement.executeQuery( );

Do I have to rewrite all my queries without semi-colons or is there
some other solution?

Thanks

.



Relevant Pages

  • Re: semi-colon weirdness when converting from mysql to Oracle
    ... but my queries are sensitive to the semi-colon ... the following works for JDBC with mysql and Oracle's SQL ... removing the semi-colon allows the query to work from JDBC ... They should not have been in your SQL strings to begin with in your JDBC code. ...
    (comp.lang.java.databases)
  • Re: SQL Injection
    ... > I am currently pen-testing a web app and I am stuck in trying to execute ... two queries sequentially in Oracle. ... You won't have luck with this in Oracle. ... the end query build by a cgi-script being ...
    (Pen-Test)
  • Re: ORACLE CLIENT USERS BEWARE: Bug in Query Builder breaks SQL
    ... Can you enlighten me; you appear to be saying there are three different ways to run queries against Oracle; ... If you have to move projects from VS2003 that include such SQL queries, you have to fix it all by hand. ... When trying to use the Query Builder with Oracle, queries that create INNER JOIN syntax result in an error in Query Builder when trying to generate your schemas. ...
    (microsoft.public.vsnet.general)
  • Re: SELECT DISTINCT slow, how can I speed up
    ... We have staff using Access 2003 as a front end to the Oracle tables ... for the purposes of ad hoc queries. ... come back within a second of the SQL starting to run. ... only 20-50 rows come back and the query takes 28 seconds and there is ...
    (comp.databases.oracle.server)
  • Re: SELECT DISTINCT slow, how can I speed up
    ... We have staff using Access 2003 as a front end to the Oracle tables ... for the purposes of ad hoc queries. ... come back within a second of the SQL starting to run. ... only 20-50 rows come back and the query takes 28 seconds and there is ...
    (comp.databases.oracle.server)