Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ProC SQL Question Regarding Cursors
"Ed Prochak" <edprochak_at_adelphia.net> wrote in message
news:3EC171A4.4000509_at_adelphia.net...
> Melissa wrote:
> > I need some advice - I was taught that when using cursors, I should
> > follow this format:
> >
> > EXEC SQL
> > DECLARE cursor_name CURSOR FOR
> >
> > <SQL Statement inserted here>
> >
> > EXEC SQL OPEN cursor_name;
> > EXEC SQL WHENEVER NOT FOUND DO break;
> >
> > for (;;)
> > {
> > EXEC SQL FETCH cursor_name INTO
> > :variable1 :nvariable1,
> > :char1 :nchar1,
> > :int1 :nint1;
> >
> > }
> >
> > It was my understanding for each field, you needed another place
> > holder that was defined as a "short" (:nvariable1, :nchar1, :nint1 are
> > defined as short values).
> >
> > What bothers me is that I have seen the above fetch done without these
> > integer values associated with the variables. Is what I learned
> > wrong?
> >
> > Thanks!
> >
> > Melissa
>
> No, you training is incomplete. You are trying to interface two very
different
> programming languages, C, and SQL.
>
> One crucial concept in SQL is that of NULL. In SQL a variable can have a
NULL
> value, meaning it doesn't have ANY value. It's the all consuming nothing!
8^)
>
> In C programming there is no such thing. Every variable has a value even
if
> the value is zero, which for character data, in ACSII is referred to as
nul(0).
>
>
Thanks for the information!