Search code examples
javasqljdbcnetbeansderby

How to concat two varchars in jdbc/derby?


I want to run this code in JDBC/Derby but I got the below error. How can I handle it in JDBC?

Code:

   SELECT ID,Namee+ " " + Family AS NameS
   FROM Students

Errorr:

The '+' operator with a left operand type of 'VARCHAR' and a right operand type of 'VARCHAR' is not supported.

Solution

  • Derby uses the || operator to concat strings (like Oracle):

    SELECT ID, Namee || " " || Family AS NameS
    FROM Students