개발/기타

Execute Oracle Procedure Test

xwing 2011. 11. 23. 11:49
sample 1)
VARIABLE csr REFCURSOR;
EXEC Proc_Test('2011-11-09', :csr);
PRINT csr;
 
sample 2)
DECLARE
  A varchar(10);
  B varchar(10);
  C number(4);
   
  -- sys_refcursor is weakly typed
  refcsr  SYS_REFCURSOR;
  
BEGIN

  -- call procedure
  PROC_TEST('2011-11-09', refcsr);

   -- loop through the results  
   LOOP
      -- gets one row at a time
      FETCH refcsr INTO A, B, C;
      -- if the fetch doesn't find any more rows exit the loop
      EXIT WHEN refcsr%NOTFOUND;
      
      DBMS_OUTPUT.PUT_LINE(A || '   ' || B || '  ' || C);
      
    END LOOP;

END; 

'개발 > 기타' 카테고리의 다른 글

NavigationController에 ad@m 광고  (0) 2012.02.28
MSSQL varchar vs nvarchar  (0) 2011.04.27
MS SQL 2008 Express 설치 중 오류  (0) 2011.03.17