forked from oracle-samples/oracle-db-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRefCursor.py
29 lines (23 loc) · 928 Bytes
/
RefCursor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#------------------------------------------------------------------------------
# Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# RefCursor.py
# Demonstrates the use of REF cursors with cx_Oracle.
#------------------------------------------------------------------------------
import cx_Oracle
import SampleEnv
connection = cx_Oracle.connect(SampleEnv.GetMainConnectString())
cursor = connection.cursor()
refCursor = connection.cursor()
cursor.callproc("myrefcursorproc", (2, 6, refCursor))
print("Rows between 2 and 6:")
for row in refCursor:
print(row)
print()
refCursor = connection.cursor()
cursor.callproc("myrefcursorproc", (8, 9, refCursor))
print("Rows between 8 and 9:")
for row in refCursor:
print(row)
print()