On Thu, Sep 6, 2012 at 8:45 PM, shaun <shaun.wisema...@gmail.com> wrote:
> ////CODE///////////////////////////////
>
> def databasebatchcall(self,tid, bid):
>         
> con=cx_Oracle.connect('user/user...@odb4.dcc.company/ODB4TEST.COMPANY.COM')
>         cur = con.cursor()
>         cur.execute("SELECT * FROM name)
>         results = cur.fetchall()
> //////////////////////////////////////////
>
> From this last line I get the following error which I don't understand I'm 
> very new to python and have no idea about this any help would be appreciated
>
>
> //////////////////////////////////////////////
>
> File "/home/dcroke/mdcFDACStringCall.py", line 21, in fetchbatchdata
>     results = cur.fetchall()
> NameError: global name 'cur' is not defined
>
> //////////////////////////////////////////////
>

Not quite, actually. The traceback names a different function. Look in
your code for a 'fetchbatchdata' function; it looks like you need to
pass the cursor from one function to the other.

To further assist, we'd need to see more of the code; but for a guess,
I would say that you either need to make cur a function argument, or
else (since this is class) an instance member, which you'd reference
as 'self.cur'.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to