Here's a sample script (cut between the lines):
-------------------------------------------------------------------
#!/usr/bin/env python

import cx_Oracle

# Establish a connection:
connection = cx_Oracle.connect('user/[EMAIL PROTECTED]')

# Create a cursor object:
cursor = connection.cursor()

# Run your query:
cursor.execute('''select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') now from
dual''')

# Get the column names:
cols = tuple([x[0].lower() for x in cursor.description])

# Fetch the results:
rs = cursor.fetchall()

# Turn them into rows:
rows = [dict(zip(cols, r)) for r in rs]

# Loop through the rows and print out the results:
for row in rows:
    print 'According to Oracle, the time now is:', row['now']

# That's it!
-------------------------------------------------------------------

Replace user/[EMAIL PROTECTED] with the string you would use to connect to
Oracle with SQL*Plus, and that should do it.

Good luck!

Regards,

.... Bob

2008/6/11 Marcel Rosa <[EMAIL PROTECTED]>:

> I am Oracle DBA and would like to use a python to developer some intranet
> report,
>
> do you have same examples?
>
>
>
> thanks.
>
> ------------------------------
> Abra sua conta no Yahoo! 
> Mail<http://br.rd.yahoo.com/mail/taglines/mail/*http://br.mail.yahoo.com/>,
> o único sem limite de espaço para armazenamento!
>
> _______________________________________________
> DB-SIG maillist  -  DB-SIG@python.org
> http://mail.python.org/mailman/listinfo/db-sig
>
>
_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to