PLSQL - PLS-00103:遇到符号"文件结束"期待以下之一时:开始函数编译指示程序

时间:2016-05-11 08:06:13

标签: sql oracle plsql

我刚才提到了与我遇到的同一ORA & PLS错误相关的类似帖子,但我仍然无法使用提供的解决方案解决此问题。

这个代码我构建了获得min&表PRODUCT_MASTER中的最大产品代码。然后从那里我将执行sqlplus以批量(最小和最大)获得所有这些数据,如下所示: -

nohup sqlplus id / pwd @ extract_pmf.sql 1 500001&

我的代码:

SET ECHO ON TIME ON TIMING ON SERVEROUTPUT ON
SPOOL EXTRACT_PMF.LOG

DECLARE PROCEDURE EXTRACT_PMF(P_MIN IN INTEGER, P_MAX IN INTEGER) AS

CURSOR C_SQL IS

SELECT   
PD_PRODUCT.SA_SRV_AREA_CODE, 
PD_PRODUCT.CO_CTRY_CODE,
PD_PRODUCT.UM_UNIT_OF_MEASURE,
PD_PRODUCT.US_UNIT_OF_MEAS_SYSTEM, 
PD_PRODUCT.PD_TYPE, 
PD_PRODUCT.PD_DESCRIPTION, 
PD_PRODUCT.PD_PART_NUMBER, 
PD_PRODUCT.PD_TARF_CODE, 
PD_PRODUCT.PD_EXCISE_CODE, 
TO_CHAR(PD_PRODUCT.PD_CRTD_DATE,'MM/DD/YYYY') CRTD_DATE, 
 PL_PROD_IN_A_LANGUAGE.LA_LANG_CODE, 
 PL_PROD_IN_A_LANGUAGE.PL_PROD_DESCRIPTION, 
CU_CUSTOMER.CU_CUST_IMPT_ID,       
A.PS_STU as STU1,
A.UM_UNIT_OF_MEASURE as UOM1,
B.PS_STU as STU2,
B.UM_UNIT_OF_MEASURE as UOM2,
C.PS_STU as STU3,
C.UM_UNIT_OF_MEASURE as UOM3,
D.PS_STU as STU4,
D.UM_UNIT_OF_MEASURE as UOM4,
E.PS_STU as STU5,
E.UM_UNIT_OF_MEASURE as UOM5,
F.PS_STU as STU6,
F.UM_UNIT_OF_MEASURE as UOM6,
G.PS_STU as STU7,
G.UM_UNIT_OF_MEASURE as UOM7,
H.PS_STU as STU8,
H.UM_UNIT_OF_MEASURE as UOM8,
I.PS_STU as STU9,
I.UM_UNIT_OF_MEASURE as UOM9,
J.PS_STU as STU10,
J.UM_UNIT_OF_MEASURE as UOM10,
PD_PRODUCT.PD_ECCN 
        FROM 
        PD_PRODUCT 
        LEFT OUTER JOIN PL_PROD_IN_A_LANGUAGE ON PD_PRODUCT.PD_PROD_CODE = PL_PROD_IN_A_LANGUAGE.PD_PROD_CODE 
        LEFT OUTER JOIN CP_CUST_PRODUCT ON CP_CUST_PRODUCT.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE 
        LEFT OUTER JOIN CU_CUSTOMER ON  CU_CUSTOMER.CU_CUST_IDENTIFIER = CP_CUST_PRODUCT.CU_CUST_IDENTIFIER
        AND CU_CUSTOMER.CU_DELETE_IND <> 'Y' 
                                LEFT JOIN PS_PRODUCT_STU A ON A.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  A.PD_STU_IDENTIFIER = 1 
                                LEFT JOIN PS_PRODUCT_STU B ON B.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  B.PD_STU_IDENTIFIER = 2
                                LEFT JOIN PS_PRODUCT_STU C ON C.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  C.PD_STU_IDENTIFIER = 3 
                                LEFT JOIN PS_PRODUCT_STU D ON D.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  D.PD_STU_IDENTIFIER = 4 
                                LEFT JOIN PS_PRODUCT_STU E ON E.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  E.PD_STU_IDENTIFIER = 5 
                                LEFT JOIN PS_PRODUCT_STU F ON F.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  F.PD_STU_IDENTIFIER = 6 
                                LEFT JOIN PS_PRODUCT_STU G ON G.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  G.PD_STU_IDENTIFIER = 7 
                                LEFT JOIN PS_PRODUCT_STU H ON H.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  H.PD_STU_IDENTIFIER = 8 
                                LEFT JOIN PS_PRODUCT_STU I ON I.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  I.PD_STU_IDENTIFIER = 9 
                                LEFT JOIN PS_PRODUCT_STU J ON J.PD_PROD_CODE = PD_PRODUCT.PD_PROD_CODE AND  J.PD_STU_IDENTIFIER = 10
        LEFT OUTER JOIN AC_ACCOUNT ON CU_CUSTOMER.CU_CUST_IDENTIFIER = AC_ACCOUNT.CU_CUST_IDENTIFIER 
        WHERE PD_PRODUCT.PD_PROD_CODE IN (SELECT PD_PROD_CODE FROM PD_PRODUCT WHERE CO_CTRY_CODE = 'SG')
        AND PD.PRODUCT.PD_PROD_CODE BETWEEN P_MIN AND P_MAX
         AND PD_PRODUCT.PD_DELETE_IND <> 'Y'; 

BEGIN
EXTRACT_PMF(&1, &2);
END EXTRACT_PMF;

/

EXIT

错误日志:

  

第1行的错误:ORA-06550:第38行,第0列:PLS-00103:遇到   符号&#34;文件结尾&#34;当期待以下之一时:开始   功能实用程序

1 个答案:

答案 0 :(得分:1)

你错过了手术的身体; SQL文件的结构应如下所示:

SQL> declare
  2      procedure EXTRACT_PMF(P_MIN IN INTEGER, P_MAX IN INTEGER) AS
  3          CURSOR C_SQL  IS /* your cursor */
  4              select p_min, p_max
  5              from dual;
  6      begin
  7          /* your procedure code */
  8          dbms_output.put_line('P_MIN = ' || P_MIN);
  9          dbms_output.put_line('P_MAX = ' || P_MAX);
 10      end EXTRACT_PMF;
 11  begin
 12      /* procedure call */
 13      EXTRACT_PMF(&1, &2);
 14  end;
 15  /
Enter value for 1: 1
Enter value for 2: 2
old  13:     EXTRACT_PMF(&1, &2);
new  13:     EXTRACT_PMF(1, 2);
P_MIN = 1
P_MAX = 2

PL/SQL procedure successfully completed.

SQL>