Home > Software engineering >  How do I fix this problem - DERBY SQL Error: SCHEMA DOES NOT EXIST
How do I fix this problem - DERBY SQL Error: SCHEMA DOES NOT EXIST

Time:06-28

I am trying to run this query, but I get the above SQL error.

query = "SELECT Count(*) as itemQuantity FROM ItemTable.Quantity WHERE ItemTable.BarCode = cast(" itemCode " AS INTEGER)";

SQL Error java.sql.SQLSyntaxErrorException: Schema 'ITEMTABLE' does not exist

CodePudding user response:

It seems "FROM ItemTable.Quantity" is wrong. just change it to "FROM ItemTable"

CodePudding user response:

without using schema

query = "SELECT Count(Quantity) as itemQuantity FROM ItemTable WHERE BarCode = cast(" itemCode " AS INTEGER)";

with schema

query = "SELECT Count(Quantity) as itemQuantity FROM dbo.ItemTable WHERE BarCode = cast(" itemCode " AS INTEGER)";

in above dbo is database schema you can define your own if you like so

  • Related