snakay -6 Junior Poster in Training

Hi,

I like to debug stored procedure in IBM DB2. I'm getting "string right truncation" error somewhere in stored procedure that I want to debug. How do I continue debugging from my c# code to stored procedure.
c# code

String procName = "REG_DETAILS";
                OleDbCommand cmd = conn.CreateCommand();
                cmd.Transaction = trans;
                cmd.CommandText = procName;
                cmd.CommandType = CommandType.StoredProcedure;
 OleDbParameter parm = cmd.Parameters.Add("@PatNo", OleDbType.VarChar);
                parm.Direction = ParameterDirection.Input;
                parm.Value =dfPatNo.Text;
                parm = cmd.Parameters.Add("@Name", OleDbType.VarChar);
                parm.Direction = ParameterDirection.Input;
                parm.Value = dfName.Text;
 parm = cmd.Parameters.Add("@spPatNo", OleDbType.Integer);
                parm.Direction = ParameterDirection.ReturnValue;

cmd.ExecuteNonQuery(); // here I jump to stored procedure

stored procedure in IBM DB2

CREATE PROCEDURE DB2ADMIN.REG_DETAILS(
		IN	VPATNO		VARCHAR ( 8 ),
		IN	VNAME		VARCHAR ( 20 ),
		OUT RPATNO		INT)
	SPECIFIC DB2ADMIN.REG_DETAILS
	DYNAMIC RESULT SETS 1


P1: BEGIN



DECLARE myCur CURSOR WITH RETURN TO CALLER
 FOR SELECT   next_patient_no   FROM prmt0101;

  IF VPATNO !=''
	THEN
		update prmt0101 set next_patient_no=next_patient_no+1;	

		
OPEN myCur;
	
   FETCH myCur INTO RPATNO;
	
		
		
	
INSERT INTO prmt0100 (patient_no,name_family)
                      values (VPATNO,VNAME);
   
                                             
    
  ELSE
	     UPDATE prmt0100 set name_family=VNAME                 where patient_no=VPATNO;
        
         SET RPATNO=NULL;            
  END IF;

RETURN RPATNO;

thanks
snky

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.