Subject Re: [firebird-support] CASE WHEN error
Author Svein Erling Tysvaer
It would be advantageous if we knew which error Firebird reported, as
well as if we knew which of the CASE statements that caused the error
(it is easier for you to test than for us to guess), though I'll have a
go anyway:

My guess is that it is this part that causes the error:

case when hesaplar.hesap_sec_tablo = 0 then ''P'' Else ''M'' end as ST

I think it should be

case when hesaplar.hesap_sec_tablo = 0 then 'P' Else 'M' end as ST

HTH,
Set

Esra Ozdemir wrote:
> Thank you for your interest. I don't have enough experience about Firebird SQL. My graduation project was about a law office program. I didn't have any problem during the presentation. Now I have to deal with that program again but it gives an error about CASE WHEN statement.
>
> Tables' names are in Turkish, so I think its better to write the table names first, in order to help you to understand.
>
> Table Name: Fields:
>
> HESAPLAR HESAP_ID
> HESAP_TARIHI
> HESAP_SEC_TABLO
> HESAP_SEC_TAB_ID
> PERSONEL_KART PER_ID
> PER_ISIM
> PER_SADI
> MUSTERI_KARTI MUS_ID
> MUS_ISIM
> MUR_SADI
>
>
> And this is the code that gives error at CASE WHEN statement:
>
>
> select DISTINCT HESAPLAR.HESAP_ID,
> HESAPLAR.HESAP_TARIHI,HESAPLAR.hesap_sec_tablo,
> HESAPLAR.HESAP_SEC_TAB_ID,
> CASE when hesaplar.hesap_sec_tablo = 0
> then (select trim(PERSONEL_KART.PER_ISIM) ||' '||trim(PERSONEL_KART.PER_SADI)
> from personel_kart
> where personel_kart.per_id=hesaplar.hesap_sec_tab_id)
> else (select trim(MUSTERI_KARTI.MUS_ISIM) ||' '||trim(MUSTERI_KARTI.MUS_SADI)
> from musteri_karti
> where musteri_karti.mus_id =hesaplar.hesap_sec_tab_id)
> end as kisi,hesaplar.hesap_aciklama,hesaplar.hesap_dekonttur,
> HESAPLAR.HESAP_TUR_ID,hesaplar.hesap_debit,hesaplar.hesap_credit
> case when hesaplar.hesap_sec_tablo = 0 then ''P'' Else ''M'' end as ST
> from hesaplar
>
> As I said before, I don't have enough experience about Firebird SQL and I will be appreciate for your help.
>
> Thank you.
>
>
>
>
>
>
> ----- Original Message ----
> From: Martijn Tonies <m.tonies@...>
> To: firebird-support@yahoogroups.com
> Sent: Thursday, November 23, 2006 5:55:47 PM
> Subject: Re: [firebird-support] Hi!
>
>
>> Im a recruit in this group, I ve found this group while searching for
> documentation about firebird SQL.
>> I use firebird 1.5 and EMS Interbase/Firebird Manager 3. When I try to
> write a SQL code on SQL editor, it gives me an error.
>> Im not sure if its ok to send questions to this group for help. But if it
> is, I would like to ask some questions, I appreciate your interest, thank
> you.
>
> This is "firebird-support" , so yes, that's OK.
>
> Make sure to use a subject that's useful and provide all details needed to
> answer your question.
>
> Welcome to the group :)
>
> Martijn Tonies
> Database Workbench - development tool for Firebird and more!
> Upscene Productions
> http://www.upscene. com
> My thoughts:
> http://blog. upscene.com/ martijn/
> Database development questions? Check the forum!
> http://www.database developmentforum .com