--将用小数形式表示的 日期时间 转化为 天-小时-分钟-秒 的形式 function fmt_time (p_days in number) return varchar2 as l_days number; l_hours number; l_minutes number; l_seconds number; l_sign varchar2(1); l_returnvalue string_util_pkg.t_max_pl_varchar2; begin /* Purpose: get time formatted as days, hours, minutes, seconds Remarks: Who Date Description ------ ---------- ------------------------------------- MBR 18.12.2006 Created */ --通过传入的 日期获得相应的 各个单位数据 --整数部分为 天 l_days := nvl(trunc(p_days),0); --小数部分 *24 得到小时 l_hours := nvl(((p_days - l_days) * 24), 0); --获得的小时 数据的小数部分 *60 为分钟 l_minutes := nvl(((l_hours - trunc(l_hours))) * 60, 0); --同样的 将获得的 分钟的小数部分*60 为秒 l_seconds := nvl(((l_minutes - trunc(l_minutes))) * 60, 0); --判断日期正负 符号 if p_days < 0 then l_sign:='minus '; else l_sign:=''; end if; --将得到的数据 进行格式化 绝对值是为了进行必要的 去除正负号判定 --获得天的绝对值 l_days:=abs(l_days); --获得小时的绝对值 同时获得其整数部分 l_hours:=trunc(abs(l_hours)); --去取分钟的绝对值 然后四舍五入 l_minutes:=round(abs(l_minutes)); --去取秒的绝对值 然后四舍五入 l_seconds:=round(abs(l_seconds)); --如果分钟 为60 为什么会出现这种情况呢? 这是因为有了四舍五入和小数 不精确所致 if l_minutes = 60 then --则 让小时+1 同时分钟置空 l_hours:=l_hours + 1; l_minutes:=0; end if; --将得到的结果 进行格式化输出 --采用 天-》小时-》分钟的判断顺序 是为了 能够决定那个 字段木有值 if l_days > 0 then l_returnvalue:=string_util_pkg.get_str('%1 days, %2 hours, %3 minutes', l_days, l_hours, l_minutes); elsif l_hours > 0 then l_returnvalue:=string_util_pkg.get_str('%1 hours, %2 minutes, %3 seconds', l_hours, l_minutes, l_seconds); elsif l_minutes > 0 then l_returnvalue:=string_util_pkg.get_str('%1 minutes, %2 seconds', l_minutes, l_seconds); else l_returnvalue:=string_util_pkg.get_str('%1 seconds', l_seconds); end if; --加上 符号 l_returnvalue:=l_sign || l_returnvalue; return l_returnvalue; end fmt_time;

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

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]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

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

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(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

SublimeText3 English version
Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment