Hi,
I'm getting org.springframework.jdbc.BadSqlGrammarException when i try to fetch the records from the table.
Below is the code which i'm using to query the table. To the simpleJdbcCall object, i'm declaring 9 parameters (1 IN, 8 OUT). But when i execute using
I'm getting the below exception.Code:simpleJdbcCall.execute(fiscalYearCalendarInputMap);
HTML Code:error in downloadcom.netapp.smart.framework.spreadsheet.SpreadSheetException: CallableStatementCallback; bad SQL grammar [{call SMRT_WORKFLOW_PKG.SP_GETFISCALYEARDETAILSBYFY(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}]; nested exception is java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SP_GETFISCALYEARDETAILSBYFY' ORA-06550: line 1, column 7: PL/SQL: Statement ignoredPlease let me know why the parameters are getting duplicated while i use spring dao?Code:public class SystemEntityDaoImpl extends SimpleJdbcDaoSupport implements SystemEntityDao { public FiscalYearCalendar getFiscalYearDetailsByFiscalYear(String fiscalYear) throws DataAccessException { // Name of the database package final String packageName = storedProcedureMessageSource.getMessage(PKG_SMART_WORKFLOW, null, Locale.getDefault()); // Name of the stored procedure, which fetches all other information of // FiscalYearCalendar having the specified fiscalYear final String storedProcedureName = storedProcedureMessageSource.getMessage(SP_GET_FISCAL_YEAR_DETAILS_BY_FISCAL_YEAR, null, Locale .getDefault()); logger.debug(" Inside getFiscalYearDetailsByFiscalYear() - Stored Procedure name:" + storedProcedureName); SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(getDataSource()).withCatalogName(packageName).withProcedureName(storedProcedureName) .declareParameters( // Specifying the sql data types of all the // parameters(both IN-OUT parameters) of // the stored-procedure. new SqlOutParameter("fiscalyearid", Types.BIGINT), new SqlOutParameter("effectivestartdate", Types.DATE), new SqlOutParameter("effectiveendtdate", Types.DATE), new SqlOutParameter("description", Types.VARCHAR), new SqlOutParameter("systemcreateduserid", Types.BIGINT), new SqlOutParameter("systemlastmodifieduserid", Types.BIGINT), new SqlOutParameter("systemcreatedtimestamp", Types.DATE), new SqlOutParameter("systemlastmodifiedtimestamp", Types.DATE), new SqlParameter("fiscalyear", Types.VARCHAR)); // A MapSqlParameterSource object, specifying the parameter of // the stored-procedure. MapSqlParameterSource fiscalYearCalendarInputMap = new MapSqlParameterSource(); fiscalYearCalendarInputMap.addValue("fiscalyear", fiscalYear); // Executing the stored procedure Map fiscalYearCalendarResultMap = simpleJdbcCall.execute(fiscalYearCalendarInputMap); FiscalYearCalendar fiscalYearCalendar = new FiscalYearCalendar(); fiscalYearCalendar.setFiscalYear(fiscalYear); fiscalYearCalendar.setFiscalYearId((Long) fiscalYearCalendarResultMap.get("fiscalyearid")); fiscalYearCalendar.setEffectiveStartDate((Date) fiscalYearCalendarResultMap.get("effectivestartdate")); fiscalYearCalendar.setEffectiveEndDate((Date) fiscalYearCalendarResultMap.get("effectiveendtdate")); fiscalYearCalendar.setDescription((String) fiscalYearCalendarResultMap.get("description")); fiscalYearCalendar.setSystemCreatedUserId((Long) fiscalYearCalendarResultMap.get("systemcreateduserid")); fiscalYearCalendar.setSystemCreatedTimeStamp((Date) fiscalYearCalendarResultMap.get("systemcreatedtimestamp")); fiscalYearCalendar.setSystemLastModifiedUserId((Long) fiscalYearCalendarResultMap.get("systemlastmodifieduserid")); fiscalYearCalendar.setSystemLastModifiedTimeStamp((Date) fiscalYearCalendarResultMap.get("systemlastmodifiedtimestamp")); return fiscalYearCalendar; } // End of getFiscalYearDetailsByFiscalYear() method. }
FYI: I tried accessing the same SP with simple java code, its working fine.
--Velmurugan.S--


Reply With Quote