By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,594 Members | 3,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,594 IT Pros & Developers. It's quick & easy.

Strange error:An unexpected token ")" was found...Expected tokens may include: ")"

P: n/a
P
Hi all,

I'm trying to run the following code taken from
http://blogs.ittoolbox.com/database/...es/006045.asp#

select substr(tablespace_name,1,30) as "Tablespace Name",
case (tablespace_type)
when 0 then 'DMS'
else 'SMS'
end as "Type",
case (tablespace_state)
when 0 then 'Normal'
else 'Other ' || char(tablespace_state)
end as "State",
int((total_pages*page_size)/1024/1024) as "Size (Meg)",
smallint((float(free_pages) / float(total_pages))*100)
as "% Free Space",
int((free_pages*page_size) / 1024 / 1024)
as "Meg Free Space"
from db2$mon_tbs_cfg

It's suppose to find how much freespace is left for a tablespace. I
called the script freespace.sql. I tried to run it with the follownig
command:

db2batch -d SAMPLE -f freespace.sql

However, I recieved a strange error:

SQL0104N An unexpected token ")" was found following "ase
(tablespace_type".
Expected tokens may include: ")". SQLSTATE=42601
If it's expecting ")", why would it say ")" is unexpected?

Any idea is appreciated :)

Mar 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
P wrote:
Hi all,

I'm trying to run the following code taken from
http://blogs.ittoolbox.com/database/...es/006045.asp#

select substr(tablespace_name,1,30) as "Tablespace Name",
case (tablespace_type)
when 0 then 'DMS'
else 'SMS'
end as "Type",
case (tablespace_state)
when 0 then 'Normal'
else 'Other ' || char(tablespace_state)
end as "State",
int((total_pages*page_size)/1024/1024) as "Size (Meg)",
smallint((float(free_pages) / float(total_pages))*100)
as "% Free Space",
int((free_pages*page_size) / 1024 / 1024)
as "Meg Free Space"
from db2$mon_tbs_cfg


Add a semicolon here (this is the default statement terminator for
db2batch):

;

Also make sure that the are no non-printable characters at the end of the
lines (like DOS EOL characters).

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Mar 21 '06 #2

P: n/a
P
Thanks Knut! It works :)

Mar 21 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.