缺少关键字,程序编译成功

时间:2017-12-02 07:34:30

标签: plsql oracle10g

这是我的程序代码

CREATE OR REPLACE Procedure SP_CUSTOMER_PRODUCT_QRY
   ( PARENT_PARTYID   IN varchar2
   , PRODUCT_ID       IN varchar2
   , PRODUCT_STATUS   IN varchar2
   , PAGING           IN varchar2
   , OFFSET           IN varchar2
   , LIST_OF_PARTIES OUT VARCHAR2 )
AS
V_SQL_WHERE varchar2(10000):= null;
V_SQL varchar2(10000) :='SELECT PARTYID INTO LIST_OF_PARTIES FROM TABLE1';
    V_check varchar2(10000) := '' ;
BEGIN

    IF(PARENT_PARTYID IS NOT NULL) THEN
      V_SQL_WHERE := V_SQL_WHERE || ' PARENT_PARTYID='||PARENT_PARTYID;
    END IF; 

    IF(PRODUCT_ID IS NOT NULL) THEN

      IF (V_SQL_WHERE is not null) THEN 
        V_SQL_WHERE := V_SQL_WHERE || ' AND ';
      END IF;

      V_SQL_WHERE := V_SQL_WHERE || ' PRODUCT_ID='||PRODUCT_ID;
    END IF; 

    IF(PRODUCT_STATUS IS NOT NULL) THEN

      IF (V_SQL_WHERE is not null) THEN 
         V_SQL_WHERE := V_SQL_WHERE || ' AND ';
      END IF; 
      V_SQL_WHERE := V_SQL_WHERE || ' PRODUCT_STATUS=' || PRODUCT_STATUS;

    END IF; 

    IF (V_SQL_WHERE is not null) then
      V_SQL := V_SQL || ' WHERE ' || V_SQL_WHERE;
    end if;


    dbms_output.put_line(V_SQL);
        EXECUTE IMMEDIATE V_SQL;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      V_check:= '' ;
    END;

,当我试图调用程序时

我到了 报告JDBC错误:(SQLState = 42000) - java.sql.SQLException:ORA-00905:缺少关键字 ORA-06512:at" DK2.SP_CUSTOMER_PRODUCT_QRY",第37行

1 个答案:

答案 0 :(得分:0)

问题已解决:

EXECUTE IMMEDIATE V_SQL INTO LIST_OF_PARTIES;

into子句早于SQL语句