| Author |
CallableStatement
|
sonia khetarpal
Greenhorn
Joined: Sep 14, 2006
Posts: 12
|
|
I am using CallableStatement and while using method setLong(String,long), i get error DSRA9010E: 'setLong(String, long)' is not supported on the WebSphere java.sql.CallableStatement implementation. Is it possible to use setLong(String,long) instead setLong(int,long)?
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
Originally posted by sonia khetarpal: Is it possible to use setLong(String,long) instead setLong(int,long)?
Why do you want to do this ?
|
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
|
 |
sonia khetarpal
Greenhorn
Joined: Sep 14, 2006
Posts: 12
|
|
|
we are in process of designing database so tables keep changing and new columns keep getting added. so for the code to be more maintainable i want to use the column name, parameter name of stored procedure instead of index 1,2 3.... which will become difficult to change for long tables
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
I am not sure if I understood your problem. Do you want pass column name as an argument of stored procedure ? Shailesh
|
 |
sonia khetarpal
Greenhorn
Joined: Sep 14, 2006
Posts: 12
|
|
|
yes i want to pass column name in setLong(columnName, value) can you help the name of parameter in my stored procedure is same as my columnName
|
 |
sonia khetarpal
Greenhorn
Joined: Sep 14, 2006
Posts: 12
|
|
|
yes i want to pass column name in setLong(columnName, value) can you help the name of parameter in my stored procedure is same as my columnName
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
my apologies ! still I didn't understand . could you please paste signature and few lines of stored procedure........ shailesh
|
 |
sonia khetarpal
Greenhorn
Joined: Sep 14, 2006
Posts: 12
|
|
stored procedure create procedure get_country @country_id bigint=null, @country_code varchar(3)=null, @country_name varchar(50)=null, @active bit=null, @created_by bigint=null, @created_time datetime=null, @modified_by bigint=null, @modified_time datetime=null as selectc.country_id, c.country_code, c.country_name, c.active, c.note, c.created_by, c.created_time, c.modified_by, c.modified_time from country c where ((@country_id is null)or(c.country_id=@country_id)) and((@country_code is null)or(c.country_code=@country_code)) and((@country_name is null)or(c.country_name=@country_name)) and((@active is null)or(c.active=@active)) and((@created_by is null)or(c.created_by=@created_by)) and((@created_time is null)or(c.created_time=@created_time)) and((@modified_by is null)or(c.modified_by=@modified_by)) and((@modified_time is null)or(c.modified_time=@modified_time)) GO code c=ConnectionManager.getConnection(); CallableStatement s=c.prepareCall(MSCountryDAO.SQL_GET_COUNTRY) s.setString(MSCountryDAO.COLUMN_COUNTRY_CODE,country.getCountryCode());//@country_code s.setString(MSCountryDAO.COLUMN_COUNTRY_NAME,country.getCountryName());//@country_name s.setObject(MSCountryDAO.COLUMN_ACTIVE,country.isActive(),Types.BIT);//@active
|
 |
sonia khetarpal
Greenhorn
Joined: Sep 14, 2006
Posts: 12
|
|
stored procedure create procedure get_country @country_id bigint=null, @country_code varchar(3)=null, @country_name varchar(50)=null, @active bit=null, @created_by bigint=null, @created_time datetime=null, @modified_by bigint=null, @modified_time datetime=null as select c.country_id, c.country_code, c.country_name, c.active, c.note, c.created_by, c.created_time, c.modified_by, c.modified_time from country c where ((@country_id is null)or(c.country_id=@country_id)) and ((@country_code is null)or(c.country_code=@country_code)) and ((@country_name is null)or(c.country_name=@country_name)) and ((@active is null)or(c.active=@active)) and ((@created_by is null)or(c.created_by=@created_by)) and ((@created_time is null)or(c.created_time=@created_time)) and ((@modified_by is null)or(c.modified_by=@modified_by)) and ((@modified_time is null)or(c.modified_time=@modified_time)) GO code private static final String COLUMN_COUNTRY_CODE="country_code"; private static final String COLUMN_COUNTRY_NAME="country_name"; private static final String COLUMN_ACTIVE="active"; .... c=ConnectionManager.getConnection(); CallableStatement s=c.prepareCall(MSCountryDAO.SQL_GET_COUNTRY) s.setString(MSCountryDAO.COLUMN_COUNTRY_CODE,country.getCountryCode());//@country_code s.setString(MSCountryDAO.COLUMN_COUNTRY_NAME,country.getCountryName());//@country_name s.setObject(MSCountryDAO.COLUMN_ACTIVE,country.isActive(),Types.BIT);//@active
|
 |
 |
|
|
subject: CallableStatement
|
|
|