title: Updating column is not working in Oracle PLSQL
body: <p>I have a <code>Stored procedure</code> in <code>PLSQL</code> which  Inserts and Updates records on the basis of some condition.</p>
  
  <p>Now here the issue is. While Inserting the record for the first time, it inserts records properly as required but</p>
  
  <blockquote>
    <p>while updating it doesn't updates the record of the table. </p>
  </blockquote>
  
  <p>Below is SP</p>
  
  <pre><code>PROCEDURE INSERT_INTO_VSAT_MST_DATA
    (
    P_SAPID IN NVARCHAR2,
    P_CIRCLE IN NVARCHAR2,
    P_CANDIDATEID IN NVARCHAR2,
    P_SITEID IN NVARCHAR2,
    P_PRIORITYID IN NVARCHAR2,
    P_SITENAME IN NVARCHAR2,
    P_LATITUDE IN NVARCHAR2,
    P_LONGITUDE IN NVARCHAR2,
    P_CONTACT_DETAILS IN CLOB,
    P_SITETYPE IN NVARCHAR2,
    P_SITE_PLOT_DIMENSION IN NUMBER,
    P_TECHNOLOGY IN NVARCHAR2
   )
    AS
  
    V_COUNT NUMBER:=0;
    V_PANAROMICIMG_COUNT NUMBER:=0;
    V_SATELLITEIMG_COUNT NUMBER:=0;
    V_SITEPLOTIMG_COUNT NUMBER:=0;
    V_VSAT_DETAIL_ID NUMBER:=0;
  
      BEGIN
  
  SELECT COUNT(VSAT_DETAIL_ID) INTO V_COUNT FROM TBL_VSAT_MST_DETAIL WHERE SAP_ID = P_SAPID AND CANDIDATE_ID =  P_CANDIDATEID;
  
  IF V_COUNT &gt; 0 THEN
  
  SELECT VSAT_DETAIL_ID INTO TBL_INSERT FROM TBL_VSAT_MST_DETAIL WHERE SAP_ID = P_SAPID AND CANDIDATE_ID =  P_CANDIDATEID;  
  UPDATE  TBL_VSAT_MST_DETAIL SET  
                              CIRCLE = P_CIRCLE,
                              CONTACT_DETAILS = P_CONTACT_DETAILS,
                              SITE_TYPE = P_SITETYPE,
                              SITE_DETAILS_DIMENSION = P_SITE_PLOT_DIMENSION,
                              SITE_DETAILS_TECHNOLOGY = P_TECHNOLOGY
                              WHERE VSAT_DETAIL_ID = V_VSAT_DETAIL_ID
                  RETURNING VSAT_DETAIL_ID INTO TBL_INSERT;          
  ELSE     
  INSERT INTO TBL_VSAT_MST_DETAIL 
                                   (
                                      SAP_ID,
                                      CIRCLE,
                                      CANDIDATE_ID,
                                      SITE_ID,
                                      PRIORITY,
                                      SITE_NAME,
                                      LATITUDE,
                                      LONGITUDE,
                                      CONTACT_DETAILS,
                                      SITE_TYPE,
                                      SITE_DETAILS_DIMENSION,
                                      SITE_DETAILS_TECHNOLOGY                                     
  VALUES
                                   (
                                      P_SAPID,
                                      P_CIRCLE,
                                      P_CANDIDATEID,
                                      P_SITEID,
                                      P_PRIORITYID,
                                      P_SITENAME,
                                      P_LATITUDE,
                                      P_LONGITUDE,
                                      P_CONTACT_DETAILS,
                                      P_SITETYPE,
                                      P_SITE_PLOT_DIMENSION,
                                      P_TECHNOLOGY
                                      ) RETURNING VSAT_DETAIL_ID INTO TBL_INSERT;
  END IF;    
  IF TBL_INSERT &gt; 0 THEN
  BEGIN                
      SELECT COUNT(*) INTO V_PANAROMICIMG_COUNT FROM TBL_VSAT_IMAGE_DETAIL WHERE IMG_TYPE = 'Panaromic' AND IMG_ID = TBL_INSERT;        
      SELECT COUNT(*) INTO V_SATELLITEIMG_COUNT FROM TBL_VSAT_IMAGE_DETAIL WHERE IMG_TYPE = 'Satellite' AND IMG_ID = TBL_INSERT;        
      SELECT COUNT(*) INTO V_SITEPLOTIMG_COUNT FROM TBL_VSAT_IMAGE_DETAIL WHERE IMG_TYPE = 'SitePlot' AND IMG_ID = TBL_INSERT;        
      IF V_PANAROMICIMG_COUNT &gt; 0 THEN
      BEGIN        
          DELETE FROM TBL_VSAT_IMAGE_DETAIL WHERE IMG_TYPE = 'Panaromic' AND IMG_ID = TBL_INSERT;   
      END;        
      END IF;           
      IF V_SATELLITEIMG_COUNT &gt; 0 THEN
      BEGIN        
          DELETE FROM TBL_VSAT_IMAGE_DETAIL WHERE IMG_TYPE = 'Satellite' AND IMG_ID = TBL_INSERT;   
      END;  
      END IF;           
      IF V_SITEPLOTIMG_COUNT &gt; 0 THEN
      BEGIN        
          DELETE FROM TBL_VSAT_IMAGE_DETAIL WHERE IMG_TYPE = 'SitePlot' AND IMG_ID = TBL_INSERT;   
      END;
      END IF;  
      FOR PMULTIFIELDS IN (SELECT REGEXP_SUBSTR(P_PANORAMIC_IMAGES,'[^,]+', 1, LEVEL) AS IMAGES FROM DUAL
                                CONNECT BY REGEXP_SUBSTR(P_PANORAMIC_IMAGES, '[^,]+', 1, LEVEL) IS NOT NULL
                              )
      LOOP
                  INSERT INTO TBL_VSAT_IMAGE_DETAIL
                              (
                                IMG_ID,
                                IMG_NAME,
                                IMG_TYPE,
                                IMG_UPLOADED_DATE,
                                UPLOADED_BY
                              )
                              VALUES
                              (
                                TBL_INSERT,
                                PMULTIFIELDS.IMAGES,
                                'Panaromic',
                                SYSDATE,
                                P_CREATEDBY
                              );
      END LOOP;
      FOR PSATELLITEIMG IN (SELECT REGEXP_SUBSTR(P_SATELLITE_IMAGES,'[^,]+', 1, LEVEL) AS IMAGES FROM DUAL
                                    CONNECT BY REGEXP_SUBSTR(P_SATELLITE_IMAGES, '[^,]+', 1, LEVEL) IS NOT NULL
                                  )
      LOOP
                  INSERT INTO TBL_VSAT_IMAGE_DETAIL
                              (
                                IMG_ID,
                                IMG_NAME,
                                IMG_TYPE,
                                IMG_UPLOADED_DATE,
                                UPLOADED_BY
                              )
                              VALUES
                              (
                                TBL_INSERT,
                                PSATELLITEIMG.IMAGES,
                                'Satellite',
                                SYSDATE,
                                P_CREATEDBY
                              );
      END LOOP;
  
    IF P_SITEPLOT_IMAGES IS NOT NULL THEN
    BEGIN      
      INSERT INTO TBL_VSAT_IMAGE_DETAIL
                                (
                                  IMG_ID,
                                  IMG_NAME,
                                  IMG_TYPE,
                                  IMG_UPLOADED_DATE,
                                  UPLOADED_BY
                                )
                                VALUES
                                (
                                  TBL_INSERT,
                                  P_SITEPLOT_IMAGES,
                                  'SitePlot',
                                  SYSDATE,
                                  P_CREATEDBY
                                ); 
         END;   
        END IF;      
           END;
           END IF;      
       COMMIT;    
      EXCEPTION WHEN OTHERS THEN    
       ROLLBACK;
  </code></pre>
  
  <p><strong>NOTE</strong></p>
  
  <p>While updating the record my <code>TBL_INSERT</code> returns as <code>NULL</code></p>