database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
ㆍOracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Oracle Q&A 4049 게시물 읽기
No. 4049
Re: [트리거] select 한 값을 insert 시키기 (*TT*)
작성자
양승민
작성일
2001-05-07 11:39
조회수
6,611

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

::

:: 부탁드립니다.

[Top]
No.
제목
작성자
작성일
조회
4052새로만든 우편번호 테이블에 .. 기존의 데이타를 넣을라고 하는데요.
정창주
2001-05-07
1945
4055┕>Re: 새로만든 우편번호 테이블에 .. 기존의 데이타를 넣을라고 하는데요.
초보 오라
2001-05-07 14:39:23
1812
4073 ┕>감사합니다.. 낭중에 또 모르면 질문올리겠습니다.. ^^ 그럼 (__) 수고하세요.
정창주
2001-05-07 21:26:50
1365
4051오라클 백업관련 (알맨) 설치관련
이호현
2001-05-07
2002
4080┕>Re: 오라클 백업관련 (알맨) 설치관련
firebird
2001-05-08 02:06:33
2060
4048[급함]Oracle 7.3.4 Install시 Error--OS 에러.....
이종범
2001-05-07
1641
4076┕>Re: [급함]Oracle 7.3.4 Install시 Error--OS 에러.....
firebird
2001-05-08 01:04:23
2095
4044[트리거] select 한 값을 insert 시키기 (*TT*)
양승민
2001-05-07
2676
4049┕>Re: [트리거] select 한 값을 insert 시키기 (*TT*)
양승민
2001-05-07 11:39:38
6611
4036오라클 클라이언트 접속시 TNS에러가 납니다. 도와주세요!
김철균
2001-05-07
2754
4038┕>Re: 오라클 클라이언트 접속시 TNS에러가 납니다. 도와주세요!
aaa
2001-05-07 09:48:34
2799
4039 ┕>Re: Re: 오라클 클라이언트 접속시 TNS에러가 납니다. 도와주세요!
herrchen
2001-05-07 10:13:00
4459
4045┕>Re: 오라클 클라이언트 접속시 TNS에러가 납니다. 도와주세요!
coupleiwth
2001-05-07 10:58:34
1888
4050┕>Re: 문제 해결했습니다! 답변 주신분들 정말 감사드립니다.
김철균
2001-05-07 11:42:30
1798
4053┕>Re: 오라클 클라이언트 접속시 TNS에러가 납니다. 도와주세요!
aaa
2001-05-07 13:38:39
2281
4034Transaction 처리에 대해서
Guideposts
2001-05-07
1454
4074┕>Re: Transaction 처리에 대해서
소몰이
2001-05-07 21:57:54
2088
4033외부에서 오라클 서버 접속
이재성1
2001-05-07
1401
4060┕>Re: 외부에서 오라클 서버 접속
최성준
2001-05-07 15:43:07
2563
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.018초, 이곳 서비스는
	PostgreSQL v16.4로 자료를 관리합니다