This is just a reblog of On SQL*Plus Defines directed by SQL*Plus default values for script parameters, so credits go elsewhere. However, it’s such fun to recognize this guy employing the schortcomings of a 1st/2nd generation language such as sqlplus to actually overcome another distressing deficiency which is the lack of optional, at least fixed left-to-right positional command line parameters.
So what Vlad just does is to overwrite the binding value of an unprotected intrinsic variable for command line input transfer. Namely, he knows that command line input bindings like
&2 and so forth will always exist in the runtime realm of the processor and purposeful overwrites one or the other positional binding by declaring a
column blabla new_value 1,2,... slots of just the same name. That’s cool stuff, really, since it provides for a default value setting on a missing input. Something, sqlplus does not deliver, according to the manuals.
Real fun, have it