Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Embedded SQL Problem: Cursor, Fetch
Hello all,
I am a newbie in using embedded SQL with oracle server. I will really appreciate any help from the experts around here.
I am working on a small project that deals with a grading system.
Every other parts of the project have been done, but
I am having a problem that is driving me crazy. In the portions of
code
below:
EXEC SQL declare grade_cur cursor for
select last, first, phone, gender
from student
where last = :last and first = :first;
EXEC SQL open grade_cur;
EXEC SQL fetch grade_cur into :last, :first, :phone, :gender;
if (sqlca.sqlcode != 0)
printf("oops!\n");
the word "oops" is printed everytime i run the program. When I checked
the values of :last, :first, :phone and :gender, they are all nulls.
I can sucessfully use the other SQL constructs like "select",
"insert", etc without any problem. How come "cursor" doesn't work?
I have beening searching for an answer in the newsgroup, but so far I
couldn't
find any. I noticed some comments on "fetch" that it won't work if the
connection to the database is lost. It caused me to check the Oracle
DBA studio, and I discovered that the session where my programm
connected to has
it's status being "inactive". Can this be the problem?
Thanks for any suggestions.
Eddie
How to make the status of a session active in oracle DBA studio Received on Fri Nov 01 2002 - 22:35:17 CST