cancel
Showing results for 
Search instead for 
Did you mean: 

How to fetch results from SQL query returning multiple rows?

Former Member
0 Kudos

Hi,

I need to use sql query in custom code for reminder emails.

I refered below code :

import com.frictionless.api.common.platform.IapiDbHandleIfc;    dbHandle = session.getDbHandle();  dbHandle.beginTransaction();  sQuery = "SELECT DOC_DESCRIPTION " +       "FROM " +       "FCI_CUSTOM_MD2 " +       "WHERE " +       "EID = '" + sParameter + "'";  dbHandle.executeQuery(sQuery);

  

But my query would return multiple rows with different types of column data.

What will be the return type of Query Results?

How to fetch multiple rows, where to return them?

Please guide me through.

Thanks,

Saloni

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Saloni,

Sounds like you are trying to get the description of the custom master data object. You should be able to do this by calling IAPI method getDocumentDescription().In general, try to find solution that don’t require DBHandle class and it should be considered only as a last resort. In cases where you have a need to use DBHandle class, I would recommend reading the Scripting and Workflow guide on SMP that explains how to use DbHandle class as it has specific coding protocols. If those are not followed it will result in system performance issues.

Regards,

Vikram

Former Member
0 Kudos

Hi Vikram,

No, I am not trying to get the description of the custom master data object. I just was trying to use this sample code.

My requirement is to actually execute query that returns pending approvals and then send reminder emails to approvers from returned resultset. I need help on how to write query code in my custom java code class.

I came across dbhandle and dbaccessor methods. But need help on this. Which one is better way to execute the query that returns multiple rows.

Please guide me if you have idea on it.

Thanks,

Saloni

Answers (0)