各位老大,以下语句错在哪里,折腾几个小时了,帮忙看一下,在线等。declare 
SUMMARY_FLAG varchar2(10):='N';
detail_posting_allowed_flag varchar2(10) :='Y';
strWhere varchar2(1000) :=' and segment1 = ''60'' and segment2 >= ''21''  and segment2 <= ''39''  and segment3 >= ''7910'' and segment3 <= ''7990'' and segment4 = ''5501''';
begin
execute immediate 'CREATE OR REPLACE View View_GoumhTest as SELECT CODE_COMBINATION_ID 
FROM GL_CODE_COMBINATIONS where WHERE SUMMARY_FLAG = :1 and detail_posting_allowed_flag = :2 :3' using SUMMARY_FLAG,detail_posting_allowed_flag,strWhere;
end ;

解决方案 »

  1.   

    declare   
    SUMMARY_FLAG   varchar2(10):= 'N '; 
    detail_posting_allowed_flag   varchar2(10)   := 'Y '; 
    strWhere   varchar2(1000)   := '   and   segment1   =   ' '60 ' '   and   segment2   > =   ' '21 ' '     and   segment2   <=   ' '39 ' '     and   segment3   > =   ' '7910 ' '   and   segment3   <=   ' '7990 ' '   and   segment4   =   ' '5501 ' ' '; 
    begin 
    execute   immediate   'CREATE   OR   REPLACE   View   View_GoumhTest   as   SELECT   CODE_COMBINATION_ID   
    FROM   GL_CODE_COMBINATIONS   WHERE   SUMMARY_FLAG   =   :1   and   detail_posting_allowed_flag   =   :2  '||strWhere   using   SUMMARY_FLAG,detail_posting_allowed_flag; 
    end   ;