Triggers and Procedures

Hi All

i would like to know how to change a procedure (or routine) into a trigger?

Currently i have a procedure that works when there is an insertion of data during a specific time.... how do i change it into a trigger so that whenever my java application run every 5 sec in a loop, and the trigger table will be triggered.

Can someone point me to a step-by-step tutorial? As this is the 1st time i heard of such things

Thanks in advance~

[469 byte] By [peachteaa] at [2007-11-27 6:48:17]
# 1

btw i have roughly try it out on my own and i got an error msg "Missing IN or OUT parameter at index: 1"

Will be much appreciated if someone can help

The codes that i've tried is this:

CREATE TRIGGER "ITRADESYS"."PARTIAL_TRADE_ALERT_TRIGGER" AFTER

INSERT

OR UPDATE ON "ITRADESYS"."ORD_MST" FOR EACH ROW DECLARE

dup_count CHAR(4);

BEGIN

IF updating and (:p_order.ORD_STATUS = 5) then

SELECT Count(*) INTO dup_count from PARTIAL_TRADE_ALERT_TRIGGER where REF_NO=p_order.REF_NO;

IF (dup_count <= 0 ) THEN

INSERT INTO PARTIAL_TRADE_ALERT_TRIGGER

(TRADE_DT,REF_NO,ORD_NO)

VALUES

(p_order.TRADE_DT, p_order.REF_NO, p_order.ORD_NO),

ELSE

UPDATE PARTIAL_TRADE_ALERT_TRIGGER set

TRADE_DT=p_order.TRADE_DT,

REF_NO=p_order.REF_NO,

ORD_NO=p_order.ORD_NO

where REF_NO = p_order.REF_NO;

END IF;

END LOOP;

COMMIT;

END;

peachteaa at 2007-7-12 18:21:34 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

IN or OUT paramaters are required for Procudures and not for triggers.

While writing trigger or proc start small

First compile only the scleton of the OBJ

Then increase the thing in steps

like first try to insert same value everytime and then increase it again

you geta lot of resources on-line

alvandipa at 2007-7-12 18:21:34 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...