Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

work areas in trigger during a transaction

6 posts in Trigger Last posting was on 2008-03-27 11:47:42.0Z
Golobrodskiy Igor Posted on 2008-03-12 09:43:33.0Z
From: "Golobrodskiy Igor" <igor@wgsoftpro.com>
Newsgroups: Advantage.Trigger
Subject: work areas in trigger during a transaction
Date: Wed, 12 Mar 2008 11:43:33 +0200
Lines: 289
Organization: WG SoftPro
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_000_000C_01C88436.4D429A10"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-Original-NNTP-Posting-Host: igor.masq.lc
Message-ID: <47d7a5c1$1@192.168.0.1>
X-Original-Trace: 12 Mar 2008 11:43:29 +0200, igor.masq.lc
NNTP-Posting-Host: 89.162.137.146
X-Trace: 12 Mar 2008 03:37:58 -0700, 89.162.137.146
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!192.168.0.1!igor.masq.lc
Xref: solutions.advantagedatabase.com Advantage.Trigger:378
Article PK: 1136439

Hi all,
I have a AFTER UPDATE trigger of one table (SODSALDO)  in which I do SELECT in another (SODOPER).
 

DECLARE @cursor CURSOR AS SELECT * FROM __new;
DECLARE @n integer;

DECLARE @cursorS CURSOR;

try

OPEN @cursor;
IF FETCH @cursor THEN
IF @cursor.saldo=0 AND @cursor.debet=0 AND @cursor.kredit=0 AND @cursor.ostatok=0 AND @cursor.prihod=0 AND @cursor.rashod=0 THEN
         SET @n = (
                        SELECT TOP 1 kodoper FROM
                            (SELECT DISTINCT kodoper,debet,klidebet,koddebet,nomdebet,kredit,klikredit,kodkredit,nomkredit
                             FROM sodoper sodoper 
                             WHERE data>=common.yearmonth2firstdate(@cursor.yearmonth) AND data<=common.yearmonth2lastdate(@cursor.yearmonth) AND koddebet=@cursor.kodm
                             UNION 
                             SELECT kodoper,debet,klidebet,koddebet,nomdebet,kredit,klikredit,kodkredit,nomkredit
                             FROM sodoper
                             WHERE data>=common.yearmonth2firstdate(@cursor.yearmonth) AND data<=common.yearmonth2lastdate(@cursor.yearmonth) AND kodkredit=@cursor.kodm) sodoper
                             WHERE ((debet =@cursor.kodschet AND klidebet =@cursor.kodkli AND koddebet =@cursor.kodm AND nomdebet =@cursor.nomer) OR 
                                           (kredit=@cursor.kodschet AND klikredit=@cursor.kodkli AND kodkredit=@cursor.kodm AND nomkredit=@cursor.nomer
)));
       IF @n is null THEN
           DELETE FROM sodsaldo WHERE sodsaldo=@cursor.sodsaldo;
       ENDIF;
ENDIF;
ENDIF;

finally

CLOSE @cursor;

end try;

If I run UPDATE of 1000 records SODSALDO in transaction and fire this trigger 1000 times with SELECT FROM sodoper
I will have 1000 additional work areas during transaction (ARC32 shows me 1000 additional tables SODOPER and not additional active queryes).
After commit transaction all of them closed.
 
Is it normal behaviour?
 
 

----------
Best regards,
Igor Golobrodskiy
WG SoftPro
E-mail: igor@wgsoftpro.com
URL: http://www.wgsoftpro.com
 
 


Igor Golobrodskiy Posted on 2008-03-18 06:40:39.0Z
Reply-To: "Igor Golobrodskiy" <igor@wgsoftpro.com>
From: "Igor Golobrodskiy" <igor@wgsoftpro.com>
Newsgroups: Advantage.Trigger
References: <47d7a5c1$1@192.168.0.1>
Subject: Re: work areas in trigger during a transaction
Date: Tue, 18 Mar 2008 08:40:39 +0200
Lines: 337
Organization: WG SoftPro
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_000_000A_01C888D3.C0B9FAF0"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: 193.223.98.106
Message-ID: <47df629c@solutions.advantagedatabase.com>
X-Trace: 18 Mar 2008 00:35:08 -0700, 193.223.98.106
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!193.223.98.106
Xref: solutions.advantagedatabase.com Advantage.Trigger:379
Article PK: 1136442

Can anybody make clear this behaviour?

------
Best regards,
Igor Golobrodskiy           
WG SoftPro
E-mail: igor@wgsoftpro.com
URL: http://www.wgsoftpro.com
 
"Golobrodskiy Igor" <igor@wgsoftpro.com> сообщил/сообщила в новостях следующее: news:47d7a5c1$1@192.168.0.1...
Hi all,
I have a AFTER UPDATE trigger of one table (SODSALDO)  in which I do SELECT in another (SODOPER).
 

DECLARE @cursor CURSOR AS SELECT * FROM __new;
DECLARE @n integer;

DECLARE @cursorS CURSOR;

try

OPEN @cursor;
IF FETCH @cursor THEN
IF @cursor.saldo=0 AND @cursor.debet=0 AND @cursor.kredit=0 AND @cursor.ostatok=0 AND @cursor.prihod=0 AND @cursor.rashod=0 THEN
         SET @n = (
                        SELECT TOP 1 kodoper FROM
                            (SELECT DISTINCT kodoper,debet,klidebet,koddebet,nomdebet,kredit,klikredit,kodkredit,nomkredit
                             FROM sodoper sodoper 
                             WHERE data>=common.yearmonth2firstdate(@cursor.yearmonth) AND data<=common.yearmonth2lastdate(@cursor.yearmonth) AND koddebet=@cursor.kodm
                             UNION 
                             SELECT kodoper,debet,klidebet,koddebet,nomdebet,kredit,klikredit,kodkredit,nomkredit
                             FROM sodoper
                             WHERE data>=common.yearmonth2firstdate(@cursor.yearmonth) AND data<=common.yearmonth2lastdate(@cursor.yearmonth) AND kodkredit=@cursor.kodm) sodoper
                             WHERE ((debet =@cursor.kodschet AND klidebet =@cursor.kodkli AND koddebet =@cursor.kodm AND nomdebet =@cursor.nomer) OR 
                                           (kredit=@cursor.kodschet AND klikredit=@cursor.kodkli AND kodkredit=@cursor.kodm AND nomkredit=@cursor.nomer
)));
       IF @n is null THEN
           DELETE FROM sodsaldo WHERE sodsaldo=@cursor.sodsaldo;
       ENDIF;
ENDIF;
ENDIF;

finally

CLOSE @cursor;

end try;

If I run UPDATE of 1000 records SODSALDO in transaction and fire this trigger 1000 times with SELECT FROM sodoper
I will have 1000 additional work areas during transaction (ARC32 shows me 1000 additional tables SODOPER and not additional active queryes).
After commit transaction all of them closed.
 
Is it normal behaviour?
 
 

----------
Best regards,
Igor Golobrodskiy
WG SoftPro
E-mail: igor@wgsoftpro.com
URL: http://www.wgsoftpro.com