sql - SQL 查询中的 HTML
问题描述
--select the data to highlight using html in sql queries
select
id_c,
salary_c,
case
when salary_c > 50000 then '<html><bgcolor=yellow><font color=red size=5><b>'||to_char(salary_c)||'<html>'
else to_char(salary_c)
END as conditionalsalary
from employees;
请让我知道我在哪里做错了。我正在使用 oracle 11g 和 dbeaver 客户端工具。我想要使用 SQL 查询中的 html 标记以红色大小 5 和背景颜色黄色显示的条件列高亮的结果超过 50000...
解决方案
您正在使用能够呈现 HTML 的 SQL Developer,请参阅https://www.thatjeffsmith.com/archive/2012/07/using-html-to-mark-up-your-data-in-oracle-sql-开发商/
您的 HTML 不正确,您缺少结束标签、引号,并且bgcolor
据我所知不是有效标签。大概应该是:
select
id_c,
salary_c,
case
when salary_c > 50000 then '<html><font color="red" size=5 style=“background-color:yellow;"><b>'||to_char(salary_c)||'</font></html>'
else to_char(salary_c)
END as conditionalsalary
from employees;
推荐阅读
- hex - 将十六进制字节转换为坐标
- google-cloud-platform - 云视觉模型图像找不到相似之处
- linked-list - list_for_each vs list_for_each_safe,安全从何而来?
- apache-spark - 如何使用 apache spark scala 读取 XLSX 的整个目录?
- kotlin - 如何以功能样式生成一定长度的非穷举排列
- typescript - 为什么函数类型的参数不能接受其参数实现原始参数接口的参数?
- c++ - C ++构造函数委托,但如何(某种)反转?
- python - 无法在谷歌云中创建存储桶
- ios - 在获取标头之后,在开始获取数据之前是否可以中断 NSURLSessionDownloadTask?
- typescript - 如何从openapi api-gateway中的lambda响应中正确解析错误代码