Definition: Undergrad, gpa type is 0???, greater than or equal to 140 credits, term code effective ???
select 'Y' from sgbstdn b, shrlgpa a, spriden c where c.spriden_id = p_id and c.spriden_change_ind is null and a.shrlgpa_pidm = spriden_pidm and a.shrlgpa_levl_code = 'UG' and a.shrlgpa_gpa_type_ind = 'O' and a.shrlgpa_hours_earned >= 140 and sgbstdn_pidm = spriden_pidm and sgbstdn_term_code_eff = ( select max(sgbstdn_term_code_eff) from sgbstdn x where x.sgbstdn_pidm = c.spriden_pidm and sgbstdn_term_code_eff <= v_curr_term );