为什么Oracle的to_char()功能会增加空间?
select length('012'),
length(to_char('012')),
length(to_char('12', '000'))
from dual;
Run Code Online (Sandbox Code Playgroud)
3, 3, 4
我想为Notepad ++编写一个宏,它应该分别用char4,char5,char6替换char1,char2,char3.谢谢
我有一个复杂的查询与group by和order by子句,我需要一个排序的行号(1 ... 2 ...(n-1)... n)返回每一行.使用ROWNUM(在通过查询的谓词阶段之后但在查询进行任何排序或聚合之前将值赋给一行)给出了一个未排序的列表(4 ... 567 ... 123 ... 45 ...).我不能使用应用程序来计算和为每一行分配数字.
如何仅使用一个变量对值列表进行排序?
编辑:根据@ Igor的评论,我重新提出了这个问题.
如何重写这个:
select tab1.id, tab2.id, tab3.id
from tab1, tab2, tab3
where tab1.col1 = tab2.col1(+) and tab2.col2 = tab3.col2(+);
Run Code Online (Sandbox Code Playgroud)
使用OUTER JOIN语法?
我的一个生产数据库中有一个奇怪的问题.长话短说,简单查询:
select id, trunc(stdate) from table_name where trunc(stdate) = '05-FEB-09';
Run Code Online (Sandbox Code Playgroud)
没有返回任何行.然而,
select trunc(stdate) from table_name where id = sought_after_id;
Run Code Online (Sandbox Code Playgroud)
回来了'05-FEB-09'.只有在我尝试之后:
update table_name set stdate = '05-FEB-09' where id = sought_after_id;
Run Code Online (Sandbox Code Playgroud)
我的原始查询按预期工作:
select id, trunc(stdate) from table_name where trunc(stdate) = '05-FEB-09';
> sought_after_id, '05-FEB-09'
Run Code Online (Sandbox Code Playgroud)
那么,我的标准值发生了什么?