-
call stored procedure with parameter
Hi,
everyone.
Could you show me how can I pass a parameter to call a stored procedure
? I have been successfully to do it without any parameters as following:
CallableStatement cs = dbconn.prepareCall("{call qGetProduct}");
but, what can I do with parameters passing?
Thank you!
-
Re: call stored procedure with parameter
"tammy" <yan.zhang@unitedchambers.com> wrote:
>
>Hi,
> everyone.
> Could you show me how can I pass a parameter to call a stored procedure
>? I have been successfully to do it without any parameters as following:
>
>CallableStatement cs = dbconn.prepareCall("{call qGetProduct}");
>
>but, what can I do with parameters passing?
>
> Thank you!
Hi Tammy ,
I'll give you an example to explain :
String s = new String({?= call multiply[?,?]});
CallableStatement cs = dbconn.prepareCall(s);
cs.setInt(2, 10);
cs.setInt(3, 30);
cs.registerOutParameter(1 ,NUMBER); // NUMBER is a sqlType
ResultSet rs = cs.executeUpdate;
rs.getInt(1);
this is how it goes.
Thanks
Madhav
>
>
>
-
Re: call stored procedure with parameter
Hi tommy,
Read JDBC part of java tutorial. very good one.
Cheers
syed zulfiqar
"Madhav" <djlintls@hotmail.com> wrote:
>
>"tammy" <yan.zhang@unitedchambers.com> wrote:
>>
>>Hi,
>> everyone.
>> Could you show me how can I pass a parameter to call a stored procedure
>>? I have been successfully to do it without any parameters as following:
>>
>>CallableStatement cs = dbconn.prepareCall("{call qGetProduct}");
>>
>>but, what can I do with parameters passing?
>>
>> Thank you!
>
>Hi Tammy ,
>I'll give you an example to explain :
>
>String s = new String({?= call multiply[?,?]});
>
>CallableStatement cs = dbconn.prepareCall(s);
>cs.setInt(2, 10);
>cs.setInt(3, 30);
>
>cs.registerOutParameter(1 ,NUMBER); // NUMBER is a sqlType
>ResultSet rs = cs.executeUpdate;
>rs.getInt(1);
>
>this is how it goes.
>
>Thanks
>Madhav
>
>
>
>
>>
>>
>>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks