Nadya Durovich
Nadya Durovich

Reputation: 1

Need to write a correct query in Derby

I need to filter data in Java app which get data from Derdy. I created a table in Derby and use this query below which is runnable for MySQL but not for Derby. Can anybody have idea how to make the query compatible with Derby? With this query I need to press button Search and it gives me resuls in JPanel.

Select * FROM fruits where concat (apple, orange, banana) LIKE '%"+ValToSearch+"%';

Upvotes: 0

Views: 55

Answers (1)

Bacteria
Bacteria

Reputation: 8596

Derby supports + for string concatenation.

Concatenation

The concatenation operator, ||, concatenates its right operand to the end of its left operand. It operates on a character or bit expression.

Because all built-in data types are implicitly converted to strings, this function can act on all built-in data types.

Use || to concatenate strings instead of using concat funcation. For more details view this.

Upvotes: 1

Related Questions