Oracle: How to AUTOTRACE in my program
You'll have to write your own, it's not a native feature of oracle, it's something that has been implemented in Oracle tools. Grab the plan from v$sql_plan for your SQL_ID and then grab the delta of session stats before and after you run your query.

It's a little more involved in that, but that's the basic mechanics.