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

how can you connect from 10g user to 11g user??

0 Answers   HP,


How do you recover a datafile that has not been physically been backed up since its creation and has been deleted. Provide syntax example.

4 Answers  


How many packages we have in db

1 Answers   Tesco,


How can we know the exact updation date of a particular database?

2 Answers   Satyam,


Why does Oracle not permit the use of PCTUSED with indexes?

0 Answers  


Which environment variables are absolutely critical in order to run the OUI?

2 Answers  


What authentication modes does sql server support? : sql server DBA

0 Answers  


Which types of backups you can take in Oracle? 2. A database is running in NOARCHIVELOG mode then which type of backups you can take? 3. Can you take partial backups if the Database is running in NOARCHIVELOG mode?

1 Answers  


How can you tell how much space is left on a given file system and how much space each of the file system's subdirectories take-up?

0 Answers  


What is the difference between LMT & DLT?

1 Answers   CTS,


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 are the different types of database compression introduced in sql server 2008? : sql server DBA

0 Answers  


Categories