How To Call and Get Value From Stored Procedure In Java

Here is simple example to get data by call stored procedure using Java. The scenario is we want to get value with some parameter.

The procedure:

CREATE OR REPLACE PROCEDURE BOHAY_SCHEME.GETBILLAMOUNT 
                      (productid IN varchar2,
                      billid IN varchar2,
                      amount OUT number
                    )
IS
BEGIN
   select bill_amount into amount 
   from t_bill
   where product_id = productid 
     and bill_id = billid; 
END;

The data on database:

+-----------+-------------+-------------+
|product_id |bill_id	  |bill_amount	|
+-----------+-------------+-------------+
|123	    |419473649323 |500000       |
+-----------+-------------+-------------+

Continue reading “How To Call and Get Value From Stored Procedure In Java”

Advertisement