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

Home -> Community -> Usenet -> c.d.o.server -> Re: Ugly PL/SQL Code

Re: Ugly PL/SQL Code

From: Noons <wizofoz2k_at_yahoo.com.au>
Date: 5 Feb 2004 16:46:22 -0800
Message-ID: <73e20c6c.0402051646.415cf7d4@posting.google.com>


cdavis10717_at_comcast.net (Charles) wrote in message news:<83dbb3cd.0402051050.249941e4_at_posting.google.com>...
> I am clearly no PL/SQL expert, but can anymore make this select less
> complex.

It's SQL, not PL/SQL, that you are using.

> I wanted to get a count of the files for each tablespace within the
> file systems of my server.
>
> The first 21 characters of all my Oracle database file names are the
> file systems names they live on.
>
> It was a one-time thing for me, I got it working, but it could have
> been easier.
>
> What could be done do this to make it less complex? Thanks.

You should be able to use the appropriate DBA view instead of the V$ views. This will give you a much better SQL structure:

SELECT
tablespace_name as TS,
substr(file_name,1,21) as FS,
count(*)
from dba_data_files
group by 1,2;

Cheers
Nuno Souto
wizofoz2k_at_yahoo.com.au.nospam Received on Thu Feb 05 2004 - 18:46:22 CST

Original text of this message

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