In Oracle, we use triggers along with sequences.  So, instead of
querying the next sequence number from the table, then doing an insert
using the number just retrieved inside the CF code, we would have the
trigger do it.  That way the database does the work.

Trigger:
CREATE OR REPLACE TRIGGER TRG_BI_MYTABLE" BEFORE INSERT ON MYTABLE FOR EACH ROW 
BEGIN
   SELECT SEQ_MYTABLE.NEXTVAL INTO
  :NEW.ID FROM DUAL;
END;


We do the same with dates/times when we want the time stamp to match
the database time.

Mike Ferris
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to