title: numeric or value error on the procedure I've been calling in java
body: <p>When I'm calling the procedure in java in my callable statement it says that I have a numeric or value error in my code. Yet, when I've tried to run the SQL file alone on oracle database it works fine. There are numeric or value error appearing on it and the result that I need comes out perfectly fine. So I don't understand why whenever that procedure is called in my java class it keeps on saying that error. I tried to locate the line where the so-called error is and here it is...</p>
  
  <p>Here's the code for my procedure</p>
  
  <pre><code>CREATE OR REPLACE
  PROCEDURE RENTING
  (P_NNAME IN VARCHAR2,
  P_ADD IN VARCHAR2,
  P_PHONE IN NUMBER,
  P_ORDER IN VARCHAR2,
  P_EMP_ID IN NUMBER,
  P_VALID OUT NUMBER,
  P_OR_NO OUT NUMBER
  )
  IS
  V_AVAI  TITLE.AVAILABLE%TYPE;
  P_OR VARCHAR2(5000);
  P_OR_2 VARCHAR2(5000);
  ORD_NO NUMBER(6);
  TID NUMBER(38);
  NUM NUMBER(3);
  CTR NUMBER(3);
  GO NUMBER(1);
  BEGIN
  P_OR:=P_ORDER;
  ORD_NO:=SEQ_ORDER_NO.NEXTVAL;
  
  INSERT INTO TRANSACTIONS (ORDER_NO, CUST_NICKNAME, CUST_ADD, CUST_CONTACT)
  VALUES (ORD_NO, P_NNAME, P_ADD, P_PHONE);
  
  INSERT INTO RENTS (ORDER_NO,ORDERS,DATERENTED,EMP_ID,DATERETURNED)
  VALUES (ORD_NO,P_OR,SYSDATE,P_EMP_ID,NULL);
  
  LOOP
    CTR:=INSTR(P_OR,';');
    NUM:=LENGTH(P_OR);
    IF CTR!=0 THEN
      CTR:=CTR-1;
      P_OR_2:=SUBSTR(P_OR,1,CTR);
      TID:=TO_NUMBER(P_OR_2);        //here's the part of the conversion that is wrong in java
      CTR:=CTR+2;
      P_OR:=SUBSTR(P_OR,CTR,NUM);
      SELECT AVAILABLE 
      INTO V_AVAI
      FROM TITLE
      WHERE TITLE_ID=TID;
      IF V_AVAI!=0 THEN
        UP(TID);
        P_VALID:=1;
      ELSIF V_AVAI=0 THEN
        P_VALID:=0;
      END IF;
    ELSIF CTR = 0 THEN
      P_OR_2:=SUBSTR(P_OR,1,NUM);
      TID:=TO_NUMBER(P_OR_2);
      SELECT AVAILABLE 
      INTO V_AVAI
      FROM TITLE
      WHERE TITLE_ID=TID;
      IF V_AVAI!=0 THEN
        UP(TID);
        P_VALID:=1;
        P_OR_NO:=ORD_NO;
      ELSIF V_AVAI=0 THEN
        P_VALID:=0;
      END IF;
      GO:=1;
    END IF;
    EXIT WHEN GO=1;
  END LOOP;
  END RENTING;
  /
  </code></pre>