• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trigger

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written a trigger not sure where I am going wrong. It is showing as Invalid trigger.

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Michell,

what exactly do you want this trigger to do?


John
 
michell o'brien
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my first trigger. I am selecting some of the newly inserted values.using a trigger.
 
John Bengler
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I see...

Wel, it looks as if you need some guidance on triggers.

Maybe you can start following one of these links:

Tutorial Oracle Triggers

When to use triggers


And one more thing: inside of a trigger you should avoid selects on the table of the trigger. See this:

Avoiding Mutating Tables


John
 
michell o'brien
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



Can anyone tell me what mistake I have done in Line 10. It gives me error code number PLSQL-00103
 
John Bengler
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi michell,

I think when you work with cursors you have to open them, e.g.



Additionally I'm not sure if you're allowed to access table itemtype in your trigger,but since it is an AFTER trigger it may be allowed...

But I think you should read about the :new and : old parameters available in triggers.

If you just want to add an item everytime a new itemtype was added you could write:



So for each row which was inserted into itemtypes an entry into item is made.
If you create this trigger before the firstentry into itemtype was made it will have the same effect as your trigger - of course without "cleaning up" items whose itemtype has been deleted. For this you would need an additional ON DELETE trigger..


John
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic