2014-03-13

Oracle


nls_date_language=american
set NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS
set NLS_LANGUAGE=AMERICAN
set NLS_LANG=AMERICAN.UTF8

@set NLS_LANG=Traditional Chinese_Hong Kong.ZHT16BIG5
@set NLS_LANG=Simplified Chinese_China.ZHS16CGB231280
@set NLS_LANG=Traditional Chinese_Hong Kong.UTF8
@set NLS_LANG=Simplified Chinese_China.UTF8
@set NLS_LANG=Traditional Chinese_Hong Kong.ZHT16BIG5

set NLS_LANG=American_America.UTF8

例:
・日本語(EUC)の場合
unix# setenv LANG 'ja'
unix# setenv LANG 'ja_JP.EUC'
unix# setenv NLS_LANG 'Japanese_Japan.JA16EUC'

・日本語(SJIS)の場合
unix# setenv LANG 'ja_JP.PCK'
unix# setenv LANG 'ja_JP.Shift_JIS'
unix# setenv NLS_LANG 'Japanese_Japan.JA16SJIS'

・日本語(UTF-8)の場合
unix# setenv LANG 'ja_JP.UTF-8'
unix# setenv NLS_LANG 'Japanese_Japan.UTF8'
unix# setenv NLS_LANG 'American_America.UTF8'

・繁体字中国語(Big5)の場合
unix# unset LANG
unix# setenv LANG 'zh_TW.Big5'
unix# setenv NLS_LANG 'Traditional Chinese_Hong Kong.ZHT16BIG5'

・簡体字中国語(GB2312)の場合
unix# unset LANG
unix# setenv LANG 'zh_CN.EUC'
unix# setenv NLS_LANG 'Simplified Chinese_China.ZHS16CGB231280'




===================================


set pagesize 10000
SET SQLBLANKLINES ON
SET SQLBLANKLINES OFF
SET SQLT[ERMINATOR] {;|c|ON|OFF}
set serveroutput on;

set verify off
column segment_name    format a25
column segment_type HEADING "Type"  format a12
column blocks HEADING "Allocated|Blocks" format 999999999
column Used HEADING "Consumed|Blocks" format 999999999
column p HEADING "Percent|Used"  format 999999999

==================================


select sysdate from dual;

===================================

set serveroutput on;
DECLARE
i integer;
begin
i:=1234;
delete from xxx1 where id in (i);
delete from xxx2 where id in (i);
delete from xxx3 where id in (i);
delete from xxx4 where id in (i);
end;
/


DECLARE
i integer;
j integer;
begin
select nvl(id, 999) into i from dual, xxx where id(+)=100000;
if SQL%NOTFOUND THEN
DBMS_OUTPUT.PUT_LINE('SQL%NOTFOUND: ');
END IF;
DBMS_OUTPUT.PUT_LINE('J: ' || i);
end;
/

set serveroutput on;
DECLARE
i integer(10);
begin
i := 0;

XXX(
'001','Remark',i
);
end;
/


BEGIN
DBMS_JOB.CHANGE(
job => 841,
next_date =>  to_date('22-12-2006 18:00:00','dd-Mm-yyyy HH24:MI:SS'),
interval => 'trunc(decode(sign(to_number(to_char(sysdate,''hh24mi''))-1730),1,sysdate+1,sysdate))+18/24',
what => NULL
);
END;
/


select
 trunc(decode(sign(to_number(to_char(sysdate,'hh24mi'))-1730),1,sysdate+1,sysdate))+18/24
from dual;

select
 trunc(decode(sign(to_number(to_char(to_date('2006-12-22 17:32','yyyy-mm-dd hh24:mi'),'hh24mi'))-1730),1,sysdate+1,sysdate))+18/24
from dual;

select to_char(sysdate,'hh24mi') from dual;


alter index xxx rebuild unrecoverable;
alter index xxx rebuild;
alter index xxx rebuild tablespace xxx;


UNDO:

 AS OF TIMESTAMP (TO_TIMESTAMP('2010-04-07 18:10:00', 'YYYY-MM-DD HH24:MI:SS'))

select status,last_update,update_by from xxx AS OF TIMESTAMP (TO_TIMESTAMP('2010-04-07 18:24:55', 'YYYY-MM-DD HH24:MI:SS')) where id=1234;


No comments:

Post a Comment