今日有针对Oracle NULL值有了相关实验. 对NULL 值插入的讨论。PL/SQL 中可以执行插入
今日有针对Oracle NULL值有了相关实验. 对NULL 值插入的讨论。
1, PL/SQL 中可以执行插入''或者NULL 的操作, 前提是栏位允许为空.
2, 可以对NULL进行一系列数据库运算. 如:
SELECT ROUND(TO_NUMBER(MAX(A.IN_STATION_TIME)-SYSDATE))*24 FROM SFISM4.R_WIP_TRACKING_T A WHERE
A.IN_STATION_TIME IS NULL
总结: 相应TO_NUMBER(NULL)也是可行, MAX 也是可行得,没有问题.
3, 回归主题, SQL 原本的样子要做成这个样:
INSERT INTO SFISM4.R_DT_PCB_OVERTIME_T F
(F.SERIAL_NUMBER,
F.MODEL_NAME,
F.LINE_NAME,
F.PRODUCTION_TIME,
F.INTERCEPT_TIME,
F.EXPRIATUION_HOUR,
F.STATE_FLAG,
F.SEND_USER)
(SELECT 'COCO111111111',
'NIUBI1',
'15555',
NVL(NULL, MAX(A.IN_STATION_TIME)),
SYSDATE,
NVL(ROUND(TO_NUMBER(MAX(A.IN_STATION_TIME)-SYSDATE))*24, '0'),
'1',
'1'
FROM SFISM4.R_WIP_LOG_T E
WHERE E.SERIAL_NUMBER = 'COCO111111111') AND E.GROUP_NAME = 'SMTS')
结果, 部分执行后, 一条也不会插入. Insert 操作, 根据子查询, 如果子查询为空, 那么什么都不会插入.
4, 高潮来了-- 去掉子查询中的WHERE后, 即SELECT 条件都是肯定有值后, 居然将表E中全部记录插入. 啊, 幸亏是测试库, 数据量不大, 但是也执行了5s. 好吧, 异常. 全部删除! 可见根据结果集Insert还是需要慎重啊, 否则将多少垃圾数据在实际中.
5, 回归本意. 最终针对NULL值单独判定, 防止意外大量数据产生.
--------------------------------------分割线 --------------------------------------
rlwrap - 解决Linux下SQLPLUS退格、上翻键乱码问题
SQLPLUS spool 到动态日志文件名
Oracle SQLPLUS提示符设置
通过设置SQLPLUS ARRAYSIZE(行预取)加快SQL返回速度
PL/SQL Developer实用技巧分享
--------------------------------------分割线 --------------------------------------
本文永久更新链接地址:
,
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.

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 using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

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 Mac version
God-level code editing software (SublimeText3)

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

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.

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools