MySQL Forums
Forum List  »  Stored Procedures

Re: Variable number of arguments
Posted by: Peter Brawley
Date: May 25, 2007 09:31PM

No, MySQL sprocs accept only a fixed number of arguments. ISO SQL is somewhat optimised for correct RDBMS logic (unless you were to ask EF Codd, CJ Date or Fabian Pascal), but in many ways SQL is quite literal, so if SQL seems to make what you are trying to do very difficult, it could be that your design needs another look, in this case aspects of the design that require repeated multiple ad hoc deletions.

If such deletions are unavoidable, here are three options. First, in an application language build the delete query to include comma-delimited string of IDs. Second, pass such a string to an sproc that PREPAREs the query using such a string. Third, populate a temp table with the target IDs and write a simple join query that deletes the joined IDs.

PB

Options: ReplyQuote


Subject
Views
Written By
Posted
7959
V K
May 24, 2007 09:32AM
3092
V K
May 25, 2007 03:46PM
Re: Variable number of arguments
3263
May 25, 2007 09:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.