Executando Store Procedure!

Pesquisei no forum e na internet como executar store procedure com jdbc e achei somente de inclusao !!!

Gostaria de saber como q eu faço pra executar uma procedure que retorno valor !!!

Eu fiz assim:

ResultSet rs = statement.execute("NomeDaProcedure " + argumento1 + “,” + argumento2) e da erro !!!

com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StatementExecutionRequest.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQuery(Unknown Source)
at Broker.BrokerSincronizarLigacoes.getValorCusto(BrokerSincronizarLigacoes.java:267)
at Broker.BrokerSincronizarLigacoes.sincronizarLigacoes(BrokerSincronizarLigacoes.java:163)
at Model.SincronizarLigacoes.sincronizarLigacoes(SincronizarLigacoes.java:9)
at Control.CtrlSincronizarLigacoes.sincronizarLigações(CtrlSincronizarLigacoes.java:11)
at View.FormSincronizarLigacoes.sincronizarLigacoes(FormSincronizarLigacoes.java:64)
at View.FormSincronizarLigacoes.<init>(FormSincronizarLigacoes.java:47)
at View.FormDesktop.actionPerformed(FormDesktop.java:145)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Alguem sabe como q faz ?? A procedure vai me retornar um decimal(10,2) !!!

VLW

Exemplo retirado do guia de consulta rápida da novatec JDBC2, de Fábio Ramon:


// con é a sua conexão
// procC é a procedure

String sql = &quot;&#123;call procC&#91;?,?,?&#93;&#125;&quot;;
CallableStatement stmt = con.prepareCall&#40;sql&#41;;

// primeiro ? é somente de entrada
stmt.setString&#40;1,&quot;nome&quot;&#41;;

//demais ? são de saída
stmt.registerOutParameter&#40;2,java.sql.Types.INTEGER&#41;;
stmt.registerOutParameter&#40;3,java.sql.Types.TINYINT&#41;;

//execução do comando
stmt.execute&#40;&#41;;

//leitura de parâmetros de saída
int i = stmt.getInt&#40;2&#41;;
byte b = stmt.getByte&#40;3&#41;;