合并和修剪功能

时间:2015-09-22 07:29:34

标签: oracle11g trim coalesce

我正在尝试执行以下脚本

CREATE VIEW JOES.WEBSKULOOKUPVIEW ( 
    STYLEID , 
    STYLENAME , 
    DISPLAYSTYLENUMBER , 
    B2BSTYLE , 
    WEBPRODDESCR , 
    WEBSTYLENAME , 
    WEBSKUNUMBER , 
    SUPPLIERNAME , 
    SKUID , 
    SKUNUMBER , 
    SKUACTIVESTATUS , 
    B2BSKU , 
    SKUSIZE , 
    SKUCOLOUR , 
    WPSTYLEID ) 
    AS 
    SELECT DISTINCT ESTYLE.STYLEID, ESTYLE.STYLENAME, ESTYLE.DISPLAYSTYLENBR, ESTYLE.B2BSTYLE, WPROD.H1SJXT, WPSTYLE.H2AMNA, 
                    WPSKU.H3DINB, SUPP.SUPPLIERNAME, ESKU.SKUID, ESKU.SKUNUMBER, ESKU.SKUACTIVESTATUS, ESKU.B2BSKU,  
                    (COALESCE(TRIM(FIRSTSIZE.SHORTSCALEVALUE) , '') || COALESCE(TRIM(', ' || SECSIZE.SHORTSCALEVALUE), '')) AS "SIZE",  
                    STYLEACTUALCOLOUR.SPECIFICCOLOURNAME , STYLE.STYLEID  
                    FROM ENTERPRISE.STYLE ESTYLE, ENTERPRISE.SUPPLIER SUPP, MWWDATA.DGH1CPP WPROD,  
                     MWWDATA.DGH2CPP WPSTYLE, MWWDATA.DGH3CPP WPSKU, ENTERPRISE.STOCKKEEPINGUNIT ESKU, ENTERPRISE.STYLEACTUALCOLOUR STYLEACTUALCOLOUR,  
                     ENTERPRISE.STYLE STYLE, ENTERPRISE.STYLEACTSTATUS STYLEACTSTATUS, ENTERPRISE.STYLEACTSTATUS SKUACTSTATUS, ENTERPRISE.SKUSIZE SKUSIZE  
                    LEFT OUTER JOIN ENTERPRISE.SIZESCALEVALUE FIRSTSIZE ON FIRSTSIZESCALEID = FIRSTSIZE.SIZESCALEID AND FIRSTSIZESCALEOBJI = FIRSTSIZE.SIZESCALEOBJID  
                    LEFT OUTER JOIN ENTERPRISE.SIZESCALEVALUE SECSIZE ON SECSIZESCALEID = SECSIZE.SIZESCALEID AND SECSIZESCALEOBJID = SECSIZE.SIZESCALEOBJID          
                    WHERE   ESTYLE.DEFAULTSUPPLIERID = SUPP.SUPPLIERID AND  
                        SUPP.VENDORENTITYCODE = WPSTYLE.H2RWCO AND  
                        ESTYLE.STYLEUSERCODE = WPSTYLE.H2AICD AND  
                        WPSTYLE.H2SCNS = WPROD.H1SCNS AND  
                         WPROD.H1SCNS = WPSTYLE.H2SCNS AND  
                        WPSTYLE.H2SCNS = WPSKU.H3SCNS AND  
                        WPSTYLE.H2RWCO = WPSKU.H3RWCO AND  
                        WPSTYLE.H2AICD = WPSKU.H3AICD AND  
                        WPSKU.H3DINB = CAST (ESKU.SKUNUMBER AS DECIMAL) AND  
                        STYLE.STYLEID = ESKU.STYLEID AND  
                        ESKU.STYLEID = STYLEACTUALCOLOUR.STYLEID AND  
                        ESKU.ACTUALCOLOUROBJID = STYLEACTUALCOLOUR.ACTUALCOLOUROBJID AND  
                        STYLE.STYLEACTIVESTATUS = STYLEACTSTATUS.STYLEACTIVESTATUS AND  
                        ESKU.SKUACTIVESTATUS = SKUACTSTATUS.STYLEACTIVESTATUS AND  
                        ESKU.SKUID = SKUSIZE.SKUID AND SKUACTIVESTATUS NOT IN ('P', 'D') ;

它会抛出如下所述的错误。

(COALESCE(TRIM(FIRSTSIZE.SHORTSCALEVALUE) , '') || COALESCE(TRIM(', ' || SECSIZE.SHORTSCALEVALUE), '')) AS "SIZE",
                                                                                    *
ERROR at line 20:
ORA-12704: character set mismatch

但这是合并和修剪的语法。

那么我应该做些什么改变才能解决这个问题。

0 个答案:

没有答案