Q&A

  • 오라클 SQL 문좀 봐주세요???
EX-01 문을 EX-02로 문으로 바꿀려고 하는데 잘 안되네요..

EX 01> 첫번째 SQL문은 오류가 안나고 잘 돌아 갑니다.

select f.bco_itemcode as bi_code,a.bi_name,a.bi_spec,b.bc_codename as name1,
c.bc_codename as name2,d.bc_codename as name3,
e.bc_codename as name4, f.bco_cog       from b_cog f
left outer join b_item a on f.bco_gubun = a.bi_gubun and f.bco_itemcode = a.bi_code
left outer join b_code b on a.bi_gubun = b.bc_gubun and a.bi_div = b.bc_code and b.bc_key='004'
left outer join b_code c on a.bi_gubun = c.bc_gubun and a.bi_purdiv = c.bc_code and c.bc_key='005'
left outer join b_code d on a.bi_gubun = d.bc_gubun and a.bi_matcls = d.bc_code and d.bc_key='006'
left outer join b_code e on a.bi_gubun = e.bc_gubun and a.bi_formdiv = e.bc_code and e.bc_key='015'
where f.bco_gubun = '01'
and a.bi_div = '010'

EX 02> 위에 SQL문을 아래처럼 수정 하려고 하는데 오류 표시라고 한 부분이 계속 안잡힙니다. 꼭좀 부탁 드리겠습니다. 수고하세요.

select f.bco_itemcode as bi_code,
       a.bi_name,a.bi_spec,
       b.bc_codename as name1,
       c.bc_codename as name2,
       d.bc_codename as name3,
       e.bc_codename as name4,
       f.bco_cog        
from  b_item a,
       b_code b,
       b_code c,
       b_code d,
       b_code e,
       b_cog  f
where f.bco_gubun(+) = a.bi_gubun and f.bco_itemcode(+) = a.bi_code
   and a.bi_gubun(+)  = b.bc_gubun and a.bi_div(+)       = b.bc_code and b.bc_key(+) = '004'  
   and a.bi_gubun(+)  = c.bc_gubun and a.bi_purdiv(+)    = c.bc_code and c.bc_key(+)='005'
   and a.bi_gubun(+)  = d.bc_gubun and a.bi_matcls(+)    = d.bc_code and d.bc_key(+)='006' <== 오류 나는 부분 ///
   and a.bi_gubun(+)  = e.bc_gubun and a.bi_formdiv(+)   = e.bc_code and e.bc_key(+)='015'
   and f.bco_gubun    = '01'
   and a.bi_div       = '010'



// 테이블



SQL> desc b_cog;
이름                                      널?      유형
----------------------------------------- -------- ----------------------------
BCO_GUBUN                                 NOT NULL VARCHAR2(2)
BCO_YEAR                                  NOT NULL VARCHAR2(4)
BCO_ITEMCODE                              NOT NULL VARCHAR2(20)
BCO_COG                                   NOT NULL NUMBER(18,6)
IN_DATE                                   NOT NULL VARCHAR2(8)
UP_DATE                                   NOT NULL VARCHAR2(8)
USER_ID                                   NOT NULL VARCHAR2(10)

