Reputation: 45
Ok, I'm gonna explain the environment so you can understand my problem.
I'm using IBM Data Studio to connect and edit my DB2 database which
is named [dgsmdb]
I connect to the database using the username: dgsmadm
& password: password
I created a schema named: [LOGICGATES]
Inside the schema, I have three tables which one is named: [GATEDETAILS]
Now, when I invoke the GATEDETAILS table inside the LOGICGATES schema using my stored procedure which looks like this:
DECLARE c CURSOR FOR SELECT gatename FROM LOGICGATES.GATEDETAILS;
I'm encountering a problem which says: ["LOGICGATES.GATEDETAILS" is an undefined name. SQLERROR=42704]
, in which I know that it practically says (in my own understanding) that the table GATEDETAILS
is not present in the database. This is really bugging me because it is clear to me that I created the GATEDETAILS
table in the LOGICGATES
schema successfully. I've been checking this for hours and I still can't find my mistake. I admit that I'm not that good and there is some mistake that I'm somewhat overlooking so I would like to ask for help with this. Whoever out there who can correct my mistake, you're my last hope, I really need this.
Upvotes: 0
Views: 6545
Reputation: 7693
How did you create your table? Did you put the schema before the table?
create table LOGICGATES.GATEDETAILS (col1 type, ...)
Or you just create the schema and then the tables
create schema LOGICGATES;
create table GATEDETAILS (col1 type, ...)
If you created the tables in like this second way, your table will be named dgsmadm.GATEDETAILS because of the implicit schema.
Take a look at the catalog
select tabschema, tabname from syscat.tables where tabschema not like 'SYS%'
Upvotes: 1