总之,笔者认为现在数据内容显示格式越来越重要。有时候,甚至会影响用户对于软件的选择。所以,作为一个称职的数据库管理员,除
在Oracle数据库中,有很多格式化工具,可以提高结果的可读性。对我们的数据库设计与软件开发,具有画龙点睛的作用。
如下图,是员工薪资管理模块中的一个员工薪资表。这个表在外行人眼里看起来已经比较完美了。但是,其仍然有不少可以完善的地方。
一、 在货币前面加入本地货币符号。
货币字段在系统中,是一个比较复杂的字段。特别是在一些涉及到多货币的管理系统中,有时候两个字段数字虽然相同,但是,其实际表示的金额却不一致。因为两者对应的货币符号不同。所以,有时候,我们希望在货币字段之前,显示本地的货币符号。这可以让用户直观的了解,这个是以本位币表示的货币金额。
如上图,我们希望在货币之前能够显示货币符号。这比上面那个结果,显然可读性更好。其实,要实现这个目的,也是很简单的。在Oracle数据库中,提供了Format命令,可以格式化查询结果。如要实现上面的结果,,则可以利用这个命令来完成。
COLUMN HEADING FORMAT L9999.99;
Column是Oracle数据库提供的一个命令。结合Format参数,可以用来格式化查询结果。在L9999.99,这个参数中,L表示在数值型字段前显示本地货币符号。这里的本地货币符号是指在Oracle数据库环境中设置的本地货币符号,而跟前台应用程序无关。在前台程序开发的时候,要注意跟Oracle数据库同步。如用户在前台应用软件中,设置的本位币是人民币的话,则前台程序要能够重新设置Oracle数据库的本地货币。如此的话,利用L参数才可以显示正确的结果。
参数9表示在数值型字段上禁止显示前导0。此外,他还有一个额外的功能,就是表示精度。如上面的例子中,小数点后面加入两个9,就表示保留两位小数。即使没有小数的话,也要用0来补充。这也是我们在格式化查询结果的时候,常用的一个手段。
不过在利用9来限制数字精度时,要注意一个问题,就是其位数一定要够。如果某个字段,其实际值为350000,而我们提供的参数为L9999.99的话。则最后将无法显示正确的结果。如可能会利用######来代替最终的结果。这是在数据库设计的时候,需要注意的问题。
二、跟Format有关的其他格式控制。
Format还提供了其他一些有用的参数。
如$参数。若把COLUMN HEADING FORMAT L9999.99这个命令稍微改一下。该为COLUMN HEADING FORMAT $9999.99这个的话,那么会有什么结果?此时,无论Oracle数据库的本地货币符号是什么,在现实的结果中,都是以$开头的货币。也就是说,这个参数的含义就是在数值型字段前面显示美元符号。这跟Oracle数据库的环境变量无关。
如上图中,在Oracle数据库中,对于数字型的数据类型,默认情况下其不会用千位分隔符进行区分。而在软件设计中,特别是财务部门的管理软件,往往需要利用千位分隔符来进行划分。如此,用户读起来会更加的方便。为此,在Oracle数据库中,提供了一个“,”参数(注意是英文状态下的逗号)。这个参数指定在数字型的数据中加入千位分隔符。

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
