title: SQL Object no longer exists while inserting data
body: <p>While I try to insert some data into my table I get an error: <code>ORACLE execute error: ORA-08103: object no longer exists</code>
  Query:</p>
  
  <pre><code>INSERT
  INTO MA_USER.RESPONCES_NEW_2016_10_17_22_10
    (
      GCC_CONTACT_ID,
      GCC_PARENT_CONTACT_ID,
      GCC_SESSION_ID,
      GCC_REQUEST_ID,
      GCC_REGISTRY_ID,
      CONTACT_ID,
      CREATE_DTTM,
      GCC_RESULT_CD,
      CONTACT_DTTM,
      "TYPE",
      GCC_RESULT_TERMINAL_FLG,
      CUSTOMER_GCC_ID,
      SMARTSCRIPT_CD ,
      COMMUNICATION_TYPE,
      "FIRST_NM" ,
      "LAST_NM" ,
      "MIDDLE_NM" ,
      "GENDER_CD" ,
      "BIRTH_DT" ,
      "IIN_NUM" ,
      "MOBILE_PHONE_NUM" ,
      "HOME_PHONE_NUM" ,
      "REGION_NM" ,
      "CITY_NM" ,
      "COMMENT" ,
      "QUEUE_ADDED_DTTM" ,
      "OPERATOR_NM" ,
      "QUEUE_EXTRACT_DTTM" ,
      "REQUEST_START_DTTM" ,
      "REQUEST_END_DTTM" ,
      "CALL_DURATION_TOTAL" ,
      "INFO_SOURCE_DESC" ,
      "APPOINTMENT_FLG" ,
      "APPOINTMENT_DTTM" ,
      "REMINDER_DTTM" ,
      "APPOINTMENT_PLACE_DESC" ,
      "SOLD_PRODUCT_NM" ,
      "LANGUAGE_CD" ,
      "TOPIC" ,
      "REQUESTED_PRODUCT_NM" ,
      "VISIT_REASON_NM"
    )
  SELECT GCC_CONTACT_ID          AS GCC_CONTACT_ID,
    MAX(GCC_PARENT_CONTACT_ID)   AS GCC_PARENT_CONTACT_ID,
    MAX(GCC_SESSION_ID)          AS GCC_SESSION_ID ,
    MAX(GCC_REQUEST_ID)          AS GCC_REQUEST_ID,
    MAX(GCC_REGISTRY_ID)         AS GCC_REGISTRY_ID,
    MAX(CONTACT_ID_test)         AS CONTACT_ID,
    sysdate                      AS CREATE_DTTM,
    MAX(GCC_RESULT_CD)           AS GCC_RESULT_CD,
    MAX(CONTACT_DTTM)            AS CONTACT_DTTM,
    MAX("TYPE")                  AS TYPE,
    MAX(GCC_RESULT_TERMINAL_FLG) AS GCC_RESULT_TERMINAL_FLG ,
    MAX(CUSTOMER_GCC_ID)         AS CUSTOMER_GCC_ID,
    MAX(SMARTSCRIPT_CD)          AS SMARTSCRIPT_CD ,
    MAX(COMMUNICATION_TYPE)      AS COMMUNICATION_TYPE ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('FIRST_NM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "FIRST_NM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('LAST_NM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "LAST_NM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('MIDDLE_NM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "MIDDLE_NM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('GENDER_CD')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "GENDER_CD" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('BIRTH_DT')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "BIRTH_DT" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('IIN_NUM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "IIN_NUM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('MOBILE_PHONE_NUM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "MOBILE_PHONE_NUM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('HOME_PHONE_NUM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "HOME_PHONE_NUM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('REGION_NM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "REGION_NM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('CITY_NM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "CITY_NM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('COMMENT')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "COMMENT" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('QUEUE_ADDED_DTTM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "QUEUE_ADDED_DTTM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('OPERATOR_NM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "OPERATOR_NM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('QUEUE_EXTRACT_DTTM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "QUEUE_EXTRACT_DTTM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('REQUEST_START_DTTM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "REQUEST_START_DTTM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('REQUEST_END_DTTM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "REQUEST_END_DTTM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('CALL_DURATION_TOTAL')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "CALL_DURATION_TOTAL" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('INFO_SOURCE_DESC')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "INFO_SOURCE_DESC" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('APPOINTMENT_FLG')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "APPOINTMENT_FLG" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('APPOINTMENT_DTTM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "APPOINTMENT_DTTM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('REMINDER_DTTM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "REMINDER_DTTM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('APPOINTMENT_PLACE_DESC')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "APPOINTMENT_PLACE_DESC" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('SOLD_PRODUCT_NM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "SOLD_PRODUCT_NM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('LANGUAGE_CD')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "LANGUAGE_CD" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('TOPIC')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "TOPIC" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('REQUESTED_PRODUCT_NM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "REQUESTED_PRODUCT_NM" ,
    MAX(
    CASE
      WHEN UPPER(param_nm) = UPPER('VISIT_REASON_NM')
      THEN PARAM_VALUE
      ELSE NULL
    END) AS "VISIT_REASON_NM"
  FROM
    (SELECT h.*,
      hp.*,
      con.contact_id AS contact_id_test,
      dict.GCC_RESULT_TERMINAL_FLG
    FROM INTEGRATION_PROD.GCC_HISTORY h
    LEFT JOIN INTEGRATION_PROD.GCC_HISTORY_PARAMS HP
    ON H.INT_GCC_ID = HP.INT_GCC_ID
    LEFT JOIN CDM.MA_CONTACT con
    ON h.GCC_SESSION_ID = con.GCC_SESSION_ID
    LEFT JOIN INTEGRATION_PROD.DICT_GCC_RESULT dict
    ON h.GCC_RESULT_CD         = dict.GCC_RESULT_CD
    WHERE TYPE                != 'SAS'
    AND GCC_PARENT_CONTACT_ID IS NULL
    AND h.GCC_request_id      IS NULL
    AND con.CONTACT_ID        IS NULL
    AND h.INT_STATUS           = 'NEW'
    ) rs_new
  WHERE rs_new.gcc_session_id IS NULL
  OR ( rs_new.gcc_session_id  IS NOT NULL
  AND rs_new.CONTACT_DTTM      =
    (SELECT MIN(rs_min_date.CONTACT_DTTM)
    FROM
      (SELECT h.CONTACT_DTTM,
        h.GCC_SESSION_ID
      FROM INTEGRATION_PROD.GCC_HISTORY h
      LEFT JOIN INTEGRATION_PROD.GCC_HISTORY_PARAMS HP
      ON H.INT_GCC_ID = HP.INT_GCC_ID
      LEFT JOIN CDM.MA_CONTACT con
      ON h.GCC_SESSION_ID = con.GCC_SESSION_ID
      LEFT JOIN INTEGRATION_PROD.DICT_GCC_RESULT dict
      ON h.GCC_RESULT_CD         = dict.GCC_RESULT_CD
      WHERE TYPE                != 'SAS'
      AND GCC_PARENT_CONTACT_ID IS NULL
      AND h.GCC_request_id      IS NULL
      AND con.CONTACT_ID        IS NULL
      AND h.INT_STATUS           = 'NEW'
      ) rs_min_date
    WHERE rs_new.GCC_SESSION_ID = rs_min_date.GCC_SESSION_ID
    ))
  GROUP BY gcc_contact_id;
  </code></pre>
  
  <p>I think that there arent any truncate or drop operation with tables in this query. This query takes about 30 minutes. Maybe "Object no longer exists" - its because of long running query?</p>