What is the best way to access stored procedures in Django’s ORM

We (musicpictures.com / eviscape.com) wrote that django snippet but its not the whole story (actually that code was only tested on Oracle at that time). Stored procedures make sense when you want to reuse tried and tested SP code or where one SP call will be faster than multiple calls to the database – or … Read more

Inserting into Oracle and retrieving the generated sequence ID

Expanding a bit on the answers from @Guru and @Ronnis, you can hide the sequence and make it look more like an auto-increment using a trigger, and have a procedure that does the insert for you and returns the generated ID as an out parameter. create table batch(batchid number, batchname varchar2(30), batchtype char(1), source char(1), … Read more

Execute “sp_msforeachdb” in a Java application

If a statement can return no or multiple results, you should not use executeQuery, but execute() instead, this method returns a boolean indicating the type of the first result: true: result is a ResultSet false : result is an update count If the result is true, then you use getResultSet() to retrieve the ResultSet, otherwise … Read more

Stored Procedures, MySQL and PHP

@michal kralik – unfortunately there’s a bug with the MySQL C API that PDO uses which means that running your code as above with some versions of MySQL results in the error: “Syntax error or access violation: 1414 OUT or INOUT argument $parameter_number for routine $procedure_name is not a variable or NEW pseudo-variable”. You can … Read more

MySQL Stored Procedures not working with SELECT (basic question)

Figured it out. This is not a bug with PHP (though it used to be) – it’s a bug in some versions of phpmyadmin. The same bug intermittently reappears and is then fixed in various subversions (see above): #1312 – PROCEDURE [name] can’t return a result set in the given context This behavior appears limited … Read more