Re: Using cast in case statement
Posted in 2007
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Can you see the limitations of a sales guy :-) On 16 Mrz., 08:46, "Obnoxio The Clown" <obno...@serendipita.com> wrote: > h.hoe...@querix.com said: > > > Sorry - I'm lost with this example... > > I assume it's SQL rather than 4GL. > > > > > > > So far I know: > > > CASE is used to make different decissions based on the evaluation of a > > SINGLE variable/expression. > > > What you do is make different decissions based on DIFFERENT variables/ > > expression - So, should you not use some kind of IF clauses ? > > > CASE <main expression> > > WHEN <boolean expression addressing case main expression> > > <statements> > > (optional EXIT CASE) > > ... > > ... > > OTHERWISE > > ..<statements> > > > END CASE > > > Regards > > Hubert > > PS: I'm sure someone will correct me :-) > > > On 16 Mrz., 07:56, jared.ha...@gmail.com wrote: > >> I'm trying to use a case statement and I keep getting an error "800 > >> Corresponding types must be compatible in CASE expression". > > >> The columns I have are: > > >> column1, integer > >> column2, integer > >> column3, decimal(12,2) > >> column4, integer > > >> What I need to do is this.... > > >> case > >> when column1 > 0 > >> then sum(column2*column3) > >> when column4 > 0 > >> then sum(column4*column3) > >> else "0.00" > >> end > > >> I've also tried to do: > > >> sum(case > >> when column1 > 0 > >> then column2*column3 > >> when column4 > 0 > >> then column4*column3 > >> else "0.00" > >> end) > > >> I'm guessing I need to somehow cast the column1,2,4 to decimal(12,2) > >> to make this work. I can't seem to figure out the cast syntax. > > >> Any help is greatly appreciated. > > >> Thanks, > >> Jared > > > _______________________________________________ > > Informix-list mailing list > > Informix-l...@iiug.org > >http://www.iiug.org/mailman/listinfo/informix-list > > > -- > > This message has been scanned for viruses and > > dangerous content by OpenProtect(http://www.openprotect.com), and is > > believed to be clean. > > -- > Bye now, > Obnoxio > > "I'm astonished anyone pays real money for this crap." > -- Cosmo > > -- > This message has been scanned for viruses and > dangerous content by OpenProtect(http://www.openprotect.com), and is > believed to be clean.- Zitierten Text ausblenden - > > - Zitierten Text anzeigen -
h.hoelzl@querix.com said: > Can you see the limitations of a sales guy :-) I've seen worse. ;o) -- Bye now, Obnoxio "I'm astonished anyone pays real money for this crap." -- Cosmo -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean.
this is why I don't use my company name. My boss would fire me if he would read this .. ahmmm I think it's called job reallocation On 16 Mrz., 11:24, "Obnoxio The Clown" <obno...@serendipita.com> wrote: > h.hoe...@querix.com said: > > > Can you see the limitations of a sales guy :-) > > I've seen worse. ;o) > > -- > Bye now, > Obnoxio > > "I'm astonished anyone pays real money for this crap." > -- Cosmo > > -- > This message has been scanned for viruses and > dangerous content by OpenProtect(http://www.openprotect.com), and is > believed to be clean.