473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Python and PL/SQL

Does Pyton PL/SQL programming language of Oracle support?

Thx

Nov 7 '05 #1
7 8367

vb_bv wrote:
Does Pyton PL/SQL programming language of Oracle support?

Thx


PL/SQL is only supported *inside* Oracle databases. Python can be used
to call PL/SQL procedures (I recommend the cx_Oracle module), but you
can't run Python inside the database like PL/SQL.

Nov 7 '05 #2
vb_bv wrote:
Does Pyton PL/SQL programming language of Oracle support?


Python supports calling Oracle PL/SQL procedures. Here's an example
using the cx_Oracle database adapter:
import cx_Oracle
con = cx_Oracle.connect("outlinetest/soca@soca_tsn")
cur = con.cursor()
cur.execute("""

.... BEGIN
.... PKG_Test.Test;
.... END;
.... """)

cx_Oracle also works with all types I needed, including passing ARRAYs
to stored procedures, and getting REFCURSORs back.

-- Gerhard

Nov 7 '05 #3
infidel wrote:
vb_bv wrote:
Does Pyton PL/SQL programming language of Oracle support?

PL/SQL is only supported *inside* Oracle databases. Python can be used
to call PL/SQL procedures (I recommend the cx_Oracle module), but you
can't run Python inside the database like PL/SQL.


If one is really really really insisting on running Python code inside
an Oracle database, I think it could be done: you can write Oracle
stored procedures in C libraries, Java libraries and even .NET libraries
(10g on win32). And there are Python implementations for C, Java and .NET.

So much for the theory.

In my not so humble opinion, instead of all this fancy stuff, you will
be better off writing your stored procedures in PL/SQL, which is a very
good language for manipulating data, and writing portable, efficient and
maintainable server-side database code.

-- Gerhard

Nov 7 '05 #4
Gerhard Häring <gh@ghaering.de> writes:
In my not so humble opinion, instead of all this fancy stuff, you will be
better off writing your stored procedures in PL/SQL, which is a very good
language for manipulating data, and writing portable, efficient and
maintainable server-side database code.


And if Python is the requirement, but not Oracle, one can write "stored
procedures" (functions is the name) in Python with PostgreSQL. ;-)

--
Jorge Godoy <go***@ieee.org>
Nov 7 '05 #5
Thanks for your answers.
I would like to document with Python PL/SQL of programs, so similarly
as javadoc for Java.
I do not know whether it is possible. If yes, I would like to know how.

Thx

Nov 7 '05 #6

vb_bv wrote:
Thanks for your answers.
I would like to document with Python PL/SQL of programs, so similarly
as javadoc for Java.
I do not know whether it is possible. If yes, I would like to know how.

Is it possible - yes. Has it been done? I doubt it. You can fetch the
sourcecode of oracle packages through sql-statements (google for how to
do it), and then process it with whatever tool you like. But you will
have to write your own parser and generator for that, pydoc or epydoc
won't be of much use here. However, implementing such a thingy in
python is certainly a good idea.

Diez

Nov 7 '05 #7
> Thanks for your answers.
I would like to document with Python PL/SQL of programs, so similarly
as javadoc for Java.
I do not know whether it is possible. If yes, I would like to know how.


All of the source code for procedures and packages in an oracle
database can be retreived from the USER_SOURCE view. It's just plain
text, though, and one record per line. Parsing it for documentation
would be up to you.

There are other views that might be useful too, like USER_TABLES,
USER_TAB_COLUMNS, USER_OBJECTS, USER_PROCEDURES, USER_ARGUMENTS, etc
etc etc

Nov 7 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.