Prepared Statement in OAF
Write the following code in Controller.
import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleConnection;
import oracle.jdbc.OracleConnection;
import java.sql.PreparedStatement;
OAApplicationModule oaapplicationmodule = oapagecontext.getRootApplicationModule();
OADBTransaction oadbtransactionimpl = oaapplicationmodule.getOADBTransaction();
PreparedStatement preparedstatement = null;
ResultSet
resultset = null;
OracleConnection conn =
(OracleConnection)oadbtransactionimpl.getJdbcConnection();
try
{
String s1
= "SELECT count(*) FROM
XXSY_ASE_SHIPPING_INFO where
SO_LINE_SHIPMENT=:1";
preparedstatement = conn.prepareStatement(s1);
preparedstatement.setString(1, salesOrderLineShippement);
resultset =
preparedstatement.executeQuery();
if(resultset.next())
{
String vRowCount = resultset.getInt(1);
pageContext.writeDiagnostics(this, (new
StringBuilder()).append("detail data vRowCount:
= ").append(vRowCount).toString(),
2);
resultset.close();
preparedstatement.close();
resultset.close();
preparedstatement.close();
}
}
catch(Exception e)
{
throw
OAException.wrapperException(e);
}
Hi Sridevi,
ReplyDeleteWhy are you using NVL in select statement, Count will not return NULL value it will always return a value Zero or Other number.
Please correct it