Forum Stats

  • 3,876,200 Users
  • 2,267,081 Discussions
  • 7,912,467 Comments

Discussions

After Update triggger not fired after update query from PHP

adhiahmad
adhiahmad Member Posts: 2
edited May 19, 2014 6:48PM in PHP

Please help, I have an after update trigger in my oracle xe 11gr2..

The trigger is working perfectly if I did update from SQLPLUS..

Here the trigger:

create or replace

TRIGGER "PENDTRIG"

after update on PENDUDUK

for each row

declare

pragma autonomous_transaction;

BEGIN

INSERT INTO PENDTEMP VALUES (:OLD.NIK,:NEW.NAMA,:NEW.TEMPATLAHIR,

:NEW.TGLLAHIR,:NEW.PROVINSI,:NEW.KOTAKAB,:NEW.KECAMATAN,

:NEW.KELDESA,:NEW.RW,:NEW.RT,:NEW.ALAMAT,:NEW.JENKELAMIN,:NEW.GOLDARAH,

:NEW.AGAMA,:NEW.STATPERNIKAHAN,:NEW.PEKERJAAN,:NEW.KEWARGANEGARAAN,'update');

COMMIT;

END;

But I have a problem, when I did a query update from PHP for something like this:

<?php

date_default_timezone_set('Asia/Jakarta');

include ("oraconn.php");

$update = "update PENDUDUK set NAMA = 'Adhi' where NIK = 3273032502910001";

$statement = oci_parse($c, $update);

oci_execute($statement,OCI_NO_AUTO_COMMIT);

$committed = oci_commit ($c);

  if (!$committed) {

    echo "Proses input gagal!";

  }

?>

The table updated, but the trigger is not fired.. What should I do? Please help!

Tagged:

Answers

This discussion has been closed.