일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Eclipse
- GPS
- oracle
- jQuery
- ibsheet
- PHP
- Struts
- dock
- rowspan
- JDOM
- Google Map
- 가우스
- JSON
- iBATIS
- tomcat
- WebLogic
- Ajax
- appspresso
- MFC
- MySQL
- jsr 296
- Spring
- 전자정부프레임워크
- sencha touch
- phonegap
- 선택적조인
- Android
- node.js
- PLSQL
- swingx
- Today
- Total
목록oracle (34)
Where The Streets Have No Name
참고 : http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
jikgub_cd를 3으로 나누어서 나머지에 따라서 복제가 일어나게끔... 1 => 1개복제 2 => 2개복제 0 => 3개복제 SELECT MOD (TO_NUMBER (A.JIKGUB_CD), 3) AS COPY_CNT, B.RN, A.* FROM ORG201 A, (SELECT ROWNUM AS RN FROM DUAL CONNECT BY LEVEL
참조 : https://geraldonit.com/2007/09/27/bulk-collect-forall-vs-cursor-for-loop/ CREATE OR REPLACE PROCEDURE BULK_COLLECT_QUERY IS TYPE SOWNER IS TABLE OF VARCHAR2 (30); TYPE SNAME IS TABLE OF VARCHAR2 (30); TYPE STYPE IS TABLE OF VARCHAR2 (19); L_SOWNER SOWNER; L_SNAME SNAME; L_STYPE STYPE; BEGIN DBMS_OUTPUT.PUT_LINE ('Before Bulk Collect: ' || SYSTIMESTAMP); SELECT OWNER, OBJECT_NAME, OBJECT_TYP..
http://forums.oracle.com/forums/thread.jspa?threadID=608730 SQL> var N number SQL> exec :N := 4 PL/SQL-procedure is geslaagd. SQL> select lpad(' ',:N-i,' ') || ltrim(x) n 2 from dual 3 model 4 dimension by (1 i) 5 measures (cast('1' as varchar2(100)) x) 6 rules iterate(10000) until iteration_number = :N-1 7 ( x[for i from 2 to :N increment 1] = x[cv()] || 8 case 9 when iteration_number+1 exec :N..
http://www.oracle-developer.net/display.php?id=410 workaround to inserts SQL> DECLARE 2 3 TYPE subset_rt IS RECORD 4 ( empno emp.empno%TYPE 5 , ename emp.ename%TYPE 6 , hiredate emp.hiredate%TYPE 7 , deptno emp.deptno%TYPE ); 8 9 TYPE subset_aat IS TABLE OF subset_rt 10 INDEX BY PLS_INTEGER; 11 12 aa_subset subset_aat; 13 14 BEGIN 15 16 /* Some "source" data... */ 17 SELECT ROWNUM, owner, create..
http://forums.oracle.com/forums/thread.jspa?threadID=609947 with month as ( select trunc(sysdate,'mon')+rownum-1 any_dt from dual connect by level
SQL*Plus: Release 10.2.0.1.0 - Production on On Dec 13 23:36:15 2006 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production SQL> select 'yes' from dual where (sysdate-5,sysdate) overlaps (sysdate-2,sysdate-1); 'YE --- yes SQL> select 'yes' from dual where (-5,0) overlaps (-2,-1); select 'yes' from dual where (-5,0)..
select /*+ gather_plan_statistics ordered use_nl(t1) index(t1) */ count(t1.n2), count(t2.n2) from t2, t1 where t2.n2 = 45 and t1.n1 = t2.n1 ; COUNT(T1.N2) COUNT(T2.N2) ------------ ------------ 225 225 select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST')); PLAN_TABLE_OUTPUT ------------------------------------- SQL_ID 98cw5a9c0pw33, child number 0 ----------------------------..
출처 : http://technology.amis.nl/blog/?p=1413 While writing useless queries for solving exotic challenges, I realized that the use of dummy tables or unions of selects against DUAL for producing a few data-rows is a awkard solution to a problem that has a much more elegant one. Using a database type and the TABLE operator we have a very compact way at our disposal for generating records on the fly..
기본적인 update의 경우 update의 where절에 매칭된 수만큼 set 절이 반복 수행됩니다. set 절에 update하는 데이터를 상수로 주는 경우는 크게 문제없으나 다른 테이블에 있는 데이터를 가져와 업데이트 할 때는 성능상의 문제를 피할 수 없습니다. 일반적인 방법으로 UPDATE A SET a1= (SELECT b.b1 FROM b WHERE a.a2=b.a2) where exists (select 'x' from b where b2 = a.a2) 와 같은 방법을 많이 씁니다만 성능상 엄청난 유익이 있는 다른 방법이 있습니다.. (오라클에서만 가능하죠ㅡㅡ;) update /*+ bypass_ujvc */ (select a.a1 a_a1, b.b1 b_b1 from a, b where a.a..
-- Unconditional insert into ALL tables INSERT ALL INTO sal_history VALUES(empid,hiredate,sal) INTO mgr_history VALUES(empid,mgr,sysdate) SELECT employee_id EMPID, hire_date HIREDATE, salary SAL, manager_id MGR FROM employees WHERE employee_id > 200; -- Pivoting insert to split non-relational data INSERT ALL INTO Sales_info VALUES (employee_id,week_id,sales_MON) INTO Sales_info VALUES (employee_..
출처 : http://www.oracle-developer.net/display.php?id=301 This article demonstrates a new method for binding IN-lists in 10g,using the new collection condition MEMBER OF. Also included is a commonpre-10g method and a performance comparison (with dramatic resultswhich leads me to conclude that MEMBER OF is much simpler to use butshould only be used with very small sets or lists). Incidentally, how ..
새로운 MODEL 절 Jonathan Gennick 새로운 MODEL 절을 사용하여 스프레드시트 계산을 데이타베이스로 가져옵니다. 계산된 열값을 반환하는 쿼리를 작성 중일 때 이 계산의 입력으로 여러 행의 값이 필요하다면 어떻게 하시겠습니까? 실제로 이 문제는 상당히 흔한 문제입니다. 대개 이 문제의 해결 방법은 자체 결합(self-join)과 하위 쿼리를 이해하기 어려운 방식으로 조합하여 사용하는 것입니다. Oracle Database 10g에서는 새로운 접근 방식을 사용할 수 있습니다. SELECT 문의 새로운 MODEL 절을 사용하여 관계형 데이타를 다차원 배열로 간주할 수 있으며 이 다차원 배열에 스프레드시트 형식의 계산을 사용할 수 있습니다. 이 결과 더 쉽게 쿼리를 개발하고 이해하며 수정할 수..
INDEX 컬럼의 결정 방법과 HINT 사용 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 인덱스로 만들 컬럼은 다음과 같은 기준에서 선택한다. 1. WHERE 절에서 function의 input이 아니면서, 빈번히 사용되는 컬럼들. 2. 선별력이 높은 컬럼들 (테이블에서 10% 미만인 데이터) 3. 크기가 적은 테이블에서는 인덱스를 만들지 않는다. DB에서 retrieve되는 속도가 느릴 경우, 먼저 Execution Plan을 만들어 보면 어떤 인덱스를 사용하는지 알 수 있다. 만약, User가 기대한 생성한 인덱스를 사용하지 않을 경우, 다음에서 설명하고 있는 Hint 절을 추가하여 retrieval 속도를 향상시킬 수 있다. Optimizer Hint Syntax -----> SELE..