본문 바로가기

전체 글

(624)
080 - [Oracle PL/SQL] Triggers - Types/ Event Types
079 - [Oracle PL/SQL] Triggers?
078 - [Oracle PL/SQL] INDICES OF # 테이블 인덱스가 순차적이지 않은 경우, 인덱스에 순차접근하면 오류가 발생한다. declare type emp_table_type is table of number index by binary_integer; emp_table emp_table_type; begin emp_table(1):=100; emp_table(2):=101; emp_table(3):=102; emp_table(100):=103; dbms_output.put_line(emp_table.first); dbms_output.put_line(emp_table.last); forall i in emp_table.first..emp_table.last save exceptions update employees set salary=salar..
077 - [Oracle PL/SQL] Bulk collect - using returning 업데이트 조건이 1개인 경우의 샘플 코드 --but first returning it can be used like this create or replace procedure update_sal_x (emp_id number,p_amount number) is v_new_sal number; begin update employees set salary=salary +p_amount where employee_id=emp_id returning salary into v_new_sal; dbms_output.put_line('the new sal now is '||v_new_sal); end; select EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY from employees..
076 - [Oracle PL/SQL] Bulk collect & cursor 각 단계별 차이점 비교한 샘플 코드 --------without bulk------------- declare type emp_t is table of employees%rowtype; emp_table emp_t; cursor emp_c is select * from employees; c number:=0; begin emp_table:=emp_t(); open emp_c; loop emp_table.extend; c:=c+1; fetch emp_c into emp_table(c); exit when emp_c%notfound; dbms_output.put_line(emp_table(c).first_name); end loop; close emp_c; end; ----------------------..
075 - [Oracle PL/SQL] Bulk Binding - bulk_exceptions, bulk collect 벌크로 데이터를 입력할때 오류에 대한 자세한 정보를 가져올 수 있는 방법에 대해서 알아보자 각 로우별 발생한 오류를 모두 확인하는 샘플 코드임. drop table ename; / create table ename as select distinct first_name from employees; / select first_name from ename; declare type ename_t is table of varchar2(100); ename_table ename_t:=ename_t(); c number:=0; errors number; begin for i in (select * from ename ) loop c:=c+1; ename_table.extend; ename_table(c):=i.fir..
074 - [Oracle PL/SQL] Bulk Binding 아래는 기본적인 pl/sql 실행 구조이다. 여기서 인서트문이 자주 발생하면 서버에 부하가 많이 발생한다. 기본적인 문법은 아래와 같다. 예외 처리 관련 아래는 간단한 업데이트문을 for문으로 처리한 경우와 벌크로 처리한 경우의 샘플 코드입니다. select EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY from employees where employee_id in (100,101,102); --------------------------------------------------------------- EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ----------- -------------------- ----------------------..
073 - [Oracle PL/SQL] DETERMINISTIC hint DETERMINISTIC 힌트와 result_cache 힌트의 캐쉬에서 결과를 가져온다는 유사한 점이 있디만, 중요한 차이점은 DETERMINISTIC(동일 세션에서만 캐쉬 공유), result_cache(다른 세션간에도 캐쉬 공유) 라는 점이다. 특별한 경우가 아니면, result_cache 가 좀 더 유용함 If another session runs the same code with the same parameters the code is still executed. The cache is not shared between sessions. You must specify this keyword if you intend to call the function in the expression of a fu..