cancel
Showing results for 
Search instead for 
Did you mean: 

Triggers on views

Former Member
0 Kudos

I'm trying to write a trigger on a view in PowerDesigner using GTL but none of the varaibles are working that I'd expect to be working

(I'm no GTL expert so hopefully something I'm doing wrong)

I have a view called Currency.

On the Triggers tab I've added a trigger.

In the definition I'm trying to add all the columns to some code.

I have this working ok.

     create trigger %TABLE%TRU

     on %TABLE%

     instead of update

     as

     begin

Odd that I need to use %TABLE% rather than %VIEW%

I was hoping to use%VIEWCOLN% but this is empty.

In fact most of the variables are empty eg

     %VIEWNAME%

     %VIEWSTYLE%

     %TRGTYPE%

     %ISVIEW%

     %USAGE%

Is this a bug or is there someway around this ?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member200945
Contributor
0 Kudos

Did you add the code in DMBS file?

Former Member
0 Kudos

I've used

     Database -> Edit Current DBMS

Selected    TriggerTemplates.

Created new trigger template with "View triggers" checked. "Trigger time "instead of", Trigger event "update"

On the view I select triggers tab, and select the Instead trigger and that brings up the definition.

I can preview the expansion of the names/macros.

%TABLE% shows up

%VIEWNAME% and the others are replaced with blank.

I must be doing something wrong here.