You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Brandon Dohman <B-...@gotcg.net> on 2008/04/30 23:25:28 UTC

SQLSyntaxErrorException:

Wheren running the command below
 
 rs = stmnt.executeQuery("SELECT PDFLOCATION from FILES WHERE PDFNAME = " + patron.getPDFName().toLowerCase());
 
I'm getting this error message.
 
 
java.sql.SQLSyntaxErrorException: Column 'TESTME' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then 'TESTME' is not a column in the target table.
        at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
        at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
        at org.apache.derby.client.am.Statement.executeQuery(Unknown Source)
        at DBServer.conversation.run(conversation.java:691)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.derby.client.am.SqlException: Column 'TESTME' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then 'TESTME' is not a column in the target table.
        at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
        at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
        at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
        at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
        at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
        at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
        at org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source)
        at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
        at org.apache.derby.client.am.Statement.executeQueryX(Unknown Source)
        ... 3 more

I'm not sure why I'm receiving this message.  testme is in the database.
 
Could it possibly not be matching on the Case of the piece I'm looking for?  PDFNAME is stored in the database as a VARCHAR
 

Re: SQLSyntaxErrorException:

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Brandon,

I suspect that you need to put single quotes around the string value 
which you want to match in PDFNAME. Something like the following:

  select pdflocation from files where pdfname = 'foo'

Without the single quotes, Derby thinks that foo is the name of a column 
and Derby objects that foo is not a column in the files table.

Hope this helps,
-Rick

Brandon Dohman wrote:
> Wheren running the command below
>  
>  rs = stmnt.executeQuery("SELECT PDFLOCATION from FILES WHERE PDFNAME 
> = " + patron.getPDFName().toLowerCase());
>  
> I'm getting this error message.
>  
>  
> java.sql.SQLSyntaxErrorException: Column 'TESTME' is either not in any 
> table in the FROM list or appears within a join specification and is 
> outside the scope of the join specification or appears in a HAVING 
> clause and is not in the GROUP BY list. If this is a CREATE or ALTER 
> TABLE  statement then 'TESTME' is not a column in the target table.
>         at 
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>         at 
> org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
>         at org.apache.derby.client.am.Statement.executeQuery(Unknown 
> Source)
>         at DBServer.conversation.run(conversation.java:691)
>         at java.lang.Thread.run(Thread.java:619)
> Caused by: org.apache.derby.client.am.SqlException: Column 'TESTME' is 
> either not in any table in the FROM list or appears within a join 
> specification and is outside the scope of the join specification or 
> appears in a HAVING clause and is not in the GROUP BY list. If this is 
> a CREATE or ALTER TABLE  statement then 'TESTME' is not a column in 
> the target table.
>         at org.apache.derby.client.am.Statement.completeSqlca(Unknown 
> Source)
>         at 
> org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown 
> Source)
>         at 
> org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown 
> Source)
>         at 
> org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown 
> Source)
>         at 
> org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown 
> Source)
>         at 
> org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown 
> Source)
>         at 
> org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown 
> Source)
>         at org.apache.derby.client.am.Statement.flowExecute(Unknown 
> Source)
>         at org.apache.derby.client.am.Statement.executeQueryX(Unknown 
> Source)
>         ... 3 more
> I'm not sure why I'm receiving this message.  testme is in the database.
>  
> Could it possibly not be matching on the Case of the piece I'm looking 
> for?  PDFNAME is stored in the database as a VARCHAR
>