0

こんにちは、次のスクリプトを実行しようとしていますが、エラーが発生しています

ERROR at line 1:
ORA-20000: Unknown Exception Raised: -933 ORA-00933: SQL command not properly
ended
ORA-06512: at line 23

DECLARE
        l_cursor INTEGER;
        l_output  VARCHAR2(20);
        l_rows   INTEGER;
        l_sql   VARCHAR2(1000);
      BEGIN
        l_cursor := DBMS_SQL.OPEN_CURSOR;
        l_sql := 'SELECT wk_units1 FROM cnt_sls_dm.fct_sales.summary UNION SELECT wk_units2 FROM cnt_sls_dm.fct_sales.summary';  
       DBMS_SQL.PARSE(l_cursor, l_sql, DBMS_SQL.NATIVE);
       DBMS_SQL.DEFINE_COLUMN_CHAR(l_cursor, 1, l_output, 20);
       l_rows := DBMS_SQL.EXECUTE(l_cursor);
       loop
          if DBMS_SQL.FETCH_ROWS(l_cursor) = 0 then
             exit;
          end if;
          DBMS_SQL.COLUMN_VALUE_CHAR(l_cursor, 1, l_output);
          DBMS_OUTPUT.PUT_LINE('Output Text '||l_output);
       end loop;
       DBMS_SQL.CLOSE_CURSOR(l_cursor);
      EXCEPTION
       when others then
             DBMS_SQL.CLOSE_CURSOR(l_cursor);
             raise_application_error(-20000, 'Unknown Exception Raised: '||sqlcode||' '||sqlerrm);
      END;
4

2 に答える 2

1

これは何ですか?

cnt_sls_dm.fct_sales.summary

有効なテーブル宣言ではありません。

于 2009-09-01T08:10:39.040 に答える
0

動的 SQL ステートメントでエラーが発生した場合、実際の SQL ステートメントを出力して SQLplus で試すと役立つことがよくあります。

于 2009-09-01T14:08:28.507 に答える