Re: Pro*C problem - declare cursor
Date: Thu, 16 Jun 1994 15:47:53 +0000
Message-ID: <771781673snz_at_istellar.demon.co.uk>
In article <1994Jun15.092746.4111_at_vaxa> vkwan1_at_vaxa.hofstra.edu writes:
> Hi all,
>
> I am very new to Pro*C. I am having a problem in separating
> the cursor process into three different sub-routines. The error is
> very obvious: After sub_getinfo1() declares and opens the cursor,
> sub_getinfo2 complains the cursor, employee, is NOT declared.
> I have been trying many different ways, like putting extern in
> front of the cursor variable (of course, it doesn't work).
> Is there any way to play around with that? So that even a cursor
> is declared and opened in other sub-routine, the other sub-routine
> still recognize it and use it.
>
> Any help will be appreciated.
>
> (To save space, I skipped posting the part that connects to the
> database and exits from the database. )
>
> Thanks in advance.
What I would say seems to be the problem is that your Oracle variables aren't able to see each other from file to file. I can't think of how to do it off-hand with a cursor since I declare the cursor and do all the processing in one file. In fact, why don't you? It seems a slight case of over-kill for something at this level.
To declare Oracle vars across files, either:
- Redeclare the vars in all the files and pray
- Declare: EXEC SQL BEGIN DECLARE SECTION; VARCHAR tmp_string[100]; EXEC SQL END DECLARE SECTION;
in one file and declare an extern struct tmp_string_struct as a char[100] and an integer, since that's all VARCHAR's are.
Hope this helps!
> V. Kwan
> vkwan1_at_vaxb.hofstra.edu
-- Alligator Descartes 'Pretend I'm dead, and say something nice' v_at_istellar.demon.co.uk -Petronius, "Satyricon"Received on Thu Jun 16 1994 - 17:47:53 CEST