используйте ROWNUM для отсортированного набора (здесь :p_lastname := 'Mad'; :p_firstname := 'Mike';
):
SQL> WITH my_data AS (
2 SELECT 1 ID, 'John' FirstName, 'Smith' LastName FROM DUAL
3 UNION ALL SELECT 2, 'Mike', 'Smith' FROM DUAL
4 UNION ALL SELECT 3, 'Ben' , 'Bray' FROM DUAL
5 UNION ALL SELECT 4, 'John', 'Bray' FROM DUAL
6 UNION ALL SELECT 5, 'John', 'Smith' FROM DUAL
7 UNION ALL SELECT 6, 'Bill', 'Lynch' FROM DUAL
8 UNION ALL SELECT 7, 'Bill', 'Smith' FROM DUAL
9 )
10 SELECT id, firstname, lastname
11 FROM (SELECT id, firstname, lastname
12 FROM my_data
13 WHERE lastname <= :p_lastname
14 AND (lastname < :p_lastname OR firstname <= :p_firstname)
15 ORDER BY lastname DESC, firstname DESC)
16 WHERE ROWNUM = 1;
ID FIRSTNAME LASTNAME
---------- --------- --------
6 Bill Lynch