Statement « derby « Java Database Q&A





1. conditional statements in derby    stackoverflow.com

It looks like derby doesn't support conditional statements [IF]. How do we write

if exists (select 1 from customers where name='somename') 
    update customers ...
else 
 ...

2. Is NULL not allowed is SQL delete statement (for Derby)?    stackoverflow.com

Hello Does anyone know why the following query fails in Derby?

delete from MyTable
where
((null = null) or (col1 = null)) OR
((102 = null) or (col2 = 102)))
I get the following error:
Error: Syntax error: ...

3. Error in SQL statement for Derby database    stackoverflow.com

I'm havin an error while trying to execute this piece of sql code... The error I'm getting is:

Encountered "(" at line 1, column 45
The piece of code is:
ALTER TABLE APP.RESPOSTAS ADD ...

4. how to use 'BETWEEN' condetion two times in one sql statement for same column or diffrent columns    stackoverflow.com

this is sql statement give only one value

SELECT count(pn1) FROM pledges
WHERE date1
BETWEEN '2011-05-05' AND '2011-06-06'
i want use "between" more than one time for same column or for different columns in same ...

5. How to optimize this sql delete statement    stackoverflow.com

I have 3 tables, the first one, table1, has as primary key the id column, the second table (table2) has a column table1_id that refer as foreign key to the table1.id, ...

6. Can I close statements in a transaction before committing it in Derby (JDBC)?    stackoverflow.com

Basically I have (ignoring exception handling, etc.):

connection.setAutoCommit(false);

Statement statement1 = connection.createStatement();
statement1.executeUpdate("...");
statement1.close();

Statement statement2 = connection.createStatement();
statement2.executeUpdate("...");
statement2.close();

connection.commit();
If I understand correctly it shouldn't have any impact because all it really does is free the resources for ...

7. I Need Help With a Derby SQL Join Statement    coderanch.com

I have the following Derby SQL statement which is embedded in my Java code and is executed via JDBC. It works, but it gives me all service dates. What I need is to refine this query so that it only gives me a tuple with the most-recent service-date. Can someone help me with this? Thank you for the time to read ...