Selvakanna,

check the SQLCODE before using the ID field.
only if SQLCODE = 0 your query was successfull.

Dirk.

"Selvakannan. S" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi,
>
>   Its not always required to open the cursor to get a single record.Its
> works fine most of the time,only it creates problem when fetching only id.
>
>
> With Regards
>
> Selvakannan.S
>
> "Peter Cooper" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Selvakannan
> >
> > in embedded sql you need to declare and use a cursor
> >
> > &sql(declare c1 cursor for
> > select ID into :SID from BLUELOG.MonthActivity where (Month=:strMonth
> > and Insurance=:strInsurance and LevelId=:LID))
> >
> > &sql(open c1)
> > &sql(fetch c1)
> > while SQLCODE=0
> > {
> >   write !,SID
> >    &sql(fetch c1)
> > }
> > &sql(close c1)
> >
> >
> >
> > Peter
> >
> > On Fri, 21 May 2004 17:00:47 +0530, "Selvakannan. S"
> > <[EMAIL PROTECTED]> wrote:
> >
> > >Hi,
> > >
> > >In my database for BLUELOG.MonthActivity class there is only one record
> and
> > >the following query returns  me the  first record id where ever the
> > >condition i pass.Even if my condition not matchs then also it returns
the
> > >first record id.
> > >
> > > set SID=0
> > > &sql(select ID into :SID from BLUELOG.MonthActivity where
> (Month=:strMonth
> > >and Insurance=:strInsurance and LevelId=:LID))
> > >
> > >Note: SID returns 1 Even if i change strInsurance or strMonth.
> > >
> > >is it Cache SQL bug?
> > >
> > >Pls correct me if i am worng.
> > >
> > >
> > >With Regards
> > >Selvakannan.S
> > >
> > >
> > >
> >
>
>



Reply via email to