cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Inconsistent behaviour of Sybase SQL anywhere update column trigger

Former Member
0 Kudos

I have an Oracle trigger which updates only specific columns.

I want the column 'change_date' only to be updated if 'amount' or 'quantity' changes; all other column changes should not update the 'change_date' column.

here is the trigger:

create trigger bu_s1_sales_analysis

before update on s1_sales-analysis

for each row

begin

if not updating('change_date') and updating('amount') or updating('quantity)) then

:new.change_date := sysdate;

end if; end;

/

My SQLanywhere attempt looks like this:

create trigger bu_s1_sales_analysis

before update on s1_sales_analysis

referencing new as new_upd

for each row

begin

if not update('change_date') and update('amount') or update('quantity')) then

set new_upd.change_date - current timestamp;

end if;

end;

I get a "syntax error near 'change_date' on line 7 message.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

JasonHinsperger
Advisor
Advisor
0 Kudos

Murray,

     Single quotes indicate string values (the value 'change_date'), while double quotes indicate identifiers (the column named "change_date").

Changing the single quotes to double quotes around the column names should fix your problem.


Also, your set statement is incorrect.  It is missing an = operator.

hth,

--Jason

Answers (0)