CREATE OR REPLACE FUNCTION sim2_station_sort (p_station_is_nbr IN SIM_FIELD_ACTIVITIES.FA_TSMSTATN_IS_NUMBER%TYPE, p_org_id IN SIM_FIELD_ACTIVITIES.FA_TSMSTATN_ORG_ID%TYPE) 
  RETURN VARCHAR2 IS

  CURSOR c_get_station_id IS
    SELECT IDENTIFICATION_CD FROM TSMSTATN WHERE TSMSTATN_IS_NUMBER = p_station_is_nbr
      AND TSMSTATN_ORG_ID = RPAD(p_org_id,8);

  SUBTYPE C_GET_ST_REC_TY IS C_GET_STATION_ID%ROWTYPE;
  C_GET_ST_REC C_GET_ST_REC_TY;
        
BEGIN

  OPEN c_get_station_id;
  FETCH c_get_station_id INTO C_GET_ST_REC;
  CLOSE c_get_station_id;


  RETURN C_GET_ST_REC.IDENTIFICATION_CD;


END;

