Subject | useing char_length in the trigger |
---|---|
Author | ahmetdenize |
Post date | 2010-12-29T13:19:24Z |
I have trigger for generade order number. I want to use char_length(TeklifNoStr) in the if command . but it is not working.
there is error massage is
"Token unknown - line 30, column 9
char_length"
AS
declare variable Yil VARCHAR(4);
declare variable Ay VARCHAR(2);
declare variable SonNo VARCHAR(4);
declare variable TeklifNoStr VARCHAR(10);
declare variable SifirTakfiye VARCHAR(10);
BEGIN
IF (NEW.TEKLIFM_NO IS NULL) THEN BEGIN
Yil = (cast (extract(year from current_date) as varchar(4)));
Ay = (cast (extract(Month from current_date) as varchar(2)));
SonNo = cast(GEN_ID(TEKLIFM_TEKLIFM_TEKLIFNO_GEN, 1) as varchar(10));
TeklifNoStr = Yil || Ay || SonNo ;
if char_length(TeklifNoStr) = 9 then SifirTakfiye ='0';
if char_length(TeklifNoStr) = 8 then SifirTakfiye ='00';
END
END
there is error massage is
"Token unknown - line 30, column 9
char_length"
AS
declare variable Yil VARCHAR(4);
declare variable Ay VARCHAR(2);
declare variable SonNo VARCHAR(4);
declare variable TeklifNoStr VARCHAR(10);
declare variable SifirTakfiye VARCHAR(10);
BEGIN
IF (NEW.TEKLIFM_NO IS NULL) THEN BEGIN
Yil = (cast (extract(year from current_date) as varchar(4)));
Ay = (cast (extract(Month from current_date) as varchar(2)));
SonNo = cast(GEN_ID(TEKLIFM_TEKLIFM_TEKLIFNO_GEN, 1) as varchar(10));
TeklifNoStr = Yil || Ay || SonNo ;
if char_length(TeklifNoStr) = 9 then SifirTakfiye ='0';
if char_length(TeklifNoStr) = 8 then SifirTakfiye ='00';
END
END