My SP do include a DELETE and a INSERT INTO statement. If DELETE statement success, but INSERT INTO do not, JAVA will only look at the first statement and concluded that the whole SP was executed successfully, which might be wrong.

How can I executed more then one statement and get a exception in JAVA if just one of the statement fails.
I have been tried with TRY-CATCH in SQL but it all concluded that the all statement was executed correctly because the first statement success.

It is a MS SQL 2008 Database

```
ALTER PROCEDURE [testing] 
    @bikes  varchar(8000), 
    @groupw varchar(4), 
    @name char(6)

AS
BEGIN

        DELETE CP_customer_kngr_corr_s WHERE knid in ('blue')

        DECLARE @pos INT
        DECLARE @len INT
        DECLARE @value varchar(8000)

        set @pos = 0
        set @len = 0
        set @bikes= @bikes  +','

        WHILE CHARINDEX(',', @bikes, @pos)>0 BEGIN
            set @len = CHARINDEX(',', @bikes, @pos+1) - @pos
            set @value = SUBSTRING(@bikes, @pos, @len)

            INSERT INTO [bikes]
               ([bikes])
            VALUES
                (@value)

            set @pos = CHARINDEX(',', @bikes, @pos+@len) +1
        END 
END

```