Home » SQL & PL/SQL » SQL & PL/SQL » insert query results into a table
insert query results into a table [message #321482] Tue, 20 May 2008 07:14 Go to next message
sdhanuka
Messages: 173
Registered: March 2008
Senior Member
hey,

I have the following query


select to_char(sysdate,'DD-MM-YYY HH24:MI:SS'),
        a.tablespace_name ,
        tbsize  ,
        tbfree ,
        b.tbfree/a.tbsize*100 "ratio" ,
         b.Largest "Largest space"
from
        ( select tablespace_name,sum(bytes)/1024/1024 tbsize
                from dba_data_files
                group by tablespace_name) a,
        ( select tablespace_name,sum(bytes)/1024/1024 tbfree,
                 max(bytes)/1024/1024 Largest
                from dba_free_space
                group by tablespace_name) b
where a.tablespace_name=b.tablespace_name
order by 4  ;


I need to insert the result of this query into a table.

What would be that table definition?

This above script i will put on a scheduler which run and populate the table.

Thanks
Re: insert query results into a table [message #321484 is a reply to message #321482] Tue, 20 May 2008 07:19 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
Do a CTAS (Create Table as) statement on your mentioned and see for yourself.

Regards

Raj

[Updated on: Tue, 20 May 2008 07:19]

Report message to a moderator

Re: insert query results into a table [message #321485 is a reply to message #321484] Tue, 20 May 2008 07:22 Go to previous messageGo to next message
sdhanuka
Messages: 173
Registered: March 2008
Senior Member
Raj i have done that before it gives me errors.
ORA-00903
Re: insert query results into a table [message #321486 is a reply to message #321485] Tue, 20 May 2008 07:27 Go to previous message
sdhanuka
Messages: 173
Registered: March 2008
Senior Member
ok got it. syntax error

Thanks
Previous Topic: Assign column Value to another variable
Next Topic: update query
Goto Forum:
  


Current Time: Tue Feb 11 03:42:41 CST 2025