惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
Jina AI
Jina AI
雷峰网
雷峰网
月光博客
月光博客
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
B
Blog RSS Feed
美团技术团队
C
CXSECURITY Database RSS Feed - CXSecurity.com
小众软件
小众软件
Security Latest
Security Latest
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
Last Week in AI
Last Week in AI
A
Arctic Wolf
Latest news
Latest news
Attack and Defense Labs
Attack and Defense Labs
I
Intezer
F
Fortinet All Blogs
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
Webroot Blog
Webroot Blog
S
Secure Thoughts
Help Net Security
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
V
Visual Studio Blog
P
Proofpoint News Feed
博客园 - 【当耐特】
P
Privacy International News Feed
V
Vulnerabilities – Threatpost
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
云风的 BLOG
云风的 BLOG
Hacker News: Ask HN
Hacker News: Ask HN
L
LINUX DO - 最新话题
H
Help Net Security
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tenable Blog
Cloudbric
Cloudbric
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog

博客园 - Let's DotNet

Generating SSH Keys for Git Keyboard shortcuts for Windows C# 类初始化顺序 - Let's DotNet Office 2007安装后Google拼音输入法莫名其妙消失了,换成了微软拼音 在装有SAP客户端后安装VS2003时出错 Difference between ICallbackEventHandler and AJAX 无法通过Project Professional 2003连接到Project Server 2003的解决办法(转) AutoCoder——全新自动代码框架 基于性能的编程技巧点滴 Atlas Project (转) DB2编程技巧 动态添加控件的一个注意点 SQL Server 高阶应用 限制多行文本框(TextArea)中输入文字的长度(转) 给自己的某个文件夹的文件做一个列表(转) Google 桌面搜索... Eclipse 3.0资料收集(转) 一种改进的轻量级.NET应用程序性能测试框架 ASP.NET 应用程序性能优化
"Union" in Oracle - Let's DotNet
Let's DotNet · 2005-09-23 · via 博客园 - Let's DotNet
 

 Today, I have found a funny problem when use "Union" in Oracle.
 Just like this,

 I have two tables, one calls "TB_STUDENT" and the other "TB_RESOURCE"

TB_STUDENT
{
    WORKER_ID NVARCHAR2(40),
    SEX INTEGER
}

TB_RESOURCE
{
    RESOURCE_ID NVARCHAR2(40),
     ...
}

for the two tables, "TB_STUDENT" has some records while "TB_RESOURCE" has no record!

then, I try the following SQL sentence:

SELECT WORKER_ID FROM TB_STUDENT
UNION
SELECT '' FROM TB_RESOURCE

it got an error "ORA-12704: 字符集不匹配";

I thought maybe it was caused by '', because '' (empty string) denotes the NULL value in Oracle.
So, changed it to ' ';

Unfortunately, it still didn't work!

...

oh, maybe it requires strictly type check!

SELECT WORKER_ID FROM TB_STUDENT
UNION
SELECT CAST('' AS NVARCHAR2(40)) FROM TB_RESOURCE

ok,run passed!

// new added, 05-09-27
oftenly, we think it would be "OK" when using Parameter.
for instance,
 
SELECT LMS_TEACHER.TEACHER_ID FROM LMS_TEACHER WHERE LMS_TEACHER.CODE='I0001' AND LMS_TEACHER.TEACHER_ID<>'';

I use this sentence to find whether there exist a record with "LMS_TEACHER.CODE='I0001'", because LMS_TEACHER.TEACHER_ID is a primary key, so there is no record accord with the condition "LMS_TEACHER.TEACHER_ID<>''". And in the program, I use a sentence with parameter instead the front sentence, just like:

SELECT LMS_TEACHER.TEACHER_ID FROM LMS_TEACHER WHERE LMS_TEACHER.CODE=@NewCode AND LMS_TEACHER.TEACHER_ID<>@TeacherID;

Unfortunately, it returns no record when there is a record with LMS_TEACHER.CODE='I0001' ;
Then I change [<>''] to [IS NOT NULL], it runs ok.

the same result appeared when I try the following setences:
SELECT * FROM LMS_TEACHER WHERE LMS_TEACHER.TEACHER_ID<>' '; (ok)
SELECT * FROM LMS_TEACHER WHERE LMS_TEACHER.TEACHER_ID<>'';  (no record)
SELECT * FROM LMS_TEACHER WHERE LMS_TEACHER.TEACHER_ID IS NOT NULL; (ok)

[ :( it scratches my head over ]