oracle - 如何假脱机或回显 Oracle 注释
问题描述
我是 oracle 的新手,并尝试使用 bash 脚本将评论/行假脱机。但只有查询输出被假脱机而不是评论(课堂上的学生总数)。
下面是我正在使用的脚本:
sqlplus -s test/test<<EOF
set echo on
spool abc.txt
--------------------------------------
--Total No Of Students in Class.
--------------------------------------
select id ||','|| name from students ;
EOF
预期输出:
--------------------------------------
--Total No Of Students in Class.
--------------------------------------
1,joe
2,Tom
3,Jim
解决方案
在 Oracle--
中是注释语法,因此 SQL*Plus 忽略了这一点:
--------------------------------------
--Total No Of Students in Class.
--------------------------------------
要显示它,您需要使用 SQL*Plus `prompt 命令:
prompt --------------------------------------
prompt --Total No Of Students in Class.
prompt --------------------------------------
此外,您应该使用 . 结束您的 SQL*Plus 脚本spool off
。
推荐阅读
- ruby-on-rails - 在设置 Webpacker React 组件样式时,如何正确定义 backgroundImage 等 css 属性的图像 url?
- python - 如何从 android 获取请求到我的 django 视图?
- apache-kafka - 使用 kafka 将数据从 MySQL 导入 Postgres
- google-analytics - 如何使用标签管理器进行跨域,如果我更改我的代码站点,我会失去什么?
- c# - Unity 使用协程在 UI 中显示多张图片
- swift - 如何测试firebase动态链接以重定向到已卸载应用程序的TestFlight?
- python - DRF 图像 url 未在过滤时返回
- php - 为什么我在 openssl_encrypt 中使用不同的输入得到相同的结果
- html - openUI5 使用自定义 data-sap-ui-resourceroots 为应用程序做描述符无法加载 component-preload.js
- python - 年龄如何分类为分类变量?