|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Dynamic insertion trigger
Hi, I'm pulling my hair out with this problem. I'm trying to make a trigger that, upon an update in one table and after checking that update, the trigger will insert a new tuple into a different table, here's my command:
create or replace trigger release_date_news_trigger after update of release_date on games referencing old as oldtuple new as newtuple for each row when(oldtuple.release_date < newtuple.release_date) begin insert into news(news#, games#, news_article, date_posted) values(news_pk_sequence.nextval, newtuple.game#, 'Game delayed!', sysdate); end release_date_news_trigger; / but it 'compiles with errors. here are the erors: Errors for TRIGGER RELEASE_DATE_NEWS_TRIGGER: LINE/COL ERROR -------- ----------------------------------------------------------------- 2/1 PL/SQL: SQL Statement ignored 2/25 PLS-00390: undefined column 'GAMES#' in INSERT statement Anyone able to help, and prevent my heart attack, or my computer meeting an unfortunate fate! Cheers |
|
#2
|
|||
|
|||
|
You are using newtuple.game# in your insert statement that is not declared in your table structure, use newtuple.games# as follows:
insert into news(news#, games#, news_article, date_posted) values(news_pk_sequence.nextval, newtuple.games#, 'Game delayed!', sysdate); Save your heart to be break. Regards |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Dynamic insertion trigger |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|