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?
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 |
Illustrate how to determine the amount of physical CPUs a Unix Box possesses (LINUX and/or Solaris).
Name two files used for network connection to a database.
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?
Explain the difference between a FUNCTION, PROCEDURE and PACKAGE.
Due to some maintenance being done, the sql server on a failover cluster needs to be brought down. How do you bring the sql server down? : sql server DBA
how do we explain a project in cognos in an interview? please help me. Also how do we perform testing in cognos after creating reports?
wat is global index and local indes
what is the use of home directory???
How many memory layers are in the shared pool?
if monday take full backup and tuesday it was cumulative backup and wednesday we taken incremental backup, thursday some disaster happen then what type of recovery and how it will take?
what is meant by gateway
What are the steps you will take, if you are tasked with securing an SQL Server?