SQL> desc b_item;
이름                                      널?      유형
----------------------------------------- -------- ----------------------------
BI_GUBUN                                  NOT NULL VARCHAR2(2)
BI_CODE                                   NOT NULL VARCHAR2(20)
BI_NAME                                   NOT NULL VARCHAR2(50)
BI_SNAME                                  NOT NULL VARCHAR2(30)
BI_ENAME                                  NOT NULL VARCHAR2(50)
BI_SPEC                                   NOT NULL VARCHAR2(50)
BI_SUNGSANG                               NOT NULL VARCHAR2(100)
BI_DIV                                    NOT NULL VARCHAR2(3)
BI_PURDIV                                 NOT NULL VARCHAR2(3)
BI_MATCLS                                 NOT NULL VARCHAR2(3)
BI_RMTYPE                                 NOT NULL VARCHAR2(3)
BI_SPECDIV                                NOT NULL VARCHAR2(3)
BI_MEDDIV                                 NOT NULL VARCHAR2(3)
BI_UNIT                                   NOT NULL VARCHAR2(3)
BI_MATSTS                                 NOT NULL VARCHAR2(3)
BI_PRDSTS                                 NOT NULL VARCHAR2(3)
BI_STGCOT                                 NOT NULL VARCHAR2(3)
BI_STGCON                                 NOT NULL VARCHAR2(3)
BI_GRADE                                  NOT NULL VARCHAR2(3)
BI_QCTESTDAY                              NOT NULL NUMBER(3)
BI_EFTMON                                 NOT NULL NUMBER(3)
BI_SAFEQTY                                NOT NULL NUMBER(18,6)
BI_PURCUSTCODE                            NOT NULL VARCHAR2(20)
BI_PURUNIT                                NOT NULL VARCHAR2(3)
BI_UNITCHGQTY                             NOT NULL NUMBER(18,6)
BI_PURCURR                                NOT NULL VARCHAR2(3)
BI_MINORDQTY                              NOT NULL NUMBER(18,6)
BI_PURLEADTIME                            NOT NULL NUMBER(3)
BI_ORGNATION                              NOT NULL VARCHAR2(3)
BI_MANUCO                                 NOT NULL VARCHAR2(30)
BI_HSNO                                   NOT NULL VARCHAR2(10)
BI_PRDMANUDAY                             NOT NULL NUMBER(3)
BI_LICCLASSNO                             NOT NULL VARCHAR2(3)
BI_MEDCLASS                               NOT NULL VARCHAR2(3)
BI_PERMITSPEC                             NOT NULL VARCHAR2(50)
BI_STDDOCNO                               NOT NULL VARCHAR2(30)
BI_FORMDIV                                NOT NULL VARCHAR2(3)
BI_JEJEDIV                                NOT NULL VARCHAR2(3)
BI_EFTLIST                                NOT NULL VARCHAR2(50)
BI_PERMITDIV                              NOT NULL VARCHAR2(3)
BI_PERMITNO                               NOT NULL VARCHAR2(20)
BI_PERMITDATE                             NOT NULL VARCHAR2(8)
BI_LTPERMITDATE                           NOT NULL VARCHAR2(8)
BI_STARTMANU                              NOT NULL VARCHAR2(8)
BI_SCODE                                  NOT NULL VARCHAR2(5)
BI_BATCHSTDQTY                            NOT NULL NUMBER(18,6)
BI_BATCHUNIT                              NOT NULL VARCHAR2(3)
BI_BATCHMANUQTY                           NOT NULL NUMBER(18,6)
BI_BATCHWEG                               NOT NULL NUMBER(18,6)
BI_BATCHWEGUNIT                           NOT NULL VARCHAR2(3)
BI_BATCHCHGQTY                            NOT NULL NUMBER(18,6)
BI_ONEQTY                                 NOT NULL NUMBER(18,6)
BI_QNEUNIT                                NOT NULL VARCHAR2(3)
BI_MANUDIV                                NOT NULL VARCHAR2(3)
BI_PRDSTDQTY                              NOT NULL NUMBER(18,6)
BI_PRDPACKQTY                             NOT NULL NUMBER(18,6)
BI_PRDREALINQTY                           NOT NULL NUMBER(18,6)
BI_BARCODE                                NOT NULL VARCHAR2(14)
BI_HFGCODE                                NOT NULL VARCHAR2(20)
BI_ETCOTC                                 NOT NULL VARCHAR2(3)
BI_INSURCHK                               NOT NULL VARCHAR2(3)
BI_INSURCODE                              NOT NULL VARCHAR2(20)
BI_INAME                                  NOT NULL VARCHAR2(50)
BI_SCTAXCHK                               NOT NULL VARCHAR2(3)
BI_GSTG                                   NOT NULL VARCHAR2(3)
BI_BSTG                                   NOT NULL VARCHAR2(3)
IN_DATE                                   NOT NULL VARCHAR2(8)
UP_DATE                                   NOT NULL VARCHAR2(8)
USER_ID                                   NOT NULL VARCHAR2(10)
DEL_CHK                                   NOT NULL NUMBER(1)

SQL> desc b_code;
이름                                      널?      유형
----------------------------------------- -------- ----------------------------
BC_GUBUN                                  NOT NULL VARCHAR2(2)
BC_KEY                                    NOT NULL VARCHAR2(3)
BC_KEYNAME                                NOT NULL VARCHAR2(20)
BC_CODE                                   NOT NULL VARCHAR2(3)
BC_CODENAME                               NOT NULL VARCHAR2(20)
BC_HARDCODE                               NOT NULL NUMBER
BC_GCHK                                   NOT NULL NUMBER
BC_ACHK                                   NOT NULL NUMBER
BC_HCHK                                   NOT NULL NUMBER
BC_SCHK                                   NOT NULL NUMBER
BC_MCHK                                   NOT NULL NUMBER
BC_RCHK                                   NOT NULL NUMBER
BC_QCHK                                   NOT NULL NUMBER
BC_PCHK                                   NOT NULL NUMBER
BC_TCHK                                   NOT NULL NUMBER
BC_DAY                                    NOT NULL NUMBER
BC_AMT                                    NOT NULL NUMBER
BC_GR1                                    NOT NULL VARCHAR2(3)
BC_GR1NAME                                NOT NULL VARCHAR2(20)
BC_GR2                                    NOT NULL VARCHAR2(3)
BC_GR2NAME                                NOT NULL VARCHAR2(20)
BC_GR3                                    NOT NULL VARCHAR2(3)
BC_GR3NAME                                NOT NULL VARCHAR2(20)
BC_GB1                                    NOT NULL VARCHAR2(3)
BC_GB1NAME                                NOT NULL VARCHAR2(20)
BC_GB2                                    NOT NULL VARCHAR2(3)
BC_GB2NAME                                NOT NULL VARCHAR2(20)
BC_GB3                                    NOT NULL VARCHAR2(3)
BC_GB3NAME                                NOT NULL VARCHAR2(20)
BC_REMARK                                 NOT NULL VARCHAR2(100)

1  COMMENTS
  • Profile
    너구리 2004.03.13 01:41
    아웃 조인은 한쪽 방향으로 밖에

    안됩니다.오라클에서는 아마...ㅡ,.ㅡ;;

    뒤에 붙는 004 005 006 이렇게 들어가는 구문에 있는 어웃조인을 풀어주세요.

    그쪽 애들은 아웃조인을 걸어놓고 그렇게 값을 집어넣어도 반영이

    안됩니다. 있나 없나 마찬가지란 거죠..아웃조인을 풀어야 의마를 찾겠네요.