ORACLE to_char() 函数获取自然周数
最简单的是使用
/* Formatted on 2009/12/02 16:01 (Formatter Plus v4.8.8) */
SELECT TO_CHAR (TO_DATE ('2009-12-02', 'YYYY-MM-DD'), 'WW')
from DUAL;
不过to_char()函数在计算一年中第几周是从该年的1月1日开始的。
以下SQL 能得到正确的自然周数.
/* Formatted on 2009/12/02 15:31 (Formatter Plus v4.8.8) */
SELECT TO_CHAR
(DECODE
(SIGN
( ( TO_DATE ('2009-12-02', 'YYYY-MM-DD')
+ TO_NUMBER
(DECODE (TO_CHAR (TRUNC (TO_DATE ('2009-12-02',
'YYYY-MM-DD'
),
&nb
相关文档:
declare
v_isexist number(3,0):=0;
begin
select count(1) into v_isexist from sys.all_objects where owner = 'TEST' and object_type = 'TABLE' and object_name = 'TAB1';
if v_isexist>0 ......
从在Linux上安装Oracle到投入使用才几天,碰到的问题就成百上千的。在使用客户端连接远程Oracle数据库服务器时,出现了listener refused the connection with the following error ora-12519 Listener refused the connection with the following error:ORA-12519, TNS:no appropriate service handler foundThe Connection ......
查询表emp中所有数据
select emp_id,rownum from emp
第一步,查询结果,rownum待定
emp_id rownum
1 ? 1
2 ? 2
3 ? 3
4&n ......
作者:罗代均 http://hi.baidu.com/luodaijun/
使用基于函数的索引(FBI)时,需要先设置初始化参数query_rewrite_enabled=TRUE(默认为false)
该参数在init.ora里设置,以oracle 9i2为例,init.ora文件路径为D:\oracle\admin\mydb\pfile,我这里把oracle装在D盘,mydb是我的数据库.
--顺便说说,创建函数索引的方法
有表emp ......