Invalid procedure after alter table add < column >

Hello Experts,

I was faced with a situation where I add a column in a table that is used in a procedure, immediately after the addition of the new procedure associated with this table column becomes invalid.

Can someone explain please know why this happens.

Database version:-11.2.0.4.

I was faced with a situation where I add a column in a table that is used in a procedure, immediately after the addition of the new procedure associated with this table column becomes invalid.

Can someone explain please know why this happens.

Yes - the Oracle documentation explains this. I found this doc with a simple search of "column, add the oracle 11g invalid procedure.

http://docs.Oracle.com/CD/B28359_01/server.111/b28318/dependencies.htm#CHDJIIFC

Table 6-2 , shows how objects are affected by changes to other objects upon which they depend.

Table 6-2 operations affects this object status

Operation Where the status of dependent objects

ALTERTABLEtableADDcolumn

INVALIDWhen:

  • Uses of the object (except a view)-dependent SELECT * on table .
  • Dependent object uses table %rowtype .
  • Dependent object performs INSERT on table without specifying a list of columns.
  • Dependent object references table in the query that contains a join in SQL.
  • Dependent object references table in the query that refers to a PL/SQL variable.

Otherwise, no change.

Read the WHOLE ARTICLE and see if it does not have to explain your problem.

Tags: Database

