All,
A simple question of readability and maintainability of code.
This is an example of a call to our exception handler as formatted in 12.11 and up with Dynamic arrangement:
exception
when others
then – log the error and re-raise exception to inform caller
utl_krg.msg_log.standard_exception_handler(
p_schema =>
g_my_schema
, p_package =>
g_my_package
, p_routine =>
l_my_routine
, p_action =>
l_action
, p_msg_code =>
sqlcode
, p_local_msg_prefix =>
g_my_msg_prefix
, p_message =>
'On ’
|| ora_database_name
|| ‘: ’
|| sqlerrm
|| ’ - p_item_name=’
|| coalesce(p_item_name, ‘<*Null>’)
|| ‘, p_item_key=’
|| coalesce(p_item_key, ‘<*Null>’)
|| ‘, p_timestamp=’
|| coalesce(trim(to_char(p_timestamp, ‘yyyy-mm-dd hh24:mi:ss.ff’)), ‘<*Null>’)
, p_row_count =>
l_row_count
);
The same code by the 12.10 formatter:
exception
when others
then – log the error and re-raise exception to inform caller
utl_krg.msg_log.standard_exception_handler(
p_schema => g_my_schema
, p_package => g_my_package
, p_routine => l_my_routine
, p_action => l_action
, p_msg_code => sqlcode
, p_local_msg_prefix => g_my_msg_prefix
, p_message => 'On ’
|| ora_database_name
|| ‘: ’
|| sqlerrm
|| ’ - p_item_name=’
|| coalesce(p_item_name, ‘<*Null>’)
|| ‘, p_item_key=’
|| coalesce(p_item_key, ‘<*Null>’)
|| ‘, p_timestamp=’
|| coalesce(trim(to_char(p_timestamp, ‘yyyy-mm-dd hh24:mi:ss.ff’)), ‘<*Null>’)
, p_row_count => l_row_count
);
The latter is - at least to my mind and eyes - much better readable.
- is has a clear distinction between parmnames area and parmvalues area
- is uses far fewer lines, which helps in maintaining a view of the statement within its context. (screens are always too small)
My issue with the new formatter is not that it uses parmname area for holding parmvalues when a parameter value specification is very long, but I do object to reusing the parmname area for all parmvalues as soon as any one of them uses it. It causes visual clutter on the left-hand side, leaves available space at the right-hand side unused and unnecessarily stretches the block of code vertically.
Just my opinion. Please be invited to share your thoughts.