[Dbix-class] running stored procedures

Peter Rabbitson rabbit+dbic at rabbit.us
Thu Oct 20 17:39:45 GMT 2011

On Thu, Oct 20, 2011 at 06:17:30PM +0100, Roger Day wrote:
> No, my stored procedure does not fail on sqlplus.

I was referring to:


> It's your code that's failing. You wrap any call in a Select statement.
> Select statements cannot contain semi-colons.
> select * from ( Begin <some random procedure>; End;) me;
> You can't have semi-colons in a middle of an embedded SQL statement.

Right, so you asked DBIC to wrap whatever you gave it in a select statement,
and are then complaining that DBIC wrapped it in a SELECT statement...

> Maybe your documentation can be a little more honest in describing what it
> can, because currently, as far as I can see, and you haven't provided a
> decent counter-argument, you cannot run any Oracle stored procedure from
> within the result_source_instance->view_definition method.

You are not calling a stored procedure, you are defining the stored proc on
the fly - DBIC just did what you asked it to do

The stuff you want to pull off needs to be done on a bare DBI handle,
sidestepping DBIC (which is not designed to deal with random data sources in
such manner). I gave you the answer to how to do this in my first email -
$schema->storage->dbh_do (sub { my $dbh = $_[1]; ... code here })

As far as the documentation - I do not see how it is ambiguous, but I would
gladly accept patches clearing this up from your point of view, either
on-list, as an RT, or as a pull request on github.


More information about the DBIx-Class mailing list