CREATE OR REPLACE FUNCTION sim2_station_sort (p_station_is_nbr IN NUMBER, p_org_id IN VARCHAR2) 
  RETURN VARCHAR2 IS

  v_station_id           VARCHAR2(15);

  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);

BEGIN

  OPEN c_get_station_id;
  FETCH c_get_station_id INTO v_station_id;
  CLOSE c_get_station_id;


  RETURN v_station_id;

END;

/
