레이블이 oracle인 게시물을 표시합니다. 모든 게시물 표시
레이블이 oracle인 게시물을 표시합니다. 모든 게시물 표시

2013년 8월 5일 월요일

[Oracle] stored procedure 안에서 배열 형태로 파라미터 주고 받기


오라클 stored procedure 안에서 다른 SP를 호출하는 경우임


 PROCEDURE PROC_NAME1 (
  aSingleArray  IN   VARCHAR_ARRAY,
  oRtnCode      OUT  VARCHAR2,
  oRtnMsg       OUT  VARCHAR2
  ) AS
/* 배열을 선언한다 */
aINFArry      VARCHAR_ARRAY   := VARCHAR_ARRAY();
BEGIN

/* 배열의 크기를 선언하고 해당 수 만큼 변수를 넣는다 */
            aINFArry.EXTEND(2);
            aINFArry(1)  := 'VALUE1';
            aINFArry(2)  := 'VALUE2' ;    

/* 다른 프로시저를 호출하고 선언한 배열을 넣는다. */
   PROC_NAME2(aINFArry);
END PROC_NAME1 

2013년 7월 11일 목요일

[Oracle] Row 단위 락 확인 함수

create or replace FUNCTION FUNC_IS_ROW_LOCKED (v_rowid ROWID, table_name VARCHAR2)
   RETURN varchar2
IS
   x   NUMBER;
   PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
   EXECUTE IMMEDIATE    'Begin
                           Select 1 into :x from '
                              || table_name
                              || ' where rowid =:v_rowid for update nowait;
                         Exception
                            When Others Then
                              :x:=null;
                         End;'
   USING OUT x, v_rowid;
   -- now release the lock if we got it.
   ROLLBACK;
   IF x = 1
   THEN
      RETURN 'N';
   ELSIF x IS NULL
   THEN
      RETURN 'Y';
   END IF;
END;

그리고 아래 쿼리로 결과 확인
select FUNC_IS_ROW_LOCKED (vrowid, vtablename) from dual;

출처
http://stackoverflow.com/questions/5172911/showing-rows-that-are-locked-in-oracle

2012년 7월 24일 화요일

[Oracle] Sql developer 3.1 설치 후 에러

++An error was encountered performing the requested operation:++

++ORA-00604: error occurred at recursive SQL level 1++
++ORA-01882: timezone region not found++
++00604. 00000 - "error occurred at recursive SQL level %s"++
++*Cause: An error occurred while processing a recursive SQL statement++
++(a statement applying to internal dictionary tables).++
++*Action: If the situation described in the next error on the stack++
++can be corrected, do so; otherwise contact Oracle Support.++
++Vendor code 604++


JAVA VM 옵션에서 시간대 설정이 안되어있기 때문임
아래 파일에 아래 옵션을 추가해주면 된다.


file;
D:\oracle\sqldeveloper\ver3.1.07.42\sqldeveloper\bin\sqldeveloper.conf

java VM option;
AddVMOption -Duser.timezone="+07:00"