在Oracle SQL * Plus中相当于MySQL的\ G [英] Equivalent of MySQL's \G in Oracle's SQL*Plus

查看:577
本文介绍了在Oracle SQL * Plus中相当于MySQL的\ G的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Oracle的SQL * Plus中,以表格形式显示SELECT的结果.有没有办法以键值方式显示行(如MySQL的 \G选项)?

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)?

我正在处理的数据库(该模式未由我定义)具有一串名为e.g.的列. YN_ENABLED(YN =是,否)CHAR(1).因此,当我进行查询时,会得到类似

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).

推荐答案

SQL PLus未内置,但是Tom Kyte提供了一个名为

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
...

这篇关于在Oracle SQL * Plus中相当于MySQL的\ G的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