[Haskell-cafe] re: Oracle stored procedures

Leonel Fonseca leonelfl at gmail.com
Sat Sep 11 01:35:32 EDT 2010

Hi, Peter

I did and uploaded some examples regarding Oracle and Takusen and the
intended approach you would employ.

Example 01: Create table and some tuples.

Example 02: Create a package with procedures to mantain the table.

Example 03: Optional. See how it works in Oracle sqlplus.

Example 04: The Takusen-Haskell program. It follows the scheme of example #03.

Some comments on the topic:

This approach has limitations. Takusen (if not use in conjunction with
Template Haskell) will be bound up to iteratees of eight values. I
(and I'm pretty sure some other people) have successfully used
Template Haskell to overcome this limitation.
(I've been working in removing some boilerplate).

The all stored procedure approach is not a limitation as you can see
from example #04, unless these procedures return values these types:
Record Of <something>, complex objects (PL/SQL tables, objects, etc),

Oracle has several programatic interfaces, some that I remember: JDBC,
ODBC, OCI, OCCI and those for Windows .NET.

Takusen is a wrapper for OCI (Oracle Call Interface) which seems to me
pretty low level. Yet, I don't know if you can specify just the name
of the procedure.

Please note that if there is a procedure named close_accounts, by
writing "begin close_accounts; end;" you are not wrapping it in a SQL
statement. It actually is an anonymous PL/SQL block and it is needed
in that form to be processed by the server.

Oracle offers for Windows .NET: ODT (Oracle Developer Tools for Visual
Studio), ODP (Oracle Data Provider) and ODE (Oracle Database
Extensions). I did test (and taste) a bit of .NET tools with F#. It
was nice. Maybe you wish to try hs-dotnet with these.

A final remark, I have used Takusen both on Windows and Linux. The
given example was developed and tested actually on Windows.


Leonel Fonseca.

More information about the Haskell-Cafe mailing list