‎2005 Sep 13 1:55 PM
Hi,
I want to run following native sql query but it is giving me error ora:933,
DATA: BEGIN OF WA,
TSP_NAME(255) TYPE C,
PER_USAGE(10) TYPE C,
END OF WA.
EXEC SQL PERFORMING loop_output.
select t.tablespace_name,'(' || TO_CHAR(ROUND(100*(NVL(b.bytes,0)/NVL(a
.bytes,0)))) || '%)' "TSUsed%" from dba_tablespaces t,
( select tablespace_name, sum(bytes)/1024/1024 bytes
from dba_data_files group by tablespace_name) a,
( select e.tablespace_name, sum(e.bytes)/1024/1024 bytes
from dba_extents e group by e.tablespace_name ) b,
( select f.tablespace_name, sum(f.bytes)/1024/1024 bytes
from dba_free_space f group by f.tablespace_name ) c
where t.tablespace_name = a.tablespace_name(+) and
t.tablespace_name = b.tablespace_name(+) and
t.tablespace_name = c.tablespace_name(+) into :wa.
ENDEXEC.
Please provide me the soln
Regards,
Bharat Mistry
‎2005 Sep 13 3:10 PM
ORA-00933: SQL command not properly ended.
Try:
EXEC SQL PERFORMING loop_output.
select
...
into :wa
ENDEXEC.
(No "." at the end). If that doesn't work, try ending it with a ";"
Rob
‎2005 Sep 21 11:14 AM
Hi Rob,
Thanks for your reply but i am getting new error
Database error text........: "ORA-01476: divisor is equal to zero"
I Think there is something wrong in the query.
Regards
Bharat Mistry
‎2005 Sep 21 2:53 PM
I think there is too.
It's a pretty complex select statement. For debugging purposses, break it down into simpler ones. And evaluate your aritmetic expressions manually in a break-point.
Rob