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.

Trigger Error and Question

3 posts in Trigger Last posting was on 2006-06-22 21:19:33.0Z
Brent Nelson Posted on 2006-06-22 20:22:54.0Z
Date: Thu, 22 Jun 2006 14:22:54 -0600
From: Brent Nelson <bnelson@westernwats.com>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
Newsgroups: Advantage.Trigger
Subject: Trigger Error and Question
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 216.20.254.254
Message-ID: <449afb48@solutions.advantagedatabase.com>
X-Trace: 22 Jun 2006 14:19:20 -0700, 216.20.254.254
Lines: 34
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!216.20.254.254
Xref: solutions.advantagedatabase.com Advantage.Trigger:252
Article PK: 1136318

I am new to ADS and their triggers. I am trying to write a trigger (in
ADS 8) that takes the contents of a field and splits it up into words
and then inserts each individual word into another table.

Here is the error that I am getting:

---------------------------
Advantage Data Architect
---------------------------
Error 7200: AQE Error: State = 42000; NativeError = 2217; [Extended
Systems][Advantage SQL Engine]The declaration statement is not valid:
Variable declaration is not allowed in the script body.
---------------------------
OK
---------------------------

Here is the trigger SQL:

DECLARE @compName STRING;
@compName = ( SELECT c_compName FROM __new );
WHILE LENGTH( @compName ) > 1 DO
DECLARE @word STRING;
@word = SUBSTRING( @compName, 0, LOCATE( " ", @compName ) );
INSERT INTO searchRecordPointers ( srp_pointer ) VALUES ( @word );
@compName = SUBSTRING( @compName, LOCATE( " ", @compName ), LENGTH(
@compName ) );
END WHILE;


Any help would be a GREAT one.

Thanks.

ebn


Alex Wong (ADS) Posted on 2006-06-22 21:16:38.0Z
From: "Alex Wong \(ADS\)" <alexw@sybase.com>
Newsgroups: Advantage.Trigger
References: <449afb48@solutions.advantagedatabase.com>
Subject: Re: Trigger Error and Question
Date: Thu, 22 Jun 2006 15:16:38 -0600
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 10.24.38.166
Message-ID: <449b0635@solutions.advantagedatabase.com>
X-Trace: 22 Jun 2006 15:05:57 -0700, 10.24.38.166
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!10.24.38.166
Xref: solutions.advantagedatabase.com Advantage.Trigger:253
Article PK: 1136319

The @word must be declared at the beginning of the script.

Alex

"Brent Nelson" <bnelson@westernwats.com> wrote in message
news:449afb48@solutions.advantagedatabase.com...
>I am new to ADS and their triggers. I am trying to write a trigger (in ADS
>8) that takes the contents of a field and splits it up into words and then
>inserts each individual word into another table.
>
> Here is the error that I am getting:
>
> ---------------------------
> Advantage Data Architect
> ---------------------------
> Error 7200: AQE Error: State = 42000; NativeError = 2217; [Extended
> Systems][Advantage SQL Engine]The declaration statement is not valid:
> Variable declaration is not allowed in the script body.
> ---------------------------
> OK
> ---------------------------
>
> Here is the trigger SQL:
>
> DECLARE @compName STRING;
> @compName = ( SELECT c_compName FROM __new );
> WHILE LENGTH( @compName ) > 1 DO
> DECLARE @word STRING;
> @word = SUBSTRING( @compName, 0, LOCATE( " ", @compName ) );
> INSERT INTO searchRecordPointers ( srp_pointer ) VALUES ( @word );
> @compName = SUBSTRING( @compName, LOCATE( " ", @compName ), LENGTH(
> @compName ) );
> END WHILE;
>
>
> Any help would be a GREAT one.
>
> Thanks.
>
> ebn


Brent Nelson Posted on 2006-06-22 21:19:33.0Z
Date: Thu, 22 Jun 2006 15:19:33 -0600
From: Brent Nelson <bnelson@westernwats.com>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
Newsgroups: Advantage.Trigger
Subject: Re: Trigger Error and Question
References: <449afb48@solutions.advantagedatabase.com> <449b0635@solutions.advantagedatabase.com>
In-Reply-To: <449b0635@solutions.advantagedatabase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 216.20.254.254
Message-ID: <449b088c@solutions.advantagedatabase.com>
X-Trace: 22 Jun 2006 15:15:56 -0700, 216.20.254.254
Lines: 51
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!216.20.254.254
Xref: solutions.advantagedatabase.com Advantage.Trigger:254
Article PK: 1136320

SWEET! The syntax is now correct, but the script doesn't seem to be
doing anything.

Thanks Alex. I guess I need to figure out how to make it work now.

ebn

Alex Wong (ADS) wrote:
> The @word must be declared at the beginning of the script.
>
> Alex
>
>
> "Brent Nelson" <bnelson@westernwats.com> wrote in message
> news:449afb48@solutions.advantagedatabase.com...
>> I am new to ADS and their triggers. I am trying to write a trigger (in ADS
>> 8) that takes the contents of a field and splits it up into words and then
>> inserts each individual word into another table.
>>
>> Here is the error that I am getting:
>>
>> ---------------------------
>> Advantage Data Architect
>> ---------------------------
>> Error 7200: AQE Error: State = 42000; NativeError = 2217; [Extended
>> Systems][Advantage SQL Engine]The declaration statement is not valid:
>> Variable declaration is not allowed in the script body.
>> ---------------------------
>> OK
>> ---------------------------
>>
>> Here is the trigger SQL:
>>
>> DECLARE @compName STRING;
>> @compName = ( SELECT c_compName FROM __new );
>> WHILE LENGTH( @compName ) > 1 DO
>> DECLARE @word STRING;
>> @word = SUBSTRING( @compName, 0, LOCATE( " ", @compName ) );
>> INSERT INTO searchRecordPointers ( srp_pointer ) VALUES ( @word );
>> @compName = SUBSTRING( @compName, LOCATE( " ", @compName ), LENGTH(
>> @compName ) );
>> END WHILE;
>>
>>
>> Any help would be a GREAT one.
>>
>> Thanks.
>>
>> ebn
>
>