db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Carpenter" <stephen-...@hotmail.co.uk>
Subject Simple SQL problem
Date Sun, 15 Apr 2007 11:39:34 GMT
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"

I have scoured the manuals and have reconstructed the SQL via the Reference 
Manual but get the same results.

Any pointers would be greatly appreciated.

_________________________________________________________________
Match.com - Click Here To Find Singles In Your Area Today! 
http://msnuk.match.com/


Mime
View raw message