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.

Before Insert trigger to dissalow insert

3 posts in Trigger Last posting was on 2004-08-04 17:06:07.0Z
Francois Posted on 2004-08-04 02:13:25.0Z
Reply-To: "francois" <francois@geedee.com.au>
From: "francois" <francois@geedee.com.au>
Newsgroups: Advantage.Trigger
Subject: Before Insert trigger to dissalow insert
Date: Wed, 4 Aug 2004 10:13:25 +0800
Lines: 24
Organization: geedee
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 202.72.180.220
Message-ID: <41104786@solutions.advantagedatabase.com>
X-Trace: 3 Aug 2004 20:18:46 -0700, 202.72.180.220
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!202.72.180.220
Xref: solutions.advantagedatabase.com Advantage.Trigger:107
Article PK: 1136173

Hi
I have an INSTEAD OF INSERT trigger
I need to stop the insertion if a particular record already exists in the
table.
Do I just not do the final copy between __New and the table?
What happens to the empty record?
Will it be suppressed if I use a "not null" requirement on a field
How can I suppress an error message (if one appears) in this case?

Regards
Francois

FYI: I have a record of bank reconciliations done over a period
The fields are: RecID, FromDate, ToDate, FromBalance, ToBalance, Credits,
Debits, Balanced, TmeStmp.
Only one unbalanced record (Balanced=false) may exist.
A new record has to be populated by Copying ToDate and ToBalance of the last
Balanced record to FromDate, FromBalance.
However if a record with Balanced=false already exists the insert action
must be aborted totally
and the record positioned on the last unbalanced field which supposedly is
the last record anyway


Jeremy D. Mullin Posted on 2004-08-04 15:11:23.0Z
From: Jeremy D. Mullin <no@email.com>
Newsgroups: Advantage.Trigger
Subject: Re: Before Insert trigger to dissalow insert
Date: Wed, 4 Aug 2004 09:11:23 -0600
Message-ID: <MPG.1b7aaa81e558d26c989d22@solutions.advantagedatabase.com>
References: <41104786@solutions.advantagedatabase.com>
Organization: ESI
X-Newsreader: MicroPlanet Gravity v2.30
NNTP-Posting-Host: 198.102.102.187
X-Trace: 4 Aug 2004 09:18:07 -0700, 198.102.102.187
Lines: 27
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!198.102.102.187
Xref: solutions.advantagedatabase.com Advantage.Trigger:110
Article PK: 1136177

In article <41104786@solutions.advantagedatabase.com>,
francois@geedee.com.au says...

> Hi
> I have an INSTEAD OF INSERT trigger
> I need to stop the insertion if a particular record already exists in the
> table.
> Do I just not do the final copy between __New and the table?

You could do that, but you would have no indication that you need to
change the record position to the last unbalanced field. Another option
is to raise an error by doing an insert into the __error table.

> What happens to the empty record?

It will be recycled.

> Will it be suppressed if I use a "not null" requirement on a field

I don't understand this question.

> How can I suppress an error message (if one appears) in this case?

Catch the error on the client side.


J.D. Mullin
Advantage R&D


francois Posted on 2004-08-04 17:06:07.0Z
Reply-To: "francois" <fransh_@westnet.com.au>
From: "francois" <fransh_@westnet.com.au>
Newsgroups: Advantage.Trigger
References: <41104786@solutions.advantagedatabase.com> <MPG.1b7aaa81e558d26c989d22@solutions.advantagedatabase.com>
Subject: Re: Before Insert trigger to dissalow insert
Date: Thu, 5 Aug 2004 01:06:07 +0800
Lines: 13
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 202.72.164.126
Message-ID: <411118e4@solutions.advantagedatabase.com>
X-Trace: 4 Aug 2004 11:12:04 -0700, 202.72.164.126
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!202.72.164.126
Xref: solutions.advantagedatabase.com Advantage.Trigger:114
Article PK: 1136181


"Jeremy D. Mullin" <no@email.com> wrote
> > Will it be suppressed if I use a "not null" requirement on a field
>
> I don't understand this question.

When the table is defined a restraint can be applied to dissallow null
values for a field. I merely looked for a way to avoid a totally empty
record to be appended.

Regards
Francois