dbTalk Databases Forums  

How to use the WITH clause

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss How to use the WITH clause in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kin Ng
 
Posts: n/a

Default How to use the WITH clause - 07-09-2003 , 08:14 PM






Can someone tell me what's wrong with my use of the WITH clause?

with summary as
(
select brand_code from tblmasters where created_by < sysdate
)
select brand_code from summary

I kept getting "SQL statement doesn't return rows" error.

Thanks

Reply With Quote
  #2  
Old   
Anurag Varma
 
Posts: n/a

Default Re: How to use the WITH clause - 07-09-2003 , 10:03 PM







"Kin Ng" <kin_ng5 (AT) yahoo (DOT) com> wrote

Quote:
Can someone tell me what's wrong with my use of the WITH clause?

with summary as
(
select brand_code from tblmasters where created_by < sysdate
)
select brand_code from summary

I kept getting "SQL statement doesn't return rows" error.

Thanks
nothing wrong with the clause. Though you seem to be using it unnecessarily.
What is the *exact* error you are getting.
btw: are you getting "no rows selected" .. which is not an error.

Anurag




Reply With Quote
  #3  
Old   
Kin Ng
 
Posts: n/a

Default Re: How to use the WITH clause - 07-10-2003 , 11:41 AM



"Anurag Varma" <avdbi (AT) hotmail (DOT) com> wrote

Quote:
"Kin Ng" <kin_ng5 (AT) yahoo (DOT) com> wrote

Can someone tell me what's wrong with my use of the WITH clause?

with summary as
(
select brand_code from tblmasters where created_by < sysdate
)
select brand_code from summary

I kept getting "SQL statement doesn't return rows" error.

Thanks

nothing wrong with the clause. Though you seem to be using it unnecessarily.
What is the *exact* error you are getting.
btw: are you getting "no rows selected" .. which is not an error.

Anurag
Anurag,

The statement is a test to see if WITH will work. I used Toad and I
got that "SQL statement doesn't return rows" error from a Pop Up
dialog box. If I used SQL Plus, I got this:

SQL> WITH summary AS
SP2-0734: unknown command beginning "WITH summa..." - rest of line
ignored.
SQL>

Here's my SQL Plus and DB version Info:

SQL*Plus: Release 8.1.7.0.0 - Production on Wed Jul 9 17:25:20 2003

(c) Copyright 2000 Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.3.0 - Production


Reply With Quote
  #4  
Old   
Anurag Varma
 
Posts: n/a

Default Re: How to use the WITH clause - 07-10-2003 , 07:07 PM




"Kin Ng" <kin_ng5 (AT) yahoo (DOT) com> wrote

Quote:
"Anurag Varma" <avdbi (AT) hotmail (DOT) com> wrote

"Kin Ng" <kin_ng5 (AT) yahoo (DOT) com> wrote

Can someone tell me what's wrong with my use of the WITH clause?

with summary as
(
select brand_code from tblmasters where created_by < sysdate
)
select brand_code from summary

I kept getting "SQL statement doesn't return rows" error.

Thanks

nothing wrong with the clause. Though you seem to be using it unnecessarily.
What is the *exact* error you are getting.
btw: are you getting "no rows selected" .. which is not an error.

Anurag

Anurag,

The statement is a test to see if WITH will work. I used Toad and I
got that "SQL statement doesn't return rows" error from a Pop Up
dialog box. If I used SQL Plus, I got this:

SQL> WITH summary AS
SP2-0734: unknown command beginning "WITH summa..." - rest of line
ignored.
SQL

Here's my SQL Plus and DB version Info:

SQL*Plus: Release 8.1.7.0.0 - Production on Wed Jul 9 17:25:20 2003

(c) Copyright 2000 Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.3.0 - Production
Not sure . My guess:
* Try using a 9i client.
* Check the compatible parameter .. it should be set to at least 9.0.0.1

Anurag




Reply With Quote
  #5  
Old   
Kin Ng
 
Posts: n/a

Default Re: How to use the WITH clause - 07-12-2003 , 02:09 PM



"Anurag Varma" <avdbi (AT) hotmail (DOT) com> wrote

Quote:
"Kin Ng" <kin_ng5 (AT) yahoo (DOT) com> wrote

"Anurag Varma" <avdbi (AT) hotmail (DOT) com> wrote

"Kin Ng" <kin_ng5 (AT) yahoo (DOT) com> wrote

Can someone tell me what's wrong with my use of the WITH clause?

with summary as
(
select brand_code from tblmasters where created_by < sysdate
)
select brand_code from summary

I kept getting "SQL statement doesn't return rows" error.

Thanks

nothing wrong with the clause. Though you seem to be using it unnecessarily.
What is the *exact* error you are getting.
btw: are you getting "no rows selected" .. which is not an error.

Anurag

Anurag,

The statement is a test to see if WITH will work. I used Toad and I
got that "SQL statement doesn't return rows" error from a Pop Up
dialog box. If I used SQL Plus, I got this:

SQL> WITH summary AS
SP2-0734: unknown command beginning "WITH summa..." - rest of line
ignored.
SQL

Here's my SQL Plus and DB version Info:

SQL*Plus: Release 8.1.7.0.0 - Production on Wed Jul 9 17:25:20 2003

(c) Copyright 2000 Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.3.0 - Production

Not sure . My guess:
* Try using a 9i client.
* Check the compatible parameter .. it should be set to at least 9.0.0.1

Anurag

It works using 9i client. Thanks


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.