How to execute Oracle Function from Python Script | Python programming |
This is the ninth video of Database programming with Python video tutorial series. In this video we will see how to connect to the Oracle database using the cx_oracle package and execute oracle functions using the callfunc method, we will see how we can pass parameters to the function from python script, and store the result back into a python variable.
How to execute an Oracle Function from Python Script?
result = callfunc(function_name,output_variable, parameters)
The returnType parameter for callfunc() is expected to be a Python type, one of the cx_Oracle types or an Object Type.
Steps performed:
================
Create Connection
Create Cursor
execute the function with callfunc
close the cursor
close the connection
The cx_Oracle is a Python extension module that enables access to Oracle Database. It conforms to the Python database API 2.0 specification with a considerable number of additions and a couple of exclusions.
cx_Oracle 7 has been tested with Python version 2.7, and with versions 3.5 through 3.8. You can use cx_Oracle with Oracle 11.2, 12, 18 and 19 client libraries. Oracle's standard client-server version interoperability allows connection to both older and newer databases. For example Oracle 19c client libraries can connect to Oracle Database 11.2.
Links to all videos related to Database programming with Python
=================================================================
1. Install cx_Oracle : https://youtu.be/NZ28xlUUEoA
2. Create connection and create table : https://youtu.be/6OwZvANOZaE
3. Insert record into the table with execute() : https://youtu.be/W0Ny-N0sOEg
4. Insert multiple records into the table with executemany() : https://youtu.be/HmKjbFnOaUU
5. Retrive all the data from the table using the fetchall() : https://youtu.be/dTxS3e2OkDc
6. Retrive one record from the table using the fetchone() : https://youtu.be/VCHoIZi7hew
7. Retrive specific number of records from the table using the fetchmany() : https://youtu.be/zePkstJ-O5U
8. Use Bind Variables in the select statement to avoid complicating the query with concatenation operation : https://youtu.be/L_tEpakjv8U
9. use callproc method to execute oracle procedure with parameters : https://youtu.be/kcy1U7TIee4
10. use callfunc method to execute oracle function with parameters : https://youtu.be/ghx9gOFnibQ
Tools used in creating and executing the scripts:
==================================================
VSCode - Visual Studio Code
SQL Developer
Links used while creating the content:
=======================================
https://en.wikipedia.org/wiki/Pip_(package_manager)
https://oracle.github.io/python-cx_Oracle/
https://github.com/oracle/python-cx_Oracle/tree/master/samples
Content and video created by - Kishan Mashru
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «How to execute Oracle Function from Python Script | Python programming |», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.