Skip to content
Advertisement

Fetching Results after ibm_db.execute()

Take a look at the following code:

This code sample returns the following error at the fetch_assoc() step.

I dug around a bit more and found that when I use execute() statement, result is that of type Boolean.

But when I use exec_immediate(), result is that of type DBStatement.

Am I doing something wrong? The problem is, there is no sample code in IBM Knowledge Centre which fetches results after an “execute()”

Advertisement

Answer

You already pass in an object of type IBM_DBStatement to execute(). See the API reference for ibm_db.execute() for details. Thus, you need to pass in stmt instead of result. Try something like this:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement