Prepared Statement in Oracle OAF
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
try
{
Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
String Query = "SELECT count(*) count from XX_DAY_V where project_id=:1 and UNIQ_ID is not null";
PreparedStatement stmt = conn.prepareStatement(Query);
stmt.setString(1, project_id);
for(ResultSet resultset = stmt.executeQuery(); resultset.next();)
{
pageContext.writeDiagnostics(this, "Query Executed", 1);
result = resultset.getInt("count");;
pageContext.writeDiagnostics(this, "Query Executed"+ result, 1);
}
}
catch(Exception exception)
{
throw new OAException("Error in Staffing Query"+exception, OAException.ERROR);
}
if(result >0)
{
throw new OAException("One or more Scope Change Order is existing on this project", OAException.INFORMATION);
}
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
try
{
Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
String Query = "SELECT count(*) count from XX_DAY_V where project_id=:1 and UNIQ_ID is not null";
PreparedStatement stmt = conn.prepareStatement(Query);
stmt.setString(1, project_id);
for(ResultSet resultset = stmt.executeQuery(); resultset.next();)
{
pageContext.writeDiagnostics(this, "Query Executed", 1);
result = resultset.getInt("count");;
pageContext.writeDiagnostics(this, "Query Executed"+ result, 1);
}
}
catch(Exception exception)
{
throw new OAException("Error in Staffing Query"+exception, OAException.ERROR);
}
if(result >0)
{
throw new OAException("One or more Scope Change Order is existing on this project", OAException.INFORMATION);
}
No comments:
Post a Comment