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 |
how can you connect from 10g user to 11g user??
How do you recover a datafile that has not been physically been backed up since its creation and has been deleted. Provide syntax example.
How many packages we have in db
How can we know the exact updation date of a particular database?
Why does Oracle not permit the use of PCTUSED with indexes?
Which environment variables are absolutely critical in order to run the OUI?
What authentication modes does sql server support? : sql server DBA
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?
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?
What is the difference between LMT & DLT?
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???
What are the different types of database compression introduced in sql server 2008? : sql server DBA