Home » SQL & PL/SQL » SQL & PL/SQL » ORA-00942 Errors (merged 3)
ORA-00942 Errors (merged 3) [message #382038] Tue, 20 January 2009 14:03 Go to next message
mahatab
Messages: 98
Registered: January 2008
Location: Dhaka
Member

Hi,
I am having serious trouble, though i know the meaning of such errors, yet not finding the solution i needed the most. I have checked it again and again but no such errors i have discovered yet. So i guess i have got something wrong in my trigger code, So will you please take a look at my code and send me a hints to work with.

CREATE OR REPLACE TRIGGER "DO_DCMBL".FFF_ACHIEVE_Tr AFTER
    INSERT
    ON Master_Sales_Tbl
    FOR EACH ROW
BEGIN
  IF INSERTING THEN
declare
 emp_id varchar2(20);
 percentage number(10,2);
begin
 select emp_id, percentage into emp_id, percentage from field_force_tbl
 where :master_sales.party_code=field_force_tbl.distributor_id;
    UPDATE Do_Dcmbl.FIELD_Achievement_Tbl
     SET Achieved_Qty_Monthly =
  nvl(Achieved_Qty_Monthly,0) + (:New.product_quantity*percentage/100), 
Achieved_Amt_Monthly = 
  nvl(Achieved_Amt_Monthly,0) + (:New.Sales_amount*percentage/100)
      WHERE  FIELD_Achievement_Tbl.product_Code =:New.product_Code AND
 FIELD_Achievement_Tbl.emp_id=field_force_tbl.emp_id AND
 FIELD_Achievement_Tbl.DISTRIBUTOR_code=:New.DISTRIBUTOR_CODE AND
 FIELD_Achievement_Tbl.MONTH_ID=:New.MONTH_ID AND
 FIELD_Achievement_Tbl.TARGET_YEAR=:New.YEAR;

  END IF;
  END;

END;
/

[Updated on: Tue, 20 January 2009 14:22] by Moderator

Report message to a moderator

Re: ORA-00942 Errors [message #382040 is a reply to message #382038] Tue, 20 January 2009 14:07 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you & please be consistent & correct in your postings.

ERROR? What Error? I don't see any error.

Privs acquired via ROLE do not apply within PL/SQL procedures.
Re: ORA-00942 Errors [message #382042 is a reply to message #382038] Tue, 20 January 2009 14:10 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Do NOT cross/multi-post!
Re: ORA-00942 Errors (merged 3) [message #382044 is a reply to message #382038] Tue, 20 January 2009 14:22 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
And keep your lines in 80 character width.

Regards
Michel
Re: ORA-00942 Errors (merged 3) [message #382048 is a reply to message #382038] Tue, 20 January 2009 14:47 Go to previous messageGo to next message
mahatab
Messages: 98
Registered: January 2008
Location: Dhaka
Member

Thanks for the reply next time i will be more watchful. Table or view does not exist-this is the error i am getting but i have checked it again and again but all the table name i used is in the db what to do next. Is there any other mistakes i have made?
Re: ORA-00942 Errors (merged 3) [message #382050 is a reply to message #382048] Tue, 20 January 2009 14:50 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Use SQL*Plus and copy and paste your session.

Regards
Michel
Re: ORA-00942 Errors (merged 3) [message #382052 is a reply to message #382038] Tue, 20 January 2009 14:55 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
When a procedure owned by SCHEMA accesses an object owned by SCHEMAB, it can result in ORA-00942 error when no GRANT has been issued.

Privs acquired via ROLE do not apply within PL/SQL procedures.
Previous Topic: I am getting Primary key vialotion error
Next Topic: Query help for adding columns (merged)
Goto Forum:
  


Current Time: Sat Dec 14 16:27:59 CST 2024