Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: From Keyword not found where expected

Re: From Keyword not found where expected

From: Ron Reidy <rereidy_at_indra.com>
Date: Tue, 13 Nov 2001 15:08:32 -0700
Message-ID: <3BF199E0.1543C21B@indra.com>


Skye wrote:
>
> Hi All,
>
> here is my SQL:
>
> Select a.tablespace_name, a.bytes, b.tablespace_name, b.bytes,
> (round(a.bytes-b.bytes)/a.bytes)*100, 2), '990.90')
> From
> (Select tablespace_name, (sum(bytes), '999,999,999,999') bytes from
> dba_data_files) a,
> (Select tablespace_name, (sum(bytes), '999,999,999,999') bytes from
> dba_free_space) b,
> Where a.tablespace_name=b.tablespace_name
> Order by a.tablespace_name
>
> When I try to run this it gives me the error:
> ORA-00923: FROM keyword not found where expected
>
> The code above was modified from the original:
>
> Select a.tablespace_name "Tablespace Name",
> to_char(sum(a.bytes),'999,999,999,999')
> allocated,
> to_char(sum(b.bytes),'999,999,999,999') free,
> to_char(round(((sum(a.bytes)-sum(b.bytes))/sum(a.bytes))*100,2),'990.90')
> pct_full
> from dba_data_files a,dba_free_space b
> where a.tablespace_name=b.tablespace_name
> order by a.tablespace_name,
> ((sum(a.bytes)-sum(b.bytes))/sum(a.bytes)) desc
>
> Because it gave me the error:
> ORA-00937- not a single-group group function
>
> So..are there any ideas as to what I need to do to correct either of
> these problems?
>
> I am trying to give Free Tablespace statistics (Tablespace Name, Bytes
> Allocated, Bytes Free, and Percent Full) from the V$ tables
> dba_data_files and dba_free_space.
>
> I am fairly new to SQL so I was happy to have come this far!
> Please respond to this email address: sboscarelli_at_kmg.com
> as it differs from my posting addy.
>
> Thanks in advance.

You have a lot of syntax errors...

Query 1 - mismatched paranthesis. I suggest you use an editor that does parenthis matching.
Query 2 (original) - you are using a grouping function (sum) on a column. You need to specifiy other columns used in the query in a GROUP BY clause. Read the SQL manuals.

-- 
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.
Received on Tue Nov 13 2001 - 16:08:32 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US