title: String Compare in Oracle Procedure
body: <p>Trying to compare two string. one from IN parameter(myname) and another is Hard coded('abcd').</p>
  
  <pre><code>(myname IN  VARCHAR2)
  -- myname will be set to 'abcd' when calling this procedure
  DECLARE
  name VARCHAR2(10):=myname;
  IF(name='abcd') THEN
  --update something in database
  END IF;
  </code></pre>
  
  <p>Actual code is given below. idegreeName is set to 'HONS'. if I remove if block then my procedure works fine. but I need IF block to execute update query.</p>
  
  <pre><code>// Calling in JAVA
  stmt = (OracleCallableStatement) conn.prepareCall("{ call receiveAdmission2(?,?,?,?,?,?,?,?,?,?,?,?,?,?)  }");
  // my procedure
      CREATE OR REPLACE PROCEDURE NU_DB.receiveAdmission2 (
  
     iAdmissionRoll          IN  VARCHARARRAY,
     iUserId                 IN  VARCHAR2,
     iCollegeCode            IN  VARCHAR2,
     isessionId              IN  VARCHAR2,
     isubjectId              IN  VARCHAR2,
     iMeritType              IN  VARCHAR2,
     iStatus                 IN  VARCHAR2,
     iXforward               IN  VARCHAR2,
     iVia                    IN  VARCHAR2,
     iRemoteAddress          IN  VARCHAR2,
  
     oResponseCode           OUT NUMBER,
     oResponseMessage        OUT VARCHAR2,
     oResponse               OUT VARCHAR2,
  
     idegreeName              IN  VARCHAR2
  
  )
  IS
  
   tErrorCode   VARCHAR2(20);
   tErrorMsg    VARCHAR2(400);
   tResponse    VARCHAR2(100);
  
  BEGIN
  
      oResponse:='';
      DECLARE
      str1  VARCHAR2(10):=idegreeName;
  
      Begin
  
          FOR i IN 1 .. iAdmissionRoll.COUNT
          LOOP
  
  
             IF(str1='HONS') THEN
  
             UPDATE nu_hons_result set STATUS=iStatus where ADMISSION_ROLL=iAdmissionRoll(i) and  MERIT_TYPE=iMeritType and COLLEGE_CODE=iCollegeCode and  SUBJECT_ID=isubjectId and STATUS='Student Requested';
  
             END IF;
  
           if (sql%rowcount &gt; 0) then
               tResponse := 'Successfully approved.';
  
               if(iMeritType&lt;&gt;5) then
  
               UPDATE nu_college_subject_map set AVAILABLE_SEAT=AVAILABLE_SEAT-1 where SESSION_ID=isessionId and COLLEGE_CODE=iCollegeCode and  SUBJECT_ID=isubjectId;
  
               end if;
  
  
              insert into NU_HONS_SUBJECT_ADMISSION (ADMISSION_ROLL,SESSION_ID,COLLEGE_CODE,SUBJECT_ID,APPROVED_BY,APPROVED_ON) 
                  values(iAdmissionRoll(i),isessionId,iCollegeCode,isubjectId,iUserId,sysdate);
  
              insert into nu_log_admission values (iAdmissionRoll(i),isessionId,iCollegeCode,iMeritType,iStatus,sysdate,isubjectId);
  
             else
               tResponse := 'Failed to approve.'||idegreeName; 
            end if;  
  
           oResponse := oResponse || tResponse || '###';
  
  
          END LOOP;
  
       EXCEPTION WHEN DUP_VAL_ON_INDEX THEN
          tErrorCode:=SQLCODE;
          tErrorMsg:=SUBSTR(SQLERRM, 1, 400);
          oResponseCode := 1;
          oResponseMessage :=tErrorMsg;
          ROLLBACK;
          Return;
        WHEN OTHERS THEN
          tErrorCode:=SQLCODE;
          tErrorMsg:=SUBSTR(SQLERRM, 1, 400);
          oResponseCode := 2;
          oResponseMessage :=tErrorMsg;
          ROLLBACK;
          Return;
  
      End;
  
  END receiveAdmission2;
  /
  </code></pre>
  
  <p>Problem is IF block is not executing.</p>