trigger error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • questionit
    Contributor
    • Feb 2007
    • 553

    trigger error

    Hi

    Please help me create a trigger. This is the code but i am getting errors

    CREATE Trigger MyTrigger
    AFTER
    update [or delete] on dbo.Products
    REFERENCING OLD AS oldRow
    for each row
    BEGIN
    UPDATE ncache_db_sync
    SET modified = 1
    WHERE cache_key = (Cast(Select oldRow.ProductI D FROM deleted OLD) As VarChar) + ':dbo.Products'
    END TRIGGER;


    Errors:

    4 26 PL/SQL: ORA-00936: missing expression
    2 2 PL/SQL: SQL Statement ignored
    5 12 PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with


    I could not figure out the problem, please help

    Thanks
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Try this:

    [code=oracle]

    CREATE Trigger MyTrigger
    AFTER
    update or delete on dbo.Products
    REFERENCING OLD AS oldRow
    for each row
    BEGIN
    UPDATE ncache_db_sync
    SET modified = 1
    WHERE cache_key = (Cast(Select :oldRow.Product ID FROM deleted) As VarChar) + ':dbo.Products' ;
    END MyTrigger;

    [/code]

    Comment

    Working...