Standards question

Started by Dr. Michael Meskesover 27 years ago5 messages
#1Dr. Michael Meskes
meskes@online-club.de

Let's say we have a table with two entries:

name nr
----------
foo 1
bar 2

and a C program doing the following:

...
i=1;
exec sql declare C cursor for select name from table where nr=:i;
i=2;
exec sql open C;
...

Which row will be selected?

I guess I'll try Oracle as soon as I find time.

Michael
--
Dr. Michael Meskes meskes@online-club.de, meskes@debian.org
Go SF49ers! Go Rhein Fire! Use Debian GNU/Linux!

#2Thomas G. Lockhart
lockhart@alumni.caltech.edu
In reply to: Dr. Michael Meskes (#1)
Re: [HACKERS] Standards question

i=1;
exec sql declare C cursor for select name from table where nr=:i;
i=2;
exec sql open C;
Which row will be selected?

Things should evaluate at the "open". I recall that the cursor
declaration is allowed to happen up in the declarations section of the
program or routine (at least on my old Ingres installation)...

- Tom

#3Roland Roberts
roberts@panix.com
In reply to: Dr. Michael Meskes (#1)
Re: [HACKERS] Standards question

"Thomas" == Thomas G Lockhart <lockhart@alumni.caltech.edu> writes:

i=1;
exec sql declare C cursor for select name from table where nr=:i;
i=2;
exec sql open C; Which row will be selected?

Thomas> Things should evaluate at the "open".
[...]

This is also how it works with Oracle.

roland
--
Roland B. Roberts, PhD Custom Software Solutions
roberts@panix.com 101 West 15th St #4NN
New York, NY 10011

#4Andreas Zeugswetter
andreas.zeugswetter@telecom.at
In reply to: Roland Roberts (#3)
AW: [HACKERS] Standards question

Michael wrote:

Let's say we have a table with two entries:

name nr
----------
foo 1
bar 2

and a C program doing the following:

..
i=1;
exec sql declare C cursor for select name from table where nr=:i;
i=2;
exec sql open C;
..

Which row will be selected?

Since it is usually allowed to do one declare and then many
open, fetch, fetch ...
open, fetch ....
it has to be i=2 (bar)

Andreas

#5Dr. Michael Meskes
meskes@online-club.de
In reply to: Andreas Zeugswetter (#4)
Re: [HACKERS] Standards question

On Wed, Aug 05, 1998 at 09:10:46AM +0200, Andreas Zeugswetter wrote:

Since it is usually allowed to do one declare and then many
open, fetch, fetch ...
open, fetch ....
it has to be i=2 (bar)

Yes, that was what I expected. However, I wanted to be sure.

Michael
--
Dr. Michael Meskes meskes@online-club.de, meskes@debian.org
Go SF49ers! Go Rhein Fire! Use Debian GNU/Linux!