Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Use commit in procedure or not

Shadow123Oct 22 2015 — edited Oct 22 2015

Oracle database 10g

Hi All

I appreciate if someone advice me.

I have the following trigger

Sample trigger

CREATE OR REPLACE

TRIGGER t_p_chk

BEFORE INSERT OR UPDATE ON hear

  FOR EACH ROW

BEGIN

  IF INSERTING THEN

  p_chk_hear('insert',:NEW.HEAR_CD,:new.c_id);

  ELSE

  p_chk_hear('update',:NEW.HEAR_CD,:new.c_id);

  END IF;

END;

/

Procedure

PROCEDURE p_chk_hear(p_action VARCHAR2,p_hear_cd VARCHAR2,p_c_id NUMBER) IS

  l_cnt NUMBER(1);

BEGIN

  IF p_hear_cd='LOJ' THEN

  UPDATE jen.cas

  SET bal_amt       =0,

  vcost_bal_amt    =0,

  c_bal_amt     =0

  WHERE c_id=p_c_id;

  END IF;

commit;

exception

  WHEN no_data_found THEN

  NULL;

END;

/

My question is that do I need to put commit (see in red text) in my procedure or not.

We are using oracle forms 10 g and all insertion is done through forms.

Regards

Mit

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2015
Added on Oct 22 2015
13 comments
1,619 views