Martin Klang | 30 Jan 2006 15:01
Picon
Favicon

Re: oXml DB Question

Hi Michael,

I've little experience of stored procedures so I'll have to  
investigate this further, however here's an initial reply that might  
help.

With db:execute you can run any SQL query. There's no explicit  
support for stored procedures (or CallableStatements in JDBC) though  
you should be able to call a procedure with something like:
<db:execute sql="{call FOOBAR}"/><!-- call the stored procedure  
'FOOBAR' -->
On Oracle the syntax _may_ be:
<db:execute sql="{exec FOOBAR}"/>

If you want to use the result set you should be able to include a  
result template as the db:execute body as usual. For example, if  
FOOBAR returns a column called 'FOO', you can do:
<db:execute sql="{call FOOBAR}"><foobar>{$foo}</foobar></db:execute>
This should, theoretically, produce a foobar element for each row in  
the result.

Otherwise I'm told that you can wrap a stored procedure in a SQL  
function, which can then be used in a normal select statement.

I'm not sure about passing parameters or returning values, I'll have  
to look into that.

hope this helps!

/m

On 29 Jan 2006, at 7:15, Michael Wilson wrote:

> I have a stored procedure on my database server.  Using the db
> extensions is it possible to call the stored procedure with oXML?  The
> documentation web page mentions the <db:execute> but doesn't give a
> complete example.  Such as how do you define the datasource when using
> this method?  Anyway, if anyone is reading this that knows if this is
> possible can I get a short example?  Thanks.
>
> Mike
>
> _______________________________________________
> o-xml mailing list
> o-xml@...
> http://lists.pingdynasty.com/mailman/listinfo/o-xml

Gmane