Subject | Re: [firebird-support] using extract on null values |
---|---|
Author | Dmitry Yemanov |
Post date | 2006-10-05T07:09:45Z |
Christian Kaufmann wrote:
WHEN A.BIRTHDATE IS NULL THEN NULL
ELSE EXTRACT(YEAR FROM A.BIRTHDATE)
END
2) FB 2.0 returns NULL in your case
Dmitry
>1) CASE
> select distinct SR.COURSE, R.GENDER as RELAYGENDER, A.GENDER,
> extract(year from A.BIRTHDATE) as YOB
> from SWIMRESULT SR
> left join ATHLETE A on SR.ATHLETEID = A.ATHLETEID
> left join RELAYINFO R on SR.ATHLETEID = R.RELAYINFOID
>
> For records in SWIMRESULT where I have no record in ATHLETE, I get an
> error because "extract(year from A.BIRTHDATE)" fails.
>
> Is there a way, to get null or another default value for YOB in this case?
WHEN A.BIRTHDATE IS NULL THEN NULL
ELSE EXTRACT(YEAR FROM A.BIRTHDATE)
END
2) FB 2.0 returns NULL in your case
Dmitry