Can't have alter table in SP ?

I tried to create a procedure
CREATE OR REPLACE PROCEDURE sp_disablefk
is
begin
Alter Table ACCOUNTDETAIL
Disable constraint SYS_C0022265;
end;
It returned me a message Encountered symbol Alter when expecting .....
However, when I place same statement in Execute Immediate statement, also inside of procedure, it creates and executes it without problems.
Can I still have it straight inside of SP, without Execute Immediate ? This constraint is FK referensing PK in another table.
Thanks

It is true for any DDL statement (which includes CREATE/DROP, of course).
By naked DDL he meant that DDL statements can not be placed within PL/SQL block just on their own (like other SQL statements - SELECT, INSERT, UPDATE etc...).
They need to be wrapped inside EXECUTE IMMEDIATE or for older Oracle versions using DBMS_SQL package.

Similar Messages

  • Can we have datA TABLES in EP?

    Hi All ,
    My requirement is to save an invoice image in KM and then maintain all the data (invoice no.,type,success/failure,image id etc.) for that image.
    Do we have any feature in EP which can help?
    Please reply soon!
    Helpful answers will get sure points.
    Sumit

    hi,
    i would suggest you to create the xml content file of the the invoice data and save it in the same folder. same way you can retrieve and read the xml file dynamically. however this is a tricky solution.
    to make it simple you can use any other database and use JDBC connnections to store & retrieve the data.
    regards,
    rohin

  • How can we have  Multiple table outputs in a ABAP Query .

    HI Experts .
    query output in 3 different  abap list s
    My requirement is to have  basic list of 20 fields  and the  summation list of 6 individual fields ( grouping ) and  another table output of 10 fields in a single query and single output .  the second and the 3 rd output fields are from  the basic list only .
    kindly help
    Pols

    The user is asking about  Query with more than one list as output.
    like Multiple list in  a ouput.

  • Can i Have a Tables Link in CRM.....

    Please anyone is having links of tables used in CRM Sales....let me know the link or documentation....
    Thanks,
    Saurin ..

    Hi Shiva,
    could you please send me also the document with tables and relation ship between tables? I´m a CRM Consultant for about one Month now and i would be very helpful for me to know more about the tables and relationships in CRM.
    My E-Mail is [email protected]
    Kind regards.
    André

  • What is the version of grant alter table, drop table to user in Oracle 10g?

    Hi,
    Oracle support "grant alter table and drop table" before, but I get the "invalid privilege" error in Oracle 10g. Oracle 10g have the "DROP ANY TABLE" and "Alter any table". Is these two means can drop and alter tables belonging to other users? How do I grant the total control (CRUD) of tables in the owner's schema to the owner in Oracle10g?
    Thanks,
    Jiang

    CREATE TABLE privilege grants complete control on owner's tables :
    SYS@db102 SQL> create user test01 identified by test01;
    User created.
    SYS@db102 SQL> grant create session, create table to test01;
    Grant succeeded.
    SYS@db102 SQL> alter user test01 quota unlimited on users;
    User altered.
    SYS@db102 SQL> conn test01/test01
    Connected.
    TEST01@db102 SQL> create table test(a number);
    Table created.
    TEST01@db102 SQL> alter table test add(b varchar2(100));
    Table altered.
    TEST01@db102 SQL> drop table test purge;
    Table dropped.
    TEST01@db102 SQL>                                                      

  • ALTER TABLE privilege and CREATE/DROP/ENABLE/DISABLE constraint privilege

    Hi,
    I am looking for some detailed info regarding the below previleges
    ALTER TABLE, CREATE CONSTRAINT, DROP CONSTRAINT, ENABLE CONSTRAINT AND DISABLE CONSTRAINT PRiVILEGES.
    I have two schemas 'A' and 'B', I want to provide user 'A' with Alter table, create or drop constraint,Enable or Disable constraint on schema B.
    Please let me know how to make this work.
    Thank you

    I got the answer for my second question, I have an option to grant 'Alter ANY table' privilege to the user.Yes, but you should not do that.
    Regarding question one, Suppose I have two schemas A and B and I want Schema A to have alter table privilege on all tables of Schema B.
    Can I do this in one command No
    or I need to grant alter on each table saperately?Yes
    If I am chosing the second option for each table saperately then whenever a table is added in schema B we need to grant privilege on that table as well.Yes. But nothing strange there. Designing and creating objects includes the privileges on them.
    If user A is granted with alter table privilege on a table which user B owns then can user A drop/create/enable/disable constraints for that table?Yes, isn't that what all this about?
    Again, letting one user alter the objects of another user is generally not such a good idea. Hope you see this from our discussion.
    Alter table privilege includes adding and dropping columns. This is why I suggested writing a procedure that does exactly what you need. And then grant execute on that to A.
    The best thing of course would be NOT TO disable the constraints, they are probably there for a reason.
    I am currently handling an issue where one session doing this, deadlocks with another session doing only selects - From other tables, that is!
    Regards
    Peter

  • How can i make a CHECK in an ALTER table, to compare 2 Variables of TWO different tab

    I have 3 tables:
    EVALUATION (No_expert, No_article)
    EXPERT (No_expert, origine, name)
    AUTHOR_ARTICLE (No_Article, Code_author)
    AUTHOR (Code_author, Name, Original)
    and my question is: How can i make a check to refuse each time an EXPERT ADDED to the EVALUATION table. If this one is an AUTHOR, in other words, the EVALUATION.No_expert must <> than AUTHOR.Code_author.
    This is what i did but it doesn't work:
    ALTER TABLE EVALUATION ADD CONSTRAINT No_expert
    CHECK (EVALUATION.No_expert <> AUTHOR_ARTICLE.Code_author);
    thank a lot
    luong.

    See Disabling (graying-out) Form Fields by Thom Parker. It covers both Acrobat and LiveCycle forms.

  • Can't import DDL file that has alter table rename constraint

    Hi:
    Version 3.1.0.691 on Windows 7 Enterprise 64-bit SP1
    I'm trying to import a DDL file with syntax similar to what's below. The <name> notes that I've replaced the actual names for obfuscation purposes.; the real names are in the script.
    ALTER TABLE <name>
    RENAME CONSTRAINT SYS_C0041150
    TO <name2>_CK;
    ALTER TABLE <name>
    RENAME CONSTRAINT AVCON_1281559518_ACTIV_022
    TO <name2>_CK;
    I get the following error:
    Oracle SQL Developer Data Modeler 3.1.0.691
    Oracle SQL Developer Data Modeler Import Log
    Date and Time: 2012-01-13 16:29:05 PST
    Design Name: <name>
    RDBMS : Oracle Database 11g
              All Statements:           819
              Imported Statements:      0
              Failed Statements:           0
              Not Recognized Statements:      819
    <<<<< Not Recognized >>>>>
    ALTER TABLE <name>
    RENAME CONSTRAINT SYS_<name>
    TO <name2>_CK
    ALTER TABLE <name>
    RENAME CONSTRAINT AVCON_1281559518_QVI_A_000
    TO <name2>_CK
    Thanks for any help you can provide.
    Doc

    Hi:
    The file was indeed comprised of just alter statements. As a test, I trimmed the file down to just one alter statement:
    ALTER TABLE <name> RENAME CONSTRAINT SYS_C0041413 TO <name2>_CK;
    The output file contained exactly the following, where the <<BEGIN OF FILE>> and <<END OF FILE>> were simply added here for clarity. There was no section called
    <<<<< ERRORS >>>>> and the ddl file contained no create table statements.
    <<BEGIN OF FILE>>
    Oracle SQL Developer Data Modeler 3.1.0.691
    Oracle SQL Developer Data Modeler Import Log
    Date and Time: 2012-01-16 10:16:42 PST
    Design Name: <name>
    RDBMS : Oracle Database 11g
              All Statements:           1
              Imported Statements:      0
              Failed Statements:           0
              Not Recognized Statements:      1
    <<<<< Not Recognized >>>>>
    ALTER TABLE <name> RENAME CONSTRAINT SYS_C0041413 TO <name2>_CK
    <<END OF FILE>>
    Other info.
    When I do an model import, none of the existing check constraint names get captured. Also, if I add names afterwards to two separates models via DM and then compare them. The output DDL shows a drop of the target constraint referencing its name, but the recreation of the not null constraint doesnt reference the source constraint name set for it manually in DM. Here's the example I did and the output ddl.
    ALTER TABLE <name>
    DROP CONSTRAINT SYS_C0041413
    ALTER TABLE <name>
    MODIFY ( <column_name> NOT NULL )
    That last line should have read as follows due to the constraint_name I added for it in DM.
    ALTER TABLE <name>
    MODIFY (<column_name> CONSTRAINT <name2>_CK NOT NULL);
    In the example directly above, <name2>_CK is the name I explicity set via DM and would have expected the compare to have used to recreated the constraint since it referenced the target constraint name when it constructed the drop constraint syntax.
    I believe at least one bug is involved here, most likely two.
    The first bug is that model imports are not capturing not null check constraint names.
    The second bug is that the source constraint name is not being used when generating the ddl necessary to change the not null constraint name in the target model.
    All of this is assuming that I haven't just goofed and forgotten to check a box somewhere telling it to do what I've been talking about here. :-)
    Doc

  • Can you have a calculated column in a table not a view?

    We have a table which contains a series of rows
    Key   Effective Date   Value
    1       10/Feb/2006     123
    1       23/Oct/2006      456
    ...We have a requirement to store an indicator that tells us which row is the most current and what the end date of the preceding row was so that we get something along the lines of:
    Key   Effective Date   Value   Status         End Date
    1       10/Feb/2006     123      HISTORY    22/Oct/2006
    1       23/Oct/2006      456     CURRENT   NULL
    ...I can produce this result quite easily using the analytic function LEAD. My question is, is the answer to this problem to create a view over the table that includes the analytic function or is it possible to define a calculated column in a table that would populate/maintain this vale as part of a table definition?
    And as I finish writing this I feel I've answered my own question but hey, there's no harm in asking how others have handled this kind of situation.
    Cheers
    Richard

    My bias would be to create a view that did the calculation.
    In theory, you could add those additional columns to a table and maintain the data via a set of triggers, but that would be substantially more complicated than the alternatives for little or no benefit.
    A third option would be a materialized view. That might be easier to deal with if you want to have different indexing strategies for current and historical records or if the historical data is queried often enough and updated infrequently enough that it ends up being cheaper to do the calculation once during the update rather than every time the query is run.
    A fourth option would be to use stored procedures to maintain the data and have that stored procedure expire the current row and add the new row.
    Finally, you might consider version-enabling your table using Workspace Manager rather than writing your own code since Oracle has already written all this code for you.
    Justin

  • Can we have triggers that get fired when we Query a table?

    Hi All,
    What could be the pricise answer to the following question?
    1. Can we have triggers that get fired when we Query a table?
    2. What the relation of triggers and delete, truncate statement in one line?
    3. What is data modelling? Why is it necessary?
    4. Which are not mandatory but essential files in Oracle?
    Regards,
    AAK

    1. Can we have triggers that get fired when we Query a table?for INSERT, UPDATE and DELETE statement, yes
    for SELECT statement, no.
    Question 2 is not clear for me.
    Question 3 is very very general ...
    4 >Which are not mandatory but essential files in Oracle?
    all database files (initialization file, control files, datafiles, redo log files) are mandatory. What is not mandatory but considered as a (very) bad practice is
    to have only 1 control file and only 1 redo log group with 1 redo log file.

  • I am using pages '09. I have been trying to put together a report and I am using tables to help keep my data in line. My data is free text and would like to footnote certain data as to it origin, but footnoting is grey-out. How can I footnote on table mod

    I am using pages '09. I have been trying to put together a report and I am using tables to help keep my data in line. My data is free text and would like to footnote certain data as to it origin, but footnoting is grey-out. How can I footnote in table mode inpages '09?

    Footnotes can only be inserted in the main text area between the margins on a Word Processing document.
    Peter

  • How can I tell what table(s) have the most transactions against them

    Hello, in Oracle 11.2.0.3, RHEL 6 x86-64, how can I tell what tables have the highest transaction activity?
    Picked "Objects" because I could not find a space related to performance tuning
    Humbly,

    What version of Oracle are you running (standard or enterprise)?
    Easist system is to run an AWR or statspack report. If you run either of these you will see sections on segments (so segments by logical reads, physical reads) which is easily digestible.
    v$segment_statistics will also give you a breakdown on segment access.

  • HOW CAN I HAVE DUMMY FACT TABLES IN ONE UNION REPORT

    Hello developers,
    So, I am trying to have a report from 4 different subject areas. Each of these have transaction numbers under Fact-table. B’se these fact tables are under different subject area I can’t have them in one report, (fact table has to be a one to many relationship and not otherwise). How do I make sure I end up with a transaction number from atleast 1 subject area and ignore the other ones or avoid the error
    Also in addition, I have to have the last 4 digits of the credit card number which is located in only one of those 4 subject area. How do I make sure its included with my final report eventhough its not in other subject areas? Please please help I am still new in this business
    thanks in advance
    Chuck

    You got two choices:
    A. Use OBIEE:
    1) Create a OBIEE logical SQL like
    SELECT A.s0 field1, C.s2 field2, A.s1 Measure1, B.s1 Measure2, C.s1 Measure3
    FROM
    (Select "Txn Attributes"."Transaction Number" s0, Measure.Measure1 s1 FROM "Subject Area 1") A,
    (Select "Txn Attributes"."Transaction Number" s0, Measure.Measure2 s1 FROM "Subject Area 2") B,
    (Select "Txn Attributes"."Transaction Number" s0, Credit."Last 4 digits" s2, Measure.Measure3 s1 FROM "Subject Area 3")
    WHERE A.s0 = B.s0
    AND B.s0 = C.s0
    2) Test this SQL from "Issue SQL" section in answers.
    3) Once tested, open a new analysis, go to Advanced tab and put this tested logical SQL in the SQL section and apply it. If you come back to criteria tab, you will see 5 fields are created for you.
    This is technically feasible. Pulling this off is hard and this is a maintenance nightmare.
    Since you are self-proclaimed newbie, I would suggest you take the alternative: fixing it through ETL. Create a new fact and write an ETL job to load this fact from other facts and dimensions. Then model it in RPD. This is more work but if you mess something up in the process of implementing first option, you may need to apply nearly same effort to fix that. Choice is yours.

  • Can we have more than one primary key constraint to a Oracle Table?

    Hi,
    Can we have more than one primary keys to a single table in oracle? ( Not the composite key)
    Please somebody answer..
    Regards,
    Alaka

    811935 wrote:
    Can we have more than one primary keys to a single table in oracle? ( Not the composite key)
    In principle a table can have multiple keys if you need them. It is a very strong convention that just one of those keys is designated to be "primary" but that's just a convention and it doesn't stop you implementing other keys as well.
    Oracle provides two uniqueness constraints for creating keys: the PRIMARY KEY constraint and the UNIQUE constraint. The PRIMARY KEY constraint can only be used once per table whereas the UNIQUE constraint can be used multiple times. Other than that the PRIMARY KEY and UNIQUE constraints serve the same function (always assuming the column(s) they are applied to are NOT NULL).

  • How can i have Query trace results in a table format?

    How can i have Query trace results in a table format?

    Are you referring to reading the trace files generated under udump folder?
    Well, you can make use of external tables, but you really need to be a master in understanding that cryptic data.
    Check out following link for an alternative.
    http://www.oracle.com/technology/pub/articles/gallagher_tfm.html

Maybe you are looking for

  • Error invoking a web service within another web service

    Hi all! I have to develop a web service which needs to invoke another web service, thus the first web service is acting as a client of the second one. To get this, the first web service uses the proxy provided by the home page of the second one. Howe

  • How can you Play Flickr set in exact order

    I am using the apple tv screensaver with photos from my Flickr set.  I want them played in the exact order.  ATF seems to randomize them. Can I fix this?

  • Missing the visual upgrade option on SP 2010 site

    I have a series of content databases that were upgraded from MOSS 2007. Most have not yet undergone the visual upgrade. Today, I have been working on copying two of those sites to a new location. I created two new team sites. These of course already

  • Invalid Entry in Trex Configuration

    Hi gurus, We have just installed an application server and attached it to our portal system. When a user logs into this application server and tries to make a search an error message is displayed: "Error during search occurred - com.sapportals.wcm.Wc

  • Trying to change artist name to consolidate on ipod....

    but when I type in (for ex.) "Janet Jackson", it automatically converts it to "janet jackson". This is causing me to have two files for Janet Jackson on my ipod, therefore to find music, I have to look through each one. How do I change this auto-corr