3

There is a table called ta with schema db2admin. When I ran db2 select tabname,tabschema from syscat.tables wheretabname='ta' and tabschema='db2admin', it returned the row, which means the table was there.

However, when I ran the query db2 select * From db2admin.ta under the same user account, this error was raised:

SQL0204N "DB2ADMIN.TA" is an undefined name. SQLSTATE=42704

What is the reason for this?

4

DB2 (as other standard-compliant SQL databases) converts unquoted identifiers to uppercase, so when you say select * from db2admin.ta DB2 will look for the table named 'TA' in the schema 'DB2ADMIN'. That's exactly what the error message tells you.

According to the SYSCAT.TABLES query results, you have created your table and schema with lowercase names. To access them you will need to quote both identifiers (separately):

select * from "db2admin"."ta"

Note the double quotes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.