Вместо выполнения файла вы можете выполнить запрос, определенный в вашем коде.
import cx_Oracle
dsn_tns = cx_Oracle.makedsn('Host Name', 'Port Number', service_name='Service Name') #if needed, place an 'r' before any parameter in order to address any special character such as '\'.
conn = cx_Oracle.connect(user=r'User Name', password='Personal Password', dsn=dsn_tns) #if needed, place an 'r' before any parameter in order to address any special character such as '\'. For example, if your user name contains '\', you'll need to place 'r' before the user name: user=r'User Name'
query = """
Select * from student where age > 18;
DeletE student_ name , studen_id if age > 18
"""
c = conn.cursor()
c.execute(query) # use triple quotes if you want to spread your query across multiple lines
print('Result', c)
#conn.close()