| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> "ORA-00905: missing keyword" when tuning the sql statement using join
The following query yields the correct result, but the performance
is extremely poor. When I run the explain plan in TOAD, it costs 167560
and it performs the full table scan on (SELECT MAX ...) statement.
I try to tune the sql statement using join, but I got the error "ORA-00905: missing keyword" on clause "AND p.company_seq_no = c.company_seq_no".
I have no idea what's going on, please advise what is the best approach to tune the original SQL.
ORIGINAL SQL
FROM p_permit p,
p_company c,
p_vrf_details vda
WHERE p.permit_seq_no = '1001'
AND p.company_seq_no = c.company_seq_no
AND c.ref_id = vda.ref_id
FROM p_vrf_details vdb
WHERE ref_id = vda.ref_id
AND finance_no = vda.finance_no
AND vrf_type = vda.vrf_type
AND vrf_level = vda.vrf_level
AND pstg_stmt_seq_no is not null
)
UPDATED SQL
FROM p_permit p,
p_company c,
p_vrf_details vda
AND p.company_seq_no = c.company_seq_no
AND c.ref_id = vda.ref_id
AND p.finance_no = vda.finance_no
AND vda.vrf_type IN ('M','P')
AND vda.activity_date = MAX(vdb.activity_date)
AND vda.finance_no = vdb.finance_no
Please advise. Thanks a lot!! Received on Thu Oct 06 2005 - 13:10:30 CDT
![]() |
![]() |