Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

Oracle cx_Oracle example

# myscript.py

import cx_Oracle

# Connect as user "hr" with password "welcome" to the "orclpdb1" service running on this computer.
connection = cx_Oracle.connect(user="hr", password="welcome",
                               dsn="localhost/orclpdb1")

cursor = connection.cursor()
cursor.execute("""
        SELECT first_name, last_name
        FROM employees
        WHERE department_id = :did AND employee_id > :eid""",
        did = 50,
        eid = 190)
for fname, lname in cursor:
    print("Values:", fname, lname)
Source by cx-oracle.readthedocs.io #
 
PREVIOUS NEXT
Tagged: #Oracle
ADD COMMENT
Topic
Name
8+9 =