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

Where in the Oracle directory tree structure are audit traces placed?

1 Answers  


what is logical system in sap basis

0 Answers  


I lost one datafile i dont have backup how can you recover that???

2 Answers   HP,


what do you understand by flashback feature of oracle?

0 Answers   Oracle,


What is RAID and what are different types of RAID configurations?

1 Answers  






what is a crs resource?

0 Answers   Oracle,


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

0 Answers  


When a user process fails, what background process cleans up after it?

1 Answers  


Q. How to set ORACLE_HOME to my oracle software directory. Hi Friend I am installing oracle 10g Express Edition on Linux Fedora Core 6. Installation is success but when i run #sqlplus I getting command not found error. Then I have search sqlplus .i.e # find / -name sqlplus /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplus /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/sqlplus These above output from find i have doubt which is correct path of sqlplus. So doubtfully i have set path 1st one.i.e # PATH=$PATH:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin Then I have run #sqlplus but still i have problem following Error 6 initializing SQL*Plus Message file sp1<lang>.msb not found SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory How overcome this please answer m???

1 Answers  


What do the 9i dbms_standard.sql_txt() and dbms_standard.sql_text() procedures do?

0 Answers  


How does propagation differ between Advanced Replication and Snapshot Replication (read-only)?

0 Answers  


how can you implement fine-grained auditing?

0 Answers   Oracle,


Categories