0
votes

I am a first time DB2 user, have trouble in executing "list tables;" in IBM Data Studio.

I can run "select" commands (end with semicolon) and "update commands" but "list tables;" (both with and without semicolon) gives following error:

An unexpected token "END-OF-STATEMENT" was found following "LIST TABLES". 
Expected tokens may include:  "JOIN <joined_table>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.14.113

Update: Alternatively, the following command works:

select tabname from syscat.tables where tabschema = 'whatever-schema-name';

BTW, is it possible to change the default query result window from "Status" to "Result1". It is in "Status" window by default and every time I have to click "Result1" tab to see the query result.

2

2 Answers

0
votes

I am not sure about what I am going to say, but Data Studio is only for SQL commands. List table command is not a DDL, DML nor DCL, and for this reason, you cannot execute that command from the SQL editor in Data Studio. Those commands are for the CLP.

0
votes

use list all the tables in the DB as given below

    db2 list tables for all

use list all the tables in the Schema as given below

    db2 list tables for schema scheme_Name