db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Simple SQL problem
Date Mon, 16 Apr 2007 11:55:21 GMT
Stephen Carpenter <stephen-hic@hotmail.co.uk> writes:

> Hi,
>
> I am developing in NetBeans 5.5 and using javaDB to port an existing
> desktop app with SQL that has worked with Interbase in the past. Its
> javaDB 10.1 btw.
> My question is why if I use an INNER JOIN clause the SQL does not work
> but if I use the WHERE clause the SQL does work ???  Here is my code :
> -
>
> This does not work . . .
> INSERT INTO TEMP_BRIEFING_NOTE_TBL
>                ( ITEM_NAME, ITEM_FORMAT, ITEM_SIZE, ITEM_COLOURS,
>                QUANTITY, PROCESS_CODE, SUPPLIER_CODE, EXEC_NAME,
>                CUSTOMER_ID, USER_NAME )
> SELECT DISTINCT I.ITEM_NAME, I.ITEM_FORMAT,
>                I.ITEM_SIZE, I.ITEM_COLOURS, I.QUANTITY, P.PROCESS_CODE,
>                P.PROCESS_SUPPLIER, P.PROCESS_EXEC, 2, 'steveC'
>                FROM JOB_ITEM_TBL INNER JOIN JOB_PROCESS_TBL P
>                ON I.JOB_NO = P.JOB_NO
>                WHERE I.JOB_NO = 21
>
> This does work . . .
> "INSERT INTO TEMP_BRIEFING_NOTE_TBL " +
>                " ( ITEM_NAME, ITEM_FORMAT, ITEM_SIZE, ITEM_COLOURS, "+
>                " QUANTITY, PROCESS_CODE, SUPPLIER_CODE, EXEC_NAME,  "+
>                " CUSTOMER_ID, USER_NAME ) "+
> " SELECT DISTINCT I.ITEM_NAME, I.ITEM_FORMAT, "+
>                " I.ITEM_SIZE, I.ITEM_COLOURS, I.QUANTITY,
> P.PROCESS_CODE, "+
>                " P.PROCESS_SUPPLIER, P.PROCESS_EXEC,  "+custID+",
> "+userName+"' "+
>                " FROM JOB_ITEM_TBL I , JOB_PROCESS_TBL P  "+
>                " WHERE I.JOB_NO = P.JOB_NO "+
>                " AND I.JOB_NO = " + jobID + " ";
>
> The error message is : -
> "org.apache.derby.client.am.SqlException: DERBY SQL error: SQLCODE:-1,
> SQLSTATE: XJ001, SQLERRMC: java.lang.NullPointerException  XJ001.U"

Hi Stephen,

This looks like a bug. Please log it on
http://issues.apache.org/jira/browse/DERBY and upload a small test case
that reproduces the bug. The repro test case could be either an SQL
script or a Java program which creates the tables and executes the
failing query.

Thanks,
-- 
Knut Anders

Mime
View raw message