[Oracle] - SQL*Plus에서 Output 변수가 있는 Procedure 실행하기| 팁-DB(sql)
천우범 | 조회 12 |추천 0 | 2012.05.11. 15:14
set serveroutput on;                                  -- < Server Output을 보기위한 Option 켜기
variable ret_code number;                         -- < Output 변수 선언

call PROC_TEST(:ret_code);                     -- < Output 변수가 있는 프로시저 실행

print ret_code;                                          -- < Server Output 내용 확인

 

 

테이블 레이아웃 확인하기

select b.comments    as table_name
     , a.table_name  as table_id
     , a.owner
     , c.column_id as column_seq
     , c.column_name as column_id
     , Trim(d.comments)  as colname
     , CASE WHEN DATA_TYPE IN ('CHAR','VARCHAR2','NVARCHAR2') THEN DATA_TYPE || '(' || DATA_LENGTH || ')'
            WHEN DATA_TYPE IN ('DATE','LONG','LONG RAW') THEN DATA_TYPE
            WHEN DATA_TYPE = 'NUMBER' THEN
                 CASE WHEN DATA_PRECISION IS NOT NULL THEN DATA_TYPE || '(' || DATA_PRECISION || ',' || DATA_SCALE || ')'
                      ELSE DATA_TYPE || '(' || DATA_LENGTH || ')'
                 END
            WHEN DATA_TYPE IN ('CLOB','NCLOB') THEN  DATA_TYPE
       ELSE 'Etc Type' END AS "DATA_TYPE"
     , decode(c.nullable,'N','Not Null') as "NULLS"
  from all_tables a
     , all_tab_comments b
     , ALL_TAB_COLUMNS c
     , all_col_comments d
where a.owner = 'SMIPC4'                         --< 테이블 owner는 변경하여 활용
  and a.owner = b.owner (+)
  and a.table_name = b.table_name (+)
  and a.owner = c.owner (+)
  and a.table_name = c.table_name (+)
  and c.owner = d.owner (+)
  and c.table_name = d.table_name (+)
  and c.column_name = d.column_name (+)
order by 1,2,3,4,5
;

반응형
Posted by cocon