For the 2nd Qn,

select min(x) from table_a where x > :b1;

where b1 is your input value.

Tamil