ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Calling all Store Procedure Gurus
Date Mon, 02 May 2005 09:55:50 GMT
Hey all,

I am putting together a comparison of using iBatis dynamic SQL versus
dynamic SQL in a stored procedure. I want to solicit some assistance
on this. If you are willing i would like for you to write a stored
procedure that can accomplish the following requirements.

The stored procedure must use the following SQL statement:

SELECT 
categoryId,
title,
description,
sequence
FROM Category 
WHERE 
categoryId IN (?,?,?,?,...) AND
name LIKE ('?%')

- The 'categoryId IN' should be completely omitted/ignored if no
values are passed in for it and the 'AND' should be removed.
- The 'categoryId IN' statement should be able to accommodate  a
dynamic number of ids.
- The 'name LIKE' statement should be ignored if no LIKE value is
passed in and the 'AND' should be removed..
- The value of the 'name LIKE' should be an alpha character that has
the '%' wildcard appended to it inside the stored procedure.

Please provide straight JDBC code that calls the stored procedure.

I wanted to get a few examples from various databases if possible.
But, one will do as much as several. Whoever delivers the best usable
example will receive credit for it in the an upcoming iBatis book.

I hope a few of you are up for the challenge!
Brandon

P.S. I need this today :)

Mime
View raw message