Re: Null in string concatenation
Posted in 1998
Jamie Hatfield wrote:
> A question pertaining to this:
>
> Why can I use NVL(...) and the FIRST # syntax in ISQL, but in my 4gl
> code, the only way I can use them is to prepare them? I think the FIRST
> # would be a great way to just get the first row that my query returns
> without having to OPEN, FETCH, and CLOSE a cursor, but it kinda defeats
> my purpose when I have to prepare the statement instead of just using it
> inline.
>
Are you sure you are using them in ISQL and not DBACCESS? Dbaccessships
with the engine and is built with the current verions of esql that is used
to also build the engine. So it is aware of new syntax, where as ISQL and
4GL tend to not be built with the newest version of esql and so they are
not aware of the new syntax. So basically, yes, the front end toos
occassionally
have different parsers then the engine, that is why it works when you
prepare
it, so the front end parser doesn't look at it.
Jacques
> Do the compiler and the engine have different "grammars"? I thought
> that what worked in one would work in the other, but apparently that's
> not the case.
>
> Thanks.
>
> Jose Miguel Giraldez wrote:
> >
> > try
> > SELECT a.last|| ',' || a.first
> > FROM a
> > WHERE a.first IS NOT NULL
> > UNION
> > SELECT a.last
> > FROM a
> > WHERE a.first IS NULL> >
> > on IDS 7.3
> > SELECT a.last|| ',' || NVL(a.first," ")
> > FROM a
> >
> > Rafal Furdzik escribi':
> >
> > > If a.first is null,this select will return nulll
> > >
> > > Select a.last || ', ' || a.first
> > > From a
> > >
> > > How to return a.last only in case if a.first is null. Please help.
--
********************************************************************
* Jacques P. Renaut "I'd dazzle you with brilliance *
* Informix Advanced Support if I only had the knack..." *
* email: jrenaut@informix.com #include <disclamier.h> *
********************************************************************