CREATE OR REPLACE TRIGGER input_mileages_after_insert AFTER
INSERT ON emora.wm_point
FOR EACH ROW
DECLARE
t_no NUMBER;
BEGIN
SELECT MAX(no)+1
INTO t_no
FROM mileages;
INSERT INTO mileages
(no, mem_id, code, mileage, reg_date, last_date, conn_key, status, ip, description )
VALUES (
t_no,
:new.customerid,
'4',
:new.point,
:new.in_date,
:new.in_date,
:new.metasessionid,
'R',
'trigger',
:new.description);
END;
/
이렇게..하니깐..되네요.. (*^^*)
좋은하루되세용...
>>양승민 님께서 쓰시길<<
:: CREATE OR REPLACE TRIGGER input_mileages_after_insert AFTER
:: INSERT ON emora.wm_point
:: FOR EACH ROW
:: BEGIN
::
:: insert into mileages (no,mem_id, code, mileage, reg_date,last_date, conn_key, status, ip, desc
:: ription ) values (
:: (select max(no) from mileages) + 1,
:: :new.customerid,
:: '4',
:: :new.point,
:: :new.in_date,
:: :new.in_date,
:: :new.metasessionid,
:: 'R',
:: 'trigger',
:: :new.description);
::
:: END;
:: /
::
:: 위에서와 같이 no 의 가장 큰 값을 가져와 하나증가하여 삽입을 하려고
:: 합니다.
:: 근데 아래와 같은 에러가 발생합니다.
::
:: SQL> show error
:: TRIGGER INPUT_MILEAGES_AFTER_INSERT에 대한 오류:
::
:: LINE/COL ERROR
:: -------- -----------------------------------------------------------------
:: 4/5 PLS-00103: Encountered the symbol "SELECT" when expecting one of
:: the following:
:: ( - + mod not null others <an identifier>
:: <a double-quoted delimited-identifier> <a bind variable> avg
:: count current exists max min prior sql stddev sum variance
:: execute cast trim forall
:: <a string literal with character set specification>
:: <a number> <a single-quoted SQL string>
::
:: 4/35 PLS-00103: Encountered the symbol "+" when expecting one of the
:: following:
:: <an identifier> <a double-quoted delimited-identifier> set
::
:: 13/20 PLS-00103: Encountered the symbol ")" when expecting one of the
:: following:
:: . ( , * @ % & - + / mod rem <an identifier>
:: <a double-quoted delimited-identifier> an exponent (**) as
:: into || indicator bulk
::
:: 부탁드립니다.
|