Im back to MV-World after a 20-year break. Formerly i was developing an application with advanced Pick / SB+.
I want to activate Database triggers on a UV Database for some UV Datafiles to get dependent tables updated.
But im struggling right at the beginning.
I created the following:
FILE TEST.TRIGGER FILE TYPE 18
BAISC SUBROUTINE B.TESTTRIGGER with the needed parameters.
After that I try to activate the Trigger with CREATE TRIGGER TESTTRIGGER BEFORE INSERT OR UPDATE TEST.TRIGGER B.TESTTRIGGER
-> I Get the message TEST.TRIGGER unexpected.
I thought that I have to convert the file to SQL Table befor so i tried the following command:
-> I Get the Message: Can't run CONVERT.SQL: 'UV11TEST-TL\Administrator' is not an SQL User
So i logged in as Administrator User and tried:
GRANT DBA TO t.ludwig or GRANT DBA TO Administrator
-> I Get the message: UniVerse/SQL: "UV11TEST-TL\Administrator" is not an SQL user.
I think the problem is to get the first user as an SQL User.In the Help-File i found that NT AUTHORITY\system gets registered as SQL user during install, but how do I use this user to Grant Access to other users?
Everey Idea is welcome...
It looks like you don't have the syntax quite right for the CREATE TRIGGER command. The following is an example of mine that works.
CREATE TRIGGER FRED BEFORE INSERT OR UPDATE ON TRIGTEST FOR EACH ROW CALLING '*TRIGGERPROG';
The file name is TRIGTEST and the TRIGGER is using the globally catalogged program *TRIGGERPROG.
Also, the file need not be a SQL Table to be able to add the trigger. Triggers can be added to regular UV files.
Thanks a lot, for the help.
-> Had to find out how to catalog globally but finaliy got the trigger to work.
Now I guess I have to learn a bit more about Triggers because I get the next error message after saving an entry in the triggered File in the SB+ Screen-Editor
I Will go through the Docs and try to find how the Subroutine should look like...
One thing to note is that the Trigger will execute as a "transaction". The error noted in your screen shot may be an indication that a WRITE operation is happening in the Trigger program without a READU lock for the record being active.
exactly this was happening :-)
I thought im my small Test-Basic subroutine I do a write to some log-file in the Account without caring for readu and so on.After reading the log-record with readu before writing it works now. And I can continue.
Thanks a lot Neil - You helped a lot!
While injecting a little overhead, make the trigger program something small that calls the routine that does the actual work. Then, you can simply recompile and recatalog the work program to change the trigger behavior. Otherwise, you need to DROP TRIGGER, make changes and CATALOG, and CREATE TRIGGER.
That's a very good point, thank you for this suggestion.
At the moment the Trigger is already finished and linked to the file, so i will wait until I have the first change to make and change it the way you described.
77 4th AvenueWaltham, MA 02451 USA
Rocket Support Community
All Support Offerings
About Rocket Software
Training and Services
Forum Terms and Conditions
Contact Forum Moderator