I want to reuse a piece of code inside a stored procedure.
This piece of code need to be invoked multiple times inside
the procedure based on some different conditions. How to
achieve this?



I want to reuse a piece of code inside a stored procedure. This piece of code need to be invoked m..

Answer / mohapatra.gouranga@gmail.com

Best answer is:
SELECT df.tablespace_name "Tablespace",
df.bytes / (1024 * 1024) "Size (MB)",
SUM(fs.bytes) / (1024 * 1024) "Free (MB)",
Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "%
Free",
Round((df.bytes - SUM(fs.bytes)) * 100 /
df.bytes) "% Used"
FROM dba_free_space fs,
(SELECT tablespace_name,SUM(bytes) bytes
FROM dba_data_files
GROUP BY tablespace_name) df
WHERE fs.tablespace_name (+) = df.tablespace_name
GROUP BY df.tablespace_name,df.bytes
UNION ALL
SELECT df.tablespace_name tspace,
fs.bytes / (1024 * 1024),
SUM(df.bytes_free) / (1024 * 1024),
Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 /
fs.bytes), 1),
Round((SUM(fs.bytes) - df.bytes_free) * 100 /
fs.bytes)
FROM dba_temp_files fs,
(SELECT tablespace_name,bytes_free,bytes_used
FROM v$temp_space_header
GROUP BY tablespace_name,bytes_free,bytes_used) df
WHERE fs.tablespace_name (+) = df.tablespace_name
GROUP BY
df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_used
ORDER BY 4 DESC;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB Administration Interview Questions

Explain the difference between ARCHIVELOG mode and NOARCHIVELOG mode and the benefits and disadvantages to each.

5 Answers  


What are the new features in sql server 2005 when compared to sql server 2000? : sql server DBA

0 Answers  


1)how to Take Backup in sql server 2005 from Flash Drive

1 Answers  


can u plz tell me what r the mandatory skills for getting job as a sql dba......plz send me all details thank you my id :k.mohann.mohan@gmail.com

0 Answers  


How would you go about verifying the network name that the local_listener is currently using?

0 Answers  






What the different components in replication and what is their use? : sql server DBA

0 Answers  


any body know about orawaves do they really provide placements in their unique placement program

1 Answers   TCS,


how can a session indicate its interest in receiving alerts?

0 Answers   Oracle,


Explain the difference between a data block, an extent and a segment.

2 Answers  


Name three advisory statistics you can collect.

1 Answers  


If you are given access to a sql server, how do you find if the sql instance is a named instance or a default instance? : sql server DBA

0 Answers  


i have 10gp file.now i need store in database..but database have only 7gb memory only..how do u store the file ?

0 Answers   IBM,


Categories