An easier way to call dbms_xplan.display_cursor

Similar to xplan.sql, but calls dbms_xplan.display_cursor instead of Explain Plan. (I added the 'x' for 'extended', rather unimaginatively.)

How often have you wanted to get the extended plan using dbms_xplan.display_cursor and had to type out the whole thing laboriously? And then after doing that, realised you had forgotten to set serveroutput off, so SQL*Plus calls dbms_output.get_lines right after your query, ruining your test? And you don't really want all the query results scrolling up the screen either, so ideally you would set termout off as well - except that only works from a script, and not from the interactive prompt.

xplanx.sql saves your current settings, makes the settings it needs to, executes the contents of the current SQL buffer (i.e. the most recent SQL statement to be run, edited, fetched etc), invokes dbms_xplan.display_cursor and then places the statement back in the buffer so you can carry on working on it, as far as possible leaving everything the way it was.