Subject Re: [firebird-support] Re: Add Year function
Author Helen Borrie
At 11:18 AM 10/04/2006, you wrote:
>Hi Adam,
>
>Yes, I found the script:
>declare external function addYear
>timestamp, int
>returns timestamp
>entry_point 'addYear' module_name 'fbudf'
>
>But I got the same error AddYear is not defined when I compile my
>stored procedure.
>
>CREATE PROCEDURE ADDYEAR_PROCEDURE
>AS
>BEGIN
> UPDATE OldDateTable
> SET Transaction_Date = ADDYEAR(Transaction_Date, 100)
> WHERE Transaction_Date < 1910;
> SUSPEND;
>END

Hum. Since when was 1910 a timestamp?

Depending on what data type you are storing Transaction_Date as
(let's assume it *is* Timestamp) you have some stuff to do to make a
valid where clause.

Correct this to

CREATE PROCEDURE ADDYEAR_PROCEDURE
AS
BEGIN
UPDATE OldDateTable
SET Transaction_Date = ADDYEAR(Transaction_Date, 100)
WHERE (CAST(Transaction_Date AS DATE) < '01.01.1910');
SUSPEND;
END