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.

After insert

2 posts in Trigger Last posting was on 2004-03-22 17:30:57.0Z
ls Posted on 2004-03-21 16:22:00.0Z
From: "ls" <z@z.z>
Newsgroups: advantage.trigger
Subject: After insert
Date: Sun, 21 Mar 2004 11:22:00 -0500
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 24.24.14.68
Message-ID: <405dc286@solutions.advantagedatabase.com>
X-Trace: 21 Mar 2004 09:27:50 -0700, 24.24.14.68
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!24.24.14.68
Xref: solutions.advantagedatabase.com Advantage.Trigger:36
Article PK: 1136103

I'm trying to create my first trigger in Advantage...a pretty simple one I
think.

When a new order detail line is added I want to update the allocated
quantity in the product detail table. I tried the following command in an
AFTER INSERT trigger on table ORDDET but I get a syntax error:

UPDATE prddet SET allocated = allocated + (SELECT ordqty FROM __new)
WHERE sku = (SELECT sku FROM __new);

The syntax error is: "There were problems parsing the SET list"

What is wrong with my trigger?

Also I think triggers should allow direct access to the old and new values
without needing to use selects to obtain the values. E.G.:

UPDATE prddet SET allocated = allocated + __new.ordqty
WHERE sku = __new.sku;

Could this be considered for a future release?

Regards,
Larry

BTW: We've been using ADS at our company since it was first released as a
clipper RDD many years ago. I still love the product and have enjoyed
watching it grow into the powerful, flexible database it is today.


Alex Wong (ADS) Posted on 2004-03-22 17:30:57.0Z
From: "Alex Wong \(ADS\)" <alexw@extendsys.com>
Newsgroups: advantage.trigger
References: <405dc286@solutions.advantagedatabase.com>
Subject: Re: After insert
Date: Mon, 22 Mar 2004 10:30:57 -0700
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 198.102.102.12
Message-ID: <405f2385@solutions.advantagedatabase.com>
X-Trace: 22 Mar 2004 10:33:57 -0700, 198.102.102.12
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!198.102.102.12
Xref: solutions.advantagedatabase.com Advantage.Trigger:37
Article PK: 1136104

The subselect cannot be used in an algebraic expression. You can use this
SQL statement instead

UPDATE prddet SET allocate = allocate + __new.ordqty
FROM prddet, __new
WHERE prddet.sku = __new.sku

Alex Wong
Advantage R&D

"ls" <z@z.z> wrote in message
news:405dc286@solutions.advantagedatabase.com...
> I'm trying to create my first trigger in Advantage...a pretty simple one I
> think.
>
> When a new order detail line is added I want to update the allocated
> quantity in the product detail table. I tried the following command in an
> AFTER INSERT trigger on table ORDDET but I get a syntax error:
>
> UPDATE prddet SET allocated = allocated + (SELECT ordqty FROM __new)
> WHERE sku = (SELECT sku FROM __new);
>
> The syntax error is: "There were problems parsing the SET list"
>
> What is wrong with my trigger?
>
> Also I think triggers should allow direct access to the old and new values
> without needing to use selects to obtain the values. E.G.:
>
> UPDATE prddet SET allocated = allocated + __new.ordqty
> WHERE sku = __new.sku;
>
> Could this be considered for a future release?
>
> Regards,
> Larry
>
> BTW: We've been using ADS at our company since it was first released as a
> clipper RDD many years ago. I still love the product and have enjoyed
> watching it grow into the powerful, flexible database it is today.
>
>