Similar Questions

  • ALTER Table Add column not null, no default

    I want to add two columns in a table with not null, and the default value 0 for two columns
    Can I write everything in a single statement or do I have to divide the declaration
    I tried, but didn't work

    ALTER table DWSODS01. DWT00301_ORD_DTL_OMS add)
    COMB_ORD_FLG NUMBER (5.0) default null, 0
    COMB_ORD_NO NUMBER (12.0)
    by default, 0 not null);

    How can I change the code?

    user10390682 wrote:
    OK, so if it is NOT NULL, while there should be a value.

    Yes.

    So, when I set these two columns as NOT NULL will only future data must be NON NULL.
    What of the old and present data if I defined as NOT NULL

    NOT NULL mean value of eachcolumn + line (current or future) _ must not be null. That's why always adding NOT NULL column to a non-empty table fails - the column value for existing lines will be NULL which does NOT violate the constraint nullability. If you add the NON NULL column with a default value, the column will be added and all lines existing column value will be defined by specified default (0 in your case). As a result Oracle will be able to settle forced to null for this newly added column from the value of this column in all the existing lines will be not not null (0 in your case).

    SY.

  • alter table drop column

    Hi all

    I create a simple table like this:

    create table x (a number, b varchar2 (20));

    ALTER table x modify a primary key constraint a_pk;

    insert into x values (1, 'first row');

    insert into x values (2, 'second row');

    commit;

    Then:

    SQL > select * from x;

    A AND B

    ---------- --------------------

    1 first row

    2 second row

    Then I run these commands:

    SQL > alter table drop column x.

    Modified table.

    SQL > select * from x;

    B

    --------------------

    first row

    second row

    Question: Why am I able to remove this column when a PRIMARY KEY for the table? I do not use the key words of CONSTRAINT CASCADE with the DROP COLUMN clause...

    I have Mr. Steve O'Hearn here saying this in his book 'Certified Expert Guide exam 1Z0-047:

    CREATE TABLE ORDER_RETURNS

    (NUMBER OF ORDER_RETURN_ID,

    NUMBER OF CRUISE_ORDER_ID

    DATE OF CRUISE_ORDER_DATE,

    CONSTRAINT PK_OR PRIMARY KEY (ORDER_RETURN_ID));

    .. We can not remove the column the table ORDER_RETURNS that

    is subject to the constraint PRIMARY KEY (ORDER_RETURN_ID)... The reasons are:

    ORDER_RETURN_ID is the PRIMARY KEY of this table...

    Isn't this correct?

    No - it's NOT correct - the book is bad.

    You could have just tested the FULL example in the book to verify that the statement is wrong.

    http://weirdoootamee.yolasite.com/resources/Oracle%20sql%20expert.PDF

    See page 432

    CREATE TABLE CRUISE_ORDERS
    (NUMBER OF CRUISE_ORDER_ID,
    ORDER_DATE DATE,
    PK_CO (CRUISE_ORDER_ID, ORDER_DATE) PRIMARY KEY CONSTRAINT);

    CREATE TABLE ORDER_RETURNS
    (NUMBER OF ORDER_RETURN_ID,
    NUMBER OF CRUISE_ORDER_ID
    DATE OF CRUISE_ORDER_DATE,
    CONSTRAINT PK_OR PRIMARY KEY (ORDER_RETURN_ID).
    FOREIGN KEY CONSTRAINT FK_OR_CO
    (CRUISE_ORDER_ID, CRUISE_ORDER_DATE)
    REFERENCES CRUISE_ORDERS (CRUISE_ORDER_ID, ORDER_DATE));

    create two tables - add data, if you want.

    Then try to delete the primary key column and see what happends

    ALTER table drop column order_return_id order_returns;

    The best way to learn is to actuall TRY of THINGS.

    Try it with your own table, but the FIRST thing that you should try was the real example of the book.

  • Estimating redo size of alter table DROP COLUMNS CONTINUE checkpoint of 10000

    Hello
    in my 10.2.0.3, I've got table size 90 GB suffering:
    ORA-12986: columns in partially suspended state. Propose to ALTER TABLE DROP COLUMNS CONTINUE
    I need to know how to estimate the size of redo of the:
    change the control of MORE of COLUMNS DROP table 10000 point.
    Is 2 x good estimate of table size?
    Kind regards.
    Greg

    GregG says:
    Please clarify for me how are distinguished between nitrifiants delay block trial and lower real column continue the process.
    Looks like DBC process will increment statistics such as:

    drain plug - number of calls ktugct
    gullies only - consistent read gets

    It's a good indicator, even if I think the specific statistics could be:

        commit txn count during cleanout
    

    I think it's one that tells you that you have made a change of "validation of transaction" to a block.

    I don't know why the CBD process is such redo intensive, is not on the update of ITL bit in db blocks only?

    It updates the inputs ITL and lock bytes, and it takes only entry of redo block; the overload of the roll forward database is in the tens of bytes is small compared to the 240 bytes per row of the column to fall - but if you have a large number of blocks to go before continue it really starts to have an effect, you might be fooled.

    WARNING - I haven't checked to see if delay block drain plug behaves (or even happens) on Delete column in the way that it would perform a simple update in bulk.

    Concerning
    Jonathan Lewis

  • ALTER table add constraint vs alter table change

    Hello

    could someone explain why we have two different statements when you add a constraint on an existing table?

    If I need to add a primary key constraint to a column from an existing table that I use:

    ALTER table tab1 add the key primary constraint tab1_id_cst (id)

    But if I want to add a NOT NULL constraint, the same syntax does not work, I need to use alter table change instead

    Why?

    Thank you!

    Hello

    The constraint not null is a constraint inline, average, it applies to the column level. So in order to change anything at the column level you must use "ALTER TABLE CHANGE" only.

    Remaining constraint is forced to outline, which are part of the table definition. The table definition can be modified by "ALTER TABLE... ADD '.

    In the framework of the above mentioned constraints, those are the two columns level constraints and table except constraint NOT NULL value. Change column level, you must use the syntax

    and for the level of the table, you need to use the respective syntax.

    Kind regards

    Bigot

  • Select display after alter table

    Hello
    Why ' select * view "is not display recent columns added by alter table command." Even display columns and the data from the table only. What is the oracle of mechanism used here?

    Thank you

    Vermorel

    When you create a view, you create a static 'snapshot' of the columns of the table. Adding columns in the underlying table will not change the definition of the view. Using a "select *...» "according to the definition simply indicates the database to create the view with all the columns that appear in the table at this moment in time. He does not mean "dynamically change the display when the table is changed," which would negate the whole point of views.

    E.g.:

    SQL> create table t1 (col1 number,
      2                   col2 number);
    
    Table created.
    
    SQL> create view v1 as select * from t1;
    
    View created.
    
    SQL> desc t1
     Name
     --------------------------------------------------------
     COL1
     COL2                                                           
    
    SQL> desc v1
     Name
     --------------------------------------------------------
     COL1
     COL2                                                           
    
    SQL> alter table t1 add (col3 number);
    
    Table altered.
    
    SQL> desc t1
     Name
     --------------------------------------------------------
     COL1
     COL2
     COL3                                                           
    
    SQL> desc v1
     Name
     --------------------------------------------------------
     COL1
     COL2                                                           
    
    SQL> create or replace view v1 as select * from t1;
    
    View created.
    
    SQL> desc v1
     Name
     --------------------------------------------------------
     COL1
     COL2
     COL3                                                           
    
  • ALTER table add partition error

    Hello world

    In fact, I add more partitions in an existing table. My sql is

    ALTER table dmp_tlog1_bk add the partition by range (tmonth)
    (
    P9_200908 lower VALUES (200909) PARTITION.
    P10_200909 lower VALUES (200910) PARTITION.
    PARTITION P11_200910 lower VALUES (200911));
    commit;

    but I get the following error
    Error from the 1 in the command line:
    ALTER table dmp_tlog1_bk add the partition by range (tmonth)

    P9_200908 lower VALUES (200909) PARTITION.
    P10_200909 lower VALUES (200910) PARTITION.
    PARTITION P11_200910 lower VALUES (200911)
    Error report:
    SQL error: ORA-00902: invalid data type
    00902 00000 - "invalid data type".
    * Cause:
    * Action:
    validation succeeded.


    The data type of the tmonth is number (8.0) is the structure of the table.


    could you please help?


    Thank you very much
    alter table dmp_tlog1_bk add partition P9_200908 VALUES less than (200909)
    /
    

    SY.

  • ALTER table drop column is too slow on the big table

    Hi all
    the user has run after a command in oracle 10 G: - >
    ALTER table < table name > Delete column (< cloumn list >); table in question is of a size 41GB.

    the results of the command to cancel space filled.
    Tips of even trace file cancel segemnts.

    query failed for hours.
    Why cancel is linked to this
    and what would the resolution for this.

    Unused help set...


    Thanks in advance,
    Rock

    Would it be useful to assign unused columns?
    What about dbms_redefinition?

  • ALTER TABLE ADD CONSTRAINT

    Hi all
    I need to know if the instructions ALTER TABLE... ADD CONSTRAINT can specify the TABLENAME parameter where I want to create the score.
    Is this possible? If I can, could you please give me the syntax, please?
    If this is not the case, how can I create a table in a schema and for any other primary key?

    Thanks in advance

    Steven

    stesappo wrote:
    Hi all
    I need to know if the instructions ALTER TABLE... ADD CONSTRAINT can specify the TABLENAME parameter where I want to create the score.
    Is this possible? If I can, could you please give me the syntax, please?
    If this is not the case, how can I create a table in a schema and for any other primary key?

    Thanks in advance

    Steven

    What is a "score"? Do you mean the underlying unique index is created to enforce the primary key constraint?

    I guess you mean TABLESPACE, instead of TABLENAME?

    Yes you can.

    alter table ... add constraint ... primary key (...)
    using index tablespace ...
    /
    
  • Reclaim space after ALTER TABLE DROP PARTITION

    Hello

    I have a partitioned table. My requirement is to reclaim the space by dropping a partition of the table.

    Is it possibe to recover space for the tablespace by dropping a partition of partition table?

    Thank you

    Hello

    ALTER TABLE DROP PARTITION will always return the space to the storage to be reused by other segments.

    It's the ALTER TABLE TRONQUER SCORE, where you can specify DROP STORAGE or of REUSE STORAGE clause (in case of re-use, the space is not released and can be used by the new lines inserted in the same partition). The DROP STORAGE should be the default option.

    But for the fall of the score, you don't have to worry.

    Kind regards
    Martin

  • How to get data in the procedure after CREATE TABLE table1 AS SELECT * from table2

    Hello

    can any body tell me how to get the data in the new table created in the procedure. because it gives following error.

    • Error (47,21): PL/SQL: ORA-00942: table or view does not exist

    tableName: = "BCKUP_" | TO_CHAR (sysdate, 'ddmmrrrr');

    tableDDL: = 'CREATE TABLE' | tableName. "AS SELECT * FROM Table1 where to_char(MSG_IN_TIME,''dd-mon-rrrr'') < sysdate - ' | daysNumber;

    EXECUTE IMMEDIATE backUpDDL;

    COMMIT;

    DELETE FROM Table1;

    How to select the data in the newly created table. as...

    Select * from ". tableName;

    Do not choose anything to get the number...

    Just after backupDDL EXECUTE IMMEDIATE, simply refers to SQL % ROWCOUNT - who will be the number of lines.

    Oh and DDL engages automatically, your commitment is redundant.

  • Generate the DDL - change is a new column and I want to generate an alter table.

    All, morning

    I searched and searched all over the Data Modeler and I can't find this option... but I found it easily in the designer.
    I hope you can help me.

    V3.0.0.665 SQL Developer Data Modeler.

    I added a new column to a table, and when I generate the DDL I wish it were an alter table add column rather than a table to create.
    This feature is in the designer, so I think it would be in the Data Modeler.

    Just in case my description isn't clear, here are the high level steps, then it is clear.

    1 create logic model
    2. create the relational logic.
    3. create the physical relationship.
    4 generate the DDL and run in the database. At this point, I'm going to production with my system, and all right.
    5. at this point, we have an enhancement request. For the model, it will be a new column in a table.
    6. update of the logic model.
    7. relational update logic
    8 physical update of relational
    9 generate the DDL. Here, I would have generate it know that it needs to generate an alter table add column and does not create the table.
    This is something I do a lot as all my models are in production. I can't find how to do this step to get data Modeler to generate the altar.
    Designer done exceptionally well.

    Quite often, it is more than a single column. Changes can be many and made over time and at the time of generating the DDL you remember not every single amendment. To have the tool discover these changes for you and generate the appropriate DDL is a feature that I consider as very high.

    I hope that is clear and you can help me.

    See you soon
    Chris...

    Hi Chris,

    you need to compare your model on database - database relational model even import and use the option 'swap target' - in this case 'expressions of alter' against the database will be generated.
    You can watch demonstrations here http://www.oracle.com/technetwork/developer-tools/datamodeler/demonstrations-224554.html
    It would probably be more useful http://download.oracle.com/otn_hosted_doc/sqldev/importddl/importddl.html
    Sooner or later your changes will require the table to be recreated, and you will need to backup your data - you can consider using the 'Advanced DDL' option - script is generated that will land your table content (including LOBs) to the system of files accessible from the database and restore after changes. Well not try directly on the production system :).

    Philippe

  • ALTER TABLE with the column NULL time consuming

    Hello

    I have a table with nearly 2 million documents (about 10 GB size table) when I perform the following change statement its run fast

    ALTER TABLE tbl_1 ADD (DEFAULT col_4 NUMBER 100 NOT NULL);

    but when I do not give the NOT NULL in the alter its taking a long time to complete this i.e tbl_1 of ALTER TABLE ADD (NUMBER col_4 by DEFAULT 100); once I do the column as NOT NULL.

    Can someone explain why is it happening like that regarding the execution point.

    Thanks in advance.

    I can reproduce the effect in 11.2.0.1 - but not in 12.1.0.1.

    drop table tbl_1;

    create table tbl_1

    as

    Select rownum id

    , lpad ('* ', 50,' *') padding

    of the double

    connect by level<=>

    ALTER TABLE tbl_1 ADD (NUMBER col_4 by DEFAULT 100);

    --> slow in 11.2.0.1; fast 12.1.0.1

    ALTER TABLE tbl_1 ADD (DEFAULT col_4 NUMBER 100 NOT NULL);

    --> Quick 11.2.0.1 and 12.1.0.1

    A SQL trace for two operations (11g) shows that the altar slow (without the constraint explicit non-null) made explicit (and tedious) update of any row in the table:

    Update 'TBL_1"set"COL_4"= 100

    call the query of disc elapsed to cpu count current lines

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Parse        1      0.00       0.02          0          1          0           0

    Run 1 11,63 33.56 8336 1016125 2053531 1000000

    Fetch        0      0.00       0.00          0          0          0           0

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Total 2 11,63 33,58 8336 1016126 2053531 1000000

    The other trace file does not contain the explicit Update. I guess in the optimized case that oracle stores somewhere that col_4 has the value 100 and updates only the line of the block after completing DML operations. But that's just a guess.

  • foreign key ALTER TABLE QUERY PROBLEM

    HAI ALL,

    ANY SUGGESTION PLEASE?

    UNDER: foreign key ALTER TABLE QUERY PROBLEM

    I want TO CREATE AND ALTER TABLE foreign key:

    1.TABLE:HAEMATOLOGY1
    COLUMN: HMTLY_PATIENT_NUM
    WITH
    TABLE: PATIENTS_MASTER1
    COLUMN: PATIENT_NUM (THIS IS THE KEY PRIMARY AND UNIQUE)

    1.TABLE:HAEMATOLOGY1
    COLUMN: HMTLY_TEST_NAME
    WITH
    TABLE: TESTS_MASTER1
    COLUMN: TEST_NAME ((C'EST LA CLÉ UNIQUE))
    ---------------


    SQL + QUERY DATA:
    -----------
    ALTER TABLE HAEMATOLOGY1
    Key constraint SYS_C002742_1 foreign (HMTLY_PATIENT_NUM)
    references PATIENTS_MASTER1 (PATIENT_NUM);

    ERROR on line 2:
    ORA-01735: invalid option of ALTER TABLE

    NOTE: THE NAME OF THE CONSTRAINTS: SYS_C002742_1 TAKEN FROM ORACLE ENTP TABLE DETAILS. MGR.
    ---------
    ALTER TABLE HAEMATOLOGY1
    Key constraint SYS_C002735_1 foreign (HMTLY_TEST_NAME)
    references TESTS_MASTER1 (TEST_NAME);

    ERROR on line 2:
    ORA-01735: invalid option of ALTER TABLE

    NOTE: THE NAME OF THE CONSTRAINTS: SYS_C002735_1 TAKEN FROM ORACLE ENTP TABLE DETAILS. MGR.

    ==============

    4 TABLES OF LABORATORY CLINIC FOR DATA ENTRY AND GET REPORT ONLY FOR THE TESTS CARRIED OUT FOR PARTICULAR

    PATIENT.

    TABLE1:PATIENTS_MASTER1
    COLUMNS: PATIENT_NUM, PATIENT_NAME,

    VALUES:
    PATIENT_NUM
    1
    2
    3
    4
    PATIENT_NAME
    BENAMER
    GIROT
    KKKK
    PPPP
    ---------------
    TABLE2:TESTS_MASTER1
    COLUMNS: TEST_NUM, TEST_NAME

    VALUES:
    TEST_NUM
    1
    2
    TEST_NAME
    HEMATOLOGY
    DIFFERENTIAL LEUKOCYTE COUNT
    -------------

    TABLE3:HAEMATOLOGY1
    COLUMNS:
    HMTLY_NUM, HMTLY_PATIENT_NUM, HMTLY_TEST_NAME, HMTLY_RBC_VALUE, HMTLY_RBC_NORMAL_VALUE

    VALUES:
    HMTLY_NUM
    1
    2
    HMTLY_PATIENT_NUM
    1
    3
    MTLY_TEST_NAME
    HEMATOLOGY
    HEMATOLOGY
    HMTLY_RBC_VALUE
    5
    4
    HMTLY_RBC_NORMAL_VALUE
    4.6 - 6.0
    4.6 - 6.0
    ------------

    TABLE4:DIFFERENTIAL_LEUCOCYTE_COUNT1
    COLUMNS: DLC_NUM, DLC_PATIENT_NUM, DLC_TEST_NAME, DLC_POLYMORPHS_VALUE, DLC_POLYMORPHS_

    NORMAL_VALUE,

    VALUES:
    DLC_NUM
    1
    2
    DLC_PATIENT_NUM
    2
    3
    DLC_TEST_NAME
    DIFFERENTIAL LEUKOCYTE COUNT
    DIFFERENTIAL LEUKOCYTE COUNT
    DLC_POLYMORPHS_VALUE
    42
    60
    DLC_POLYMORPHS_NORMAL_VALUE
    40-65
    40-65
    -----------------


    Thank you
    RCS
    E-mail:[email protected]
    --------

    ALTER TABLE HAEMATOLOGY1
    ADD Key constraint SYS_C002742_1 foreign (HMTLY_PATIENT_NUM)
    references PATIENTS_MASTER1 (PATIENT_NUM);

  • ALTER TABLE hf_altertest ADD COLUMN does not

    I am using ORACLE 11g and my FDI is Developer SQL 4.1.1

    It's all free PC version that has limits.

    I tried on:

    CREATE TABLE hf_altertest

    (

    contact_id INTEGER NOT NULL

    , name VARCHAR (25)

    , last_name VARCHAR (35)

    PRIMARY KEY (contact_id)

    );

    ALTER TABLE hf_altertest State to add a CHAR (2) COLUMN;

    But when I go to run the ALTER TABLE statement then I get following error:

    rror starting at line: 1 323 in command.

    ALTER TABLE hf_altertest State to add a CHAR (2) COLUMN

    Error report-

    SQL error: ORA-00904: invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    I can run the same code in MySQL without error.

    This leads me to think that maybe I'm just bumping into a limit in the free version of PC.

    Any thoughts?

    3003916 wrote:

    I am using ORACLE 11g and my FDI is Developer SQL 4.1.1

    It's all free PC version that has limits.

    ALTER TABLE hf_altertest State to add a CHAR (2) COLUMN;

    But when I go to run the ALTER TABLE statement then I get following error:

    rror starting at line: 1 323 in command.

    ALTER TABLE hf_altertest State to add a CHAR (2) COLUMN

    Error report-

    SQL error: ORA-00904: invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    I can run the same code in MySQL without error.

    This leads me to think that maybe I'm just bumping into a limit in the free version of PC.

    Any thoughts?

    There is no LIMIT to the 'free' version  If you read the error message he said THAT was not a valid identifier.  Just to show you that I tried your erroneous statement

    ALTER TABLE hf_altertest ADD COLUMN state2 CHAR(2);
    

    and here is the indicator error message in SQL +.

    SQL * more: Production of liberation 12.1.0.2.0 Tue Oct 15 14:34:57 2015

    Copyright (c) 1982, 2014, Oracle.  All rights reserved.

    Connected to:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

    With the partitioning, Real Application Clusters, Automatic Storage Management, OLAP

    and Data Mining options

    Add a COLUMN state2 TANK (2)

    *

    ERROR on line 2:

    ORA-00904: invalid identifier

    As you can see (and as the previous poster of response indicates), the 'COLUMN' KEYWORD is not necessary when adding new columns.  Only when 'RENAME' is used, then you add the keyword COLUMN.

    See the documentation for the syntax of ALTER TABLE here--> http://docs.oracle.com/database/121/SQLRF/statements_3001.htm#SQLRF01001

    See specific clause RENAME syntax here--> http://docs.oracle.com/database/121/SQLRF/statements_3001.htm#i2183480

Maybe you are looking for

  • Installed to 32 GB of RAM but only 16 GB usable

    I have an iMac 27 ", end of 2013 model. I am running Windows 7 Home Premium 64 bit on it via BootCamp. I ordered (4) 8 GB of RAM from Crucial.com and install myself. Now iMac says he sees the 32 GB but only 16 GB is usable. I have already confirmed o

  • When computer is closed

    When I shut down my computer, I get a box that says: ccsvcHSt error end of program. Can someone help me with this. I have a Windows XP Home Edition. Thank you.

  • problem with tasklist C:\Documents and Settings\appadmin &#62; tasklist ERROR: invalid class

    Please let me know if a resolution for this

  • Connection speed 2.4 Ghz E3000 and USB HDD

    I use WRT160N for my internet and wifi at home. For the storage of the laptop, I use Seagete Free Agent 2 TB USB 3.0, which is nice by car. So I desided to buy E3000 and use as storage server, router, internet and wifi. I install everything, he went

  • How to eliminate the buffer?

    Hello! When I started using this computer which has Windows Vista installed top, videos do not put in the buffer.  For some unknown reason, the videos now buffering.  Sometimes they take a long time to start, due to the buffering.  The buffering also