2016-09-13 5 views
1

私は、次のコマンドを使用して、Oracleオブジェクトの内部でnumber(7,0)属性を変更しようとしている:Oracle Alter Object?

alter type myObjectFormat 
    modify ATTRIBUTE (
    A NUMBER(7,2)) CASCADE FORCE; 

ERROR:

Error report - 
SQL Error: ORA-06545: PL/SQL: compilation error - compilation aborted 
ORA-06550: line 10, column 32: 
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: 

    exceptions 
ORA-06550: line 0, column 0: 
PLS-00565: MYOBJECTFORMAT must be completed as a potential REF target (object type) 
06545. 00000 - "PL/SQL: compilation error - compilation aborted" 
*Cause: A pl/sql compilation error occurred and the compilation was 
      aborted completely without the compilation unit being written 
      out to the backing store. Unlike ora-06541, the user will always 
      see this error along with the accompaning PLS-nnnnn error messages. 
*Action: See accompanying PLS-nnnnn error messages. 

を次のように私のオブジェクトは次のとおりです。

create or replace type myObjectFormat 
as object (
    A number(7,0) 
); 

関数を使用して(明らかにエラーを再現する例):

CREATE OR REPLACE FUNCTION STACKOVERFLOW RETURN MYOBJECTFORMAT AS 
BEGIN 
    RETURN NULL; 
END STACKOVERFLOW; 

オブジェクトのデータ型を手動で変更しようとしましたが、エラーError(1,1): ORA-02303: can't drop or replace a type with type or table dependents. SQLDev advises setting "Drop Type Force" preferenceエラーメッセージが表示されます。この時点で行う簡単なことは、このオブジェクトを使用して関数を削除し、変更を加えてから、関数を再作成することです。このデータベースが成長するにつれて、「簡単な」方法は実現可能ではありません。

のOracle参照:

Type Evolution

ALTER TYPE Statement

私は、ALTER TYPE文を使用して、ちょうど私の構文がオフになっているかどうかを知ることを好むでしょうか?私のFORCEコマンドが間違った場所にあるようです。

答えて

1

exceptions_clauseが見つからないようです。

dependent_handling_clause :: =

enter image description here exceptions_clause :: =

enter image description here

Specify FORCE if you want the database to ignore the errors from dependent tables and indexes and log all errors in the specified exception table. The exception table must already have been created by executing the DBMS_UTILITY.CREATE_ALTER_TYPE_ERROR_TABLE procedure.

意味、あなたはFORCEを持っているならば、あなたは例外に流入したいテーブル言う必要があります。

+0

したがって、エラーはまだ存在します...技術的に "エラー"が残っている場合、関数はこの変更をどのように受け入れますか?また、私は 'DBMS_UTILITY.CREATE_ALTER_TYPE_ERROR_TABLE'で未知の海域に飛び込んでいます。これを送信するスキーマとテーブルを定義する必要がありますか?どんな例? – TriHard8