forked from oracle/python-cx_Oracle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrowfactory.py
More file actions
24 lines (18 loc) · 763 Bytes
/
rowfactory.py
File metadata and controls
24 lines (18 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#------------------------------------------------------------------------------
# rowfactory.py (Section 8.1)
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Copyright 2017, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------
import collections
import cx_Oracle
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
cur = con.cursor()
cur.execute("select deptno, dname from dept")
res = cur.fetchall()
print('Array indexes:')
for row in res:
print(row[0], "->", row[1])
print('Loop target variables:')
for c1, c2 in res:
print(c1, "->", c2)