트리거를 사용하여 트리거를 삽입하려고합니다. 나는 2 개의 테이블이 togather Question and Paper에 연결되어있다. 질문이 열 (question_id 기본 키, correct_answer의 VARCHAR)를 가지고 있는데이 값 질문 값에SQLite 트리거가 작동하지 않습니다.
삽입 삽입 한 (1, "B")
용지이 열 (Question_id 외래 키, student_answer의 varchare을 가지고, student_answer 동일 correct_answer 후 점수 1에 삽입하면 트리거가 종이에 삽입 afetr 작동합니다
점수 정수) 다른 0
이 트리거
내 코드입니다 create trigger if not exists insert_score after insert on paper
for each row
when (select * from paper,question
where question.question_id = paper.question_id
and question.correct_Answer = paper.student_Answer)
begin
insert into paper (Score) values (1);
end
가능한 중복 [트리거가 작동하지 않습니다 (http://stackoverflow.com/questions/16874538/trigger-does-not-work) –
질문을 삭제하고 다른에 같은 요청하지 마십시오 . 이전 질문을 개선하십시오. –
이 오류는 용지 테이블에 삽입 할 때 표시됩니다. 하나의 결과 만 표현식의 일부인 SELECT에 허용됩니다. – user2162075