'My Works'에 해당되는 글 50건
- 2011.12.27 SQL*Plus에서 & 변수 사용시 set escape 활용
- 2011.09.07 [ORACLE] ORA-01555 Snapshot too old 에 대한 정보 - 욱짜님 글 링크
- 2011.01.30 [추천] SpaceSniffer
- 2010.07.26 [ORACLE] select last rows
- 2010.07.23 [ORACLE] '\n' 처리 방법
- 2010.06.15 [ORACLE] Windows CMD창 SQL*Plus에서 DB LINK 생성시 발생할 수 있는 에러
- 2010.06.10 [ORACLE] 비율 관련
- 2010.06.10 [ORACLE] connect by 로 결과값 가로로 펼치기
- 2010.05.25 [ORACLE] EXEMPT ACCESS POLICY
- 2010.04.19 [ORACLE] CLOB -> BLOB function
가끔 특정 단어 중간에 &변수를 받고 싶을때가 있다.
그럴 땐 아래와 같이 해보자.
물론 &__tab|test 형태로도 사용가능하다.
그럴 땐 아래와 같이 해보자.
SQL> create table tab_ampersand_test 2 as 3 select 'OK' as name 4 from dual 5 ; Table created. SQL> select name 2 from tab_ampersand_test 3 ; NA -- OK 1 row selected. Elapsed: 00:00:00.00 SQL> set escape | SQL> select name 2 from tab_&__tab|_test 3 ; Enter value for __tab: ampersand NA -- OK 1 row selected. Elapsed: 00:00:00.01
물론 &__tab|test 형태로도 사용가능하다.
가끔 내 하드디스크가 내가 기억하는 것보다 용량이 부족하지만 왜 그런지 모르겠다는 생각이 들때 이 어플을 실행해보는 것도 괜찮을 것 같습니다.
각 폴더 또는 파일의 크기를 시각적으로 보여주는 툴입니다.
아래 주소에 가시면 다운로드 가능합니다.
http://www.uderzo.it/
각 폴더 또는 파일의 크기를 시각적으로 보여주는 툴입니다.
아래 주소에 가시면 다운로드 가능합니다.
http://www.uderzo.it/
oracle table에서 마지막 변경된 row와 그 변경 시간 찾기.
원문 링크 : http://laurentschneider.com/wordpress/2006/08/select-last-rows.html
16:49:53 SQL> create table check_dml_time 16:50:22 2 ( 16:50:24 3 fix_column varchar2(10) 16:50:38 4 ,test_column varchar2(10) 16:50:49 5 ) 16:50:50 6 ; Table created. Elapsed: 00:00:00.02 16:50:51 SQL> insert into check_dml_time values ('FIX','FIRST'); 1 row created. Elapsed: 00:00:00.01 16:51:21 SQL> commit; Commit complete. Elapsed: 00:00:00.01 16:51:23 SQL> select created, last_ddl_time from user_objects where object_name = upper('check_dml_time'); CREATED LAST_DDL_TIME ----------------- ----------------- 20100726 16:50:51 20100726 16:50:51 1 row selected. Elapsed: 00:00:00.02 16:52:01 SQL> select ora_rowscn from check_dml_time; ORA_ROWSCN -------------------- 11466381392945 1 row selected. Elapsed: 00:00:00.01 16:52:31 SQL> select scn_to_timestamp(ora_rowscn) from check_dml_time; SCN_TO_TIMESTAMP(ORA_ROWSCN) --------------------------------------------------------------------------- 2010/07/26 16:51:23 1 row selected. Elapsed: 00:00:00.01 16:53:31 SQL> update check_dml_time 16:53:43 2 set test_column = 'UPDATED' 16:53:50 3 ; 1 row updated. Elapsed: 00:00:00.01 16:53:55 SQL> commit; Commit complete. Elapsed: 00:00:00.01 16:54:00 SQL> select scn_to_timestamp(ora_rowscn) from check_dml_time; SCN_TO_TIMESTAMP(ORA_ROWSCN) --------------------------------------------------------------------------- 2010/07/26 16:53:59 1 row selected. Elapsed: 00:00:00.00Tested : Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
원문 링크 : http://laurentschneider.com/wordpress/2006/08/select-last-rows.html
'\n' 이 문자열 그대로의 의미가 아닌 엔터(줄바꿈)를 말씀하시는 거라면?
CHR(13) || CHR(10) 을 찾아 바꾸시면 됩니다.
http://www.oracleclub.com/article/49759
생성하고자 하는 DB LINK의 password에 마지막 문자에 !가 있는 경우 windows cmd 창에서 SQL*Plus로는 에러가 나는 경우가 있습니다.
Unix 환경에서도 ""로 감싸줘야 에러없이 생성가능합니다.
Unix 환경에서도 ""로 감싸줘야 에러없이 생성가능합니다.
CREATE PUBLIC DATABASE LINK db_link_nm CONNECT TO id IDENTIFIED BY "password!" USING db_service_nm;
WITH test AS ( SELECT '40' code, 30 cnt FROM dual UNION ALL SELECT '30', 50 FROM dual UNION ALL SELECT '10', 20 FROM dual ) SELECT code , SUM(cnt) cnt , RATIO_TO_REPORT(SUM(cnt)) OVER(PARTITION BY GROUPING(code)) * 100 ratio FROM test GROUP BY ROLLUP(code) ;
column viewname format a100 with tab as ( select '0001' code, 'A' name from dual union all select '0001' code, 'B' name from dual union all select '0001' code, 'C' name from dual union all select '0002' code, 'D' name from dual union all select '0002' code, 'A' name from dual union all select '0003' code, 'F' name from dual union all select '0003' code, 'E' name from dual union all select '0003' code, 'B' name from dual union all select '0003' code, 'C' name from dual ) select x.code ,substr(max(sys_connect_by_path(x.name,', ')),2) viewname from ( select code ,name ,row_number() over (partition by code order by code ,name) rn from tab ) x start with x.rn = 1 connect by prior x.code = x.code and prior x.rn = x.rn - 1 group by x.code /connect by 앞에서 항상 약해지는 나 ㅡ.ㅜ
with tab as ( select '0001' code, 'A' name from dual union all select '0001' code, 'B' name from dual union all select '0001' code, 'C' name from dual union all select '0002' code, 'D' name from dual union all select '0002' code, 'A' name from dual union all select '0003' code, 'F' name from dual union all select '0003' code, 'E' name from dual union all select '0003' code, 'B' name from dual union all select '0003' code, 'C' name from dual ) select x.code ,substr(xmlagg(xmlelement(x,' ,',x.name).extract('//text()')),3) viewnames from tab x group by x.code /connect by 안쓰고 같은 효과내는 방법 xml 쿼리도 공부해야겠음 ㅋㅋ
EXEMPT ACCESS POLICY
Bypass fine-grained access control
Bypass fine-grained access control
Caution: This is a very powerful system privilege, as it lets the grantee bypass application-driven security policies. Database administrators should use caution when granting this privilege.
grant exempt access policy to dw; revoke exempt access policy from dw;강력하다 -_-;;
CREATE OR REPLACE FUNCTION CLOB2BLOB (p_clob in CLOB) return BLOB is -- transforming CLOB a BLOB p_blob blob; l_off number default 1; l_amt number default 4096; l_offWrite number default 1; l_amtWrite number; l_str varchar2(4096 char); begin DBMS_LOB.CREATETEMPORARY(p_blob, TRUE); begin loop dbms_lob.read ( p_clob, l_amt, l_off, l_str ); l_amtWrite := utl_raw.length ( utl_raw.cast_to_raw( l_str) ); dbms_lob.write( p_blob, l_amtWrite, l_offWrite, utl_raw.cast_to_raw( l_str ) ); l_offWrite := l_offWrite + l_amtWrite; l_off := l_off + l_amt; l_amt := 4096; end loop; exception when no_data_found then NULL; end; return p_blob; end CLOB2BLOB; /