473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

with clause for subquery factoring

Hi,

The following does not return result:

with free_space_by_tablespace as
( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name
select * from free_space_by_tablespace ;

BUT this does:
select * from (with free_space_by_tablespace as
( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name
select * from free_space_by_tablespace
)
What is wrong with my query?

This occurs in Sql/plus and SQL navigator v4.4.5. In MS ACCESS pass
through query, I also got the no records returned warning.

Is it due to the version problem on my client software? My Oracle
server is 9.2 and above

Thanks for any points on this.

Jul 19 '05 #1
2 9054
we**********@yahoo.com wrote:
Hi,

The following does not return result:

with free_space_by_tablespace as
( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name
select * from free_space_by_tablespace ;

BUT this does:
select * from (with free_space_by_tablespace as
( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name
select * from free_space_by_tablespace
)
What is wrong with my query?

This occurs in Sql/plus and SQL navigator v4.4.5. In MS ACCESS pass
through query, I also got the no records returned warning.

Is it due to the version problem on my client software? My Oracle
server is 9.2 and above

Thanks for any points on this.


Missing parenthesis from first version?

or******@binc04.tree> with free_space_by_tablespace as
2 ( select sum(bytes)/1024 Kbytes_free,
3 max(bytes)/1024 largest,
4 tablespace_name
5 from sys.dba_free_space
6 group by tablespace_name
7 select * from free_space_by_tablespace ;
select * from free_space_by_tablespace
*
ERROR at line 7:
ORA-00907: missing right parenthesis

or******@binc04.tree> list
1 with free_space_by_tablespace as
2 ( select sum(bytes)/1024 Kbytes_free,
3 max(bytes)/1024 largest,
4 tablespace_name
5 from sys.dba_free_space
6 group by tablespace_name)
7* select * from free_space_by_tablespace
or******@binc04.tree> /

KBYTES_FREE LARGEST TABLESPACE_NAME
----------- ---------- ------------------------------
51136 51136 LOBS
768 768 MONITOR
16320 10944 SYSAUX
96512 96192 SYSTEM
153408 51136 TESTDB_A
142912 98240 UNDO01
51136 51136 USER01
34752 34752 XDB

8 rows selected.

-Mark Bole

Jul 19 '05 #2
Thanks Mark.

After I upgrade my oracle client from 8.1.17 to 9.2 then it works.
Hope this is useful for other person

Mark Bole wrote:
we**********@yahoo.com wrote:
Hi,

The following does not return result:

with free_space_by_tablespace as
( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name
select * from free_space_by_tablespace ;

BUT this does:
select * from (with free_space_by_tablespace as
( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name
select * from free_space_by_tablespace
)
What is wrong with my query?

This occurs in Sql/plus and SQL navigator v4.4.5. In MS ACCESS pass
through query, I also got the no records returned warning.

Is it due to the version problem on my client software? My Oracle
server is 9.2 and above

Thanks for any points on this.


Missing parenthesis from first version?

or******@binc04.tree> with free_space_by_tablespace as
2 ( select sum(bytes)/1024 Kbytes_free,
3 max(bytes)/1024 largest,
4 tablespace_name
5 from sys.dba_free_space
6 group by tablespace_name
7 select * from free_space_by_tablespace ;
select * from free_space_by_tablespace
*
ERROR at line 7:
ORA-00907: missing right parenthesis

or******@binc04.tree> list
1 with free_space_by_tablespace as
2 ( select sum(bytes)/1024 Kbytes_free,
3 max(bytes)/1024 largest,
4 tablespace_name
5 from sys.dba_free_space
6 group by tablespace_name)
7* select * from free_space_by_tablespace
or******@binc04.tree> /

KBYTES_FREE LARGEST TABLESPACE_NAME
----------- ---------- ------------------------------
51136 51136 LOBS
768 768 MONITOR
16320 10944 SYSAUX
96512 96192 SYSTEM
153408 51136 TESTDB_A
142912 98240 UNDO01
51136 51136 USER01
34752 34752 XDB

8 rows selected.

-Mark Bole


Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bob Stearns | last post by:
When I run the following query with the two sections commented out, the response time is between 1 an 2 seconds; with the first indicated section enabled, the response goes up to 15 seconds even...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
18
by: ChadDiesel | last post by:
I appreciate the help on this group. I know I've posted a lot here the last couple of weeks, but I was thrown into a database project at my work with very little Access experience. No other...
21
by: mollyf | last post by:
I'm creating a query, which I want to use in code in my VB.NET app. This query produces the correct results when executed in Access: SELECT tblEncounters.EncounterBeginDT, Query11.RID,...
4
by: Sebastian Böck | last post by:
Hello all, i have a view defined as a simple select of a table. This table is inherited by a couple of others. All entries belong to the child-tables. I also have an unconditional update rule...
5
by: No bother | last post by:
I am using 5.0.26-NT on Windows 2000. I have need to use a reference in the outer from clause in a subquery in the select clause. Consider the following example: Select (select b.baitID from...
5
by: Anne | last post by:
Hello! Here is the statement in question: --STATEMENT A SELECT * FROM dbo.myTable WHERE colX in (SELECT colX FROM dbo.sourceTable) The problem with Statement A is that 'colX' does not exist...
1
by: jcf378 | last post by:
Hi all-- Does anyone have any insight as to how I might create a search form that allows a user to select criteria based on any related table in the whole database. The search form I have now only...
2
by: web_poster03 | last post by:
Hi, The following does not return result: with free_space_by_tablespace as ( select sum(bytes)/1024 Kbytes_free, max(bytes)/1024 largest, tablespace_name from sys.dba_free_space group by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.