Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 25th, 2008, 04:09 AM
goodboy1808 goodboy1808 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2008
Posts: 2 goodboy1808 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 44 m 48 sec
Reputation Power: 0
Cursor related query.

Hello,

I have a difficulty with cursor. It might be really trivial, but I am unable to find it out. My cursor goes like this:

Cursor mk IS
select b.td, b.a_id as b_a_id, b.agt_id, b.nt_mk, nvl(a.a_id, b.a_id) a_a_id, nvl(a.total_mm, 0) total_mm from
(
select det.td, det.agt_id, det.a_id, sum(nt_mk) nt_mk
from
(
select * from b
)det
group by det.td, det.agt_id, det.a_id
) b
full outer join
(
select * from
(
select a.td, a.a_id, sum(total_mm) total_mm
from
(
select * from a
)det
group by det.td, det.a_id
) where a_id = (select a_id from acc_a where acc = p_acc)
) a
on
b.td = a.td
and b.a_id = a.a_id;

Now, when I run the cursor query from editor, it runs fine. When I compile the cursor in a package, it compiles fine. But when I try to run it from editor, it gives me error msg:

ORA-00923: FROM keyword not found where expected at the line next to Cursor declaration (Bold line)

I am not understanding whats causing the issue. Can someone please help me out.

Thanks in advance.

Reply With Quote
  #2  
Old November 26th, 2008, 09:19 AM
LKBrwn_DBA's Avatar
LKBrwn_DBA LKBrwn_DBA is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 454 LKBrwn_DBA User rank is First Lieutenant (10000 - 20000 Reputation Level)LKBrwn_DBA User rank is First Lieutenant (10000 - 20000 Reputation Level)LKBrwn_DBA User rank is First Lieutenant (10000 - 20000 Reputation Level)LKBrwn_DBA User rank is First Lieutenant (10000 - 20000 Reputation Level)LKBrwn_DBA User rank is First Lieutenant (10000 - 20000 Reputation Level)LKBrwn_DBA User rank is First Lieutenant (10000 - 20000 Reputation Level)LKBrwn_DBA User rank is First Lieutenant (10000 - 20000 Reputation Level)LKBrwn_DBA User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 4 Days 26 m 46 sec
Reputation Power: 104
Talking Eliminate *

Maybe you could eliminate all the 'SELECT * FROM":
Code:
SELECT b.td, b.a_id AS b_a_id, b.agt_id, b.nt_mk, NVL (a.a_id, b.a_id) a_a_id,
       NVL (a.total_mm, 0) total_mm
  FROM (SELECT   det.td, det.agt_id, det.a_id, SUM (nt_mk) nt_mk
            FROM b det
        GROUP BY det.td, det.agt_id, det.a_id) b
       FULL OUTER JOIN :chomp:  a_id
                           FROM acc_a
                          WHERE acc = p_acc)
        GROUP BY det.td, det.a_id) a
       ON b.td = a.td AND b.a_id = a.a_id
       ;



PS: Format your code!!!
.
__________________

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Cursor related query.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT