|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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!!! .
__________________
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Cursor related query. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|