In Oracle's SQL*Plus, the results of a SELECT are displayed in a tabular manner. Is there a way to display a row in a key-value manner (like MySQL's \G option)?
The database I am working on (the schema is not defined by me) has a bunch of columns named e.g. YN_ENABLED (YN = yes no) which are CHAR(1). So when I do a query I get a result like
ID_MYTABLE Y Y Y
------------ - - -
3445 Y N Y
So it's not really clear which columns have which values (without having the schema open in another window).
解决方案
Not built in to SQL PLus, but Tom Kyte has provided a procedure called print_table that does this. You would run it like this:
SQL> exec print_table ('select * from mytable where id_mytable=123');
And see results like:
ID_MYTABLE : 123
YN_ENABLED : Y
YN_SOMETHING : N
...