0
v_stmt_sc7 := 'CREATE TABLE  TEMP_IRD_INCLUSION  as 
                     SELECT  UNIQUE a1.aer_id, ar.seq_react  
                       FROM  aer a1, aer_product ap1,  aer_react ar, aer_study ast1';

v_wstmt_sc7:=' WHERE  a1.aer_id = ap1.aer_id 
                 AND a1.aer_id  = ar.aer_id 
                 AND a1.aer_id  = ast1.aer_id
                 AND a1.aer_init_recv_date   BETWEEN  '''|| P_From_Date ||''' AND  '''||  P_To_Date ||'''   
                 AND ap1.product_groupname_id IN
                     (SELECT  LTRIM(Column_Value,''|'')   grp_id  
                        FROM TABLE(CAST(pkg_customreports_utils.c_dynamic_in (' || p_trade_name ||' )
                          AS sys.dbms_debug_vc2coll))) 
                         AND ast1.protocol_no IN
                              (SELECT LTRIM(column_value,''|'') protocol_no 
                                FROM TABLE(CAST(pkg_customreports_utils.c_dynamic_in ('''|| P_Protocol_No ||''')
                                  AS SYS.dbms_debug_vc2coll)))';

v_stmt1_sc7:= v_stmt_sc7||' '||v_wstmt_sc7; 
dbms_output.put_line('main_table_creation'||' '||v_stmt1_sc7);   
EXECUTE IMMEDIATE v_stmt1_sc7;

我通过连接两个变量来使用执行立即语句,但它不起作用。上述查询一直有效,直到 dbms 输出“main_table_creation”,但它不会立即执行语句。请指导以上,我们是否可以使用 Execute immediate 语句来连接两个变量?

4

0 回答 0