Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Oracle/PHP Question

Re: Oracle/PHP Question

From: John Montgomery <j.t.montgomeryNOj.SPAM_at_norcol.ac.uk.invalid>
Date: 2000/04/21
Message-ID: <043b911a.0eacf502@usw-ex0103-086.remarq.com>#1/1

I've just been working on the "auto" aspect - a trigger. matbe this example will help you a bit? I just cut'n'paste the bits into PL/SQL. An an insert thereafter behaves properly.

drop table english_month_names;
drop sequence seq_english_month_names;
drop trigger english_month_names_trigger;

create table english_month_names(

        k_english_month_names number default 0 not null primary key

,dt_create varchar2(40)
,dt_updated varchar2(40)
,flg_deleted NUMBER default 0
,str_month_name VARCHAR2(50) not null

        );

create sequence seq_english_month_names

	increment by 1
	start with 1
	nomaxvalue;

CREATE TRIGGER english_month_names_trigger before INSERT ON english_month_names
for each row
declare

	temp_var number;
	temp_dt varchar2(40);
  Begin
  	select seq_english_month_names.NEXTVAL into temp_var
from dual;
  	select to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') into
temp_dt from dual;
  	:new.k_english_month_names := temp_var;
  	:new.dt_create := temp_dt;
  	:new.dt_updated := temp_dt;
  	:new.flg_deleted := 0;

end; Received on Fri Apr 21 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US