Skip to content
Advertisement

INSERT INTO table SELECT not working with constant values in H2 DB

Following is the H2DB query

What I am trying to achieve is to insert a record into userpermission for user with given email address in user table, for each permission in permission table.

Following is the error

The same query is working in MySQL.

Advertisement

Answer

As mentioned in the comments,

  1. Use single quotes for sting constants.
  2. Do not use braces with constants in select clause.
  3. Check the join condition. Without matching 2 tables based on common column, you are doing a Cartesian product
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement