Dropping several tables

Hello

I have 3 tables, year, Gallery and photos. Tables of the year and the gallery are interconnected via the primary id key year tables and photos table is related to the gallery via the id primary key table tables Gallery, as follows: -.

Picture of the year

Year_ID

year

Gallery Table

gallery_id

Year_ID

name

Table photos

photo_id

gallery_id

image

Legend

I want to be able to delete a year, all the galleries related to the year and delete all the photos associated with these galleries in a single command. When a gallery and or a photo id does not exist, I still want to be abl eto remove the year. I think I have to do this by using a left join, but I'm struggling with the concept / the structure of the command.

Any pointers in the right direction would be greatly appreciated.

Thank you.

You don't mention what DBMS you are using. If your DBMS allows it, you can create your foreign key with cascading deletes constraints. There are some pitfalls with this then make sure you understand what you do.

If you do not want to go this route, many DBMS support several deletions from table, but I wouldn't recommend it. Personally, I'd build just 3 delete statements; start with photos, then the Gallery, and then the year.

Tags: Dreamweaver

Similar Questions

  • How to remove several tables in a statement

    I could used to run the below syntax to remove several tables in MS SQL, but it is not work in Oracle looks, I use free Oracle SQL Developer. Not a big deal, but want to know if this is possible. Thank you


    DROP TABLE A, B, C, D, F

    You can't do it in a single SQL statement, you can write a pl/sql script:

    begin
    execute immediate 'drop table a';
    execute immediate 'drop table b';
    execute immediate 'drop table c';
    execute immediate 'drop table d';
    end;
    /
    

    Max
    http://oracleitalia.WordPress.com

  • Connection Internet drops several times every 5 to 15 minutes

    Connection Internet drops several times every 5 to 15 minutes.  It is an old ASUS week ultrabook computer that is running Windows 7 Home Premiuim.  The problem is not the network as 4 other wireless computers work properly. Also, same problem is observed on the other two networks.  Only change in the computer as he received is the addition of Kapersky anti-virus and Microsoft Office 2003.  Problem seems to be with Windows 7.  The yellow triangle of death appears on connection bars when the problem occurs.  Disconnect and reconnect the Internet solves the problem for another 5 to 15 minutes.

    It seems to me that it is a possible driver with the card built into your new laptop wireless. You can consider using Device Manager to check to see if there are problems reported with the wireless adapter. Also, I suggest that you visit the manufacturer of the laptop and get the latest available wireless drivers for that brand and model.

    You could also have a hunt in the event log and see if there is any additional details that might shed some light as to why the wireless network has decreased. That his fall is one thing, but the log events might suggest a few reasons for this.

  • Removal of several tables with only loop FORALL

    I need to remove the data from several tables with unique FORALL. It seems that FORALL does not support. Please let me know the alternatives to achieve this goal.

    DB version: 11 GR 2

    Write switchis for all instructions, one for each deletion. There is no reason why it should not work.

    Compare:

    PLSQL 101 :

    Here are some things to know about FORALL:

    Each FORALL statement can contain only a single DML statement. If your loop contains two updates and a deletion, then you will need to write three statements FORALL

  • Join several Tables versioned

    Hello

    We are working on a data warehousing project and wonder how do to join several tables that each are versioned separately (type SCD 2 with a valid and valid to date).

    Because for example, we get our client from a single source of information (id customer, name, etc.) and the information on the rate of customer from another source.  The sources are different, we have the separate tables for them and each of them gets versioned independently.

    Here's my customer table (with its own valid and valuable to the columns).

    IDName of the customerValid fromValid until the
    1CitiBank1 JANUARY 14JANUARY 1, 15
    1New CitiBank2 JANUARY 15FEBRUARY 1, 15
    1Latest CitiBank2 FEBRUARY 15APRIL 1, 15

    And similarly the Client side ID and rating information.

    IDNoteValid fromValid until the
    1Platinum1 JANUARY 14FEBRUARY 1, 14
    1PremiumFEBRUARY 1, 141ST MARCH 15

    I want to merge the two tables above and present information at a glance.  I have some difficulty to determine validates the valid columns.

    IDName of the customerNoteValid from (Calculated)Valid until the (calculated)
    1CitiBankPlatinum1 JANUARY 14FEBRUARY 1, 14
    1CitiBankPremiumFEBRUARY 1, 14JANUARY 1, 15
    1New CitiBankPremium2 JANUARY 15FEBRUARY 1, 15
    1Latest CitiBankPremium2 FEBRUARY 151ST MARCH 15

    And it's the query I used to get the above result:

    SELECT client. id ,

           customer . name ,

           CRM . level ,

           Greatest (client. vld_fm , crm. vld_fm ),

           Least (client. vld_to , crm. vld_to )

    DE    client client,

           client_rating crm

      client. id = crm. id

           AND ( client. vld_fm <= crm. vld_fm

                 AND client. vld_fm <= crm. vld_to

                 AND client. vld_fm >= crm. vld_fm

                 AND client. vld_fm >= crm. vld_to )

            OR ( client. vld_fm BETWEEN crm. vld_fm AND crm. vld_to )

            OR ( client. vld_to BETWEEN crm. vld_fm AND crm. vld_to );



    The problem is we have several data sources (and each with its own versions) and joins become so very very complex.  Is there a better way to write the query?

    Or maybe a better way to design our tables?

    Thanks for your help.

    Anand

    Hello

    you only need ranges that overlap to join.

    Re: How do to sql query in a loop

    Is a simpler way to test if the x_start to x_stop range comes into conflict with the range of y_start to y_stop

    WHERE     x_start <= y_stop AND     y_start <= x_stop
    

    In other words, two overlapping if and only if everyone will start before the other ends one. If this is not obvious (and it was certainly not clear to me when I heard it), then look at it this way: two ranges are not overlapping if and only if one of them starts after the end of the other.

    Concerning

    Marcus

  • outer join when there are several tables are involved

    Could not put up the question correctly to the last channel, my problem is with the join when there are several tables are involved, this is just one example of the task that I have to carry.

    Tab1 aura model id retailer_id information for all the weeks (from the first Monday) of the month of JUNE with cost and Helen

    Tab1

    model_id

    retailer_id

    sell_date

    cost

    Helene

    1

    12

    June 3, 13

    100

    40

    1

    12

    June 10, 13

    200

    20

    1

    12

    17 June 13

    300

    20

    1

    12

    24 June 13

    400

    20

    2

    12

    June 3, 13

    300

    10

    2

    12

    June 10, 13

    200

    20

    2

    12

    17 June 13

    300

    20

    2

    12

    24 June 13

    400

    20

    Tab2:

    each retailer belongs to a dealer, under the table has the same information

    retailer_id

    Dealer_id

    12

    100

    13

    100

    14

    101

    15

    101

    16

    101

    Tab 3

    There is a third layer where each dealership is having a garage band

    Dealer_id

    Dealer_group

    100

    1001

    101

    1001

    102

    2001

    103

    2001

    104

    3001

    105

    3001

    Tab4:

    Of this table for each model and dealer discount information for the month of June (every week)

    model_id

    Dealer_group

    discount_date

    discount

    1

    1001

    June 3, 13

    10

    1

    1001

    June 10, 13

    20

    1

    1001

    17 June 13

    10

    1

    1001

    24 June 13

    30

    2

    1001

    June 3, 13

    10

    2

    1001

    June 10, 13

    20

    2

    1001

    17 June 13

    10

    2

    1001

    24 June 13

    30

    3

    2001

    June 3, 13

    10

    3

    2001

    June 10, 13

    20

    3

    2001

    17 June 13

    10

    3

    2001

    24 June 13

    30

    Master_info:

    It's the main table which is the master table for model /retailer information

    Model_id

    retailer_id

    1

    12

    2

    12

    3

    12

    4

    12

    1

    13

    2

    13

    Output

    model_id

    retailer_id

    sell_date

    cost

    Helene

    Final (cost-helene-discount)

    1

    12

    June 3, 13

    100

    40

    50

    1

    12

    June 10, 13

    200

    20

    160

    1

    12

    17 June 13

    300

    20

    270

    1

    12

    24 June 13

    400

    20

    350

    2

    12

    June 3, 13

    300

    10

    280

    2

    12

    June 10, 13

    200

    20

    160

    2

    12

    17 June 13

    300

    20

    270

    2

    12

    24 June 13

    400

    20

    350

    3

    12

    June 3, 13

    0

    0

    0

    3

    12

    June 10, 13

    0

    0

    0

    3

    12

    17 June 13

    0

    0

    0

    3

    12

    24 June 13

    0

    0

    0

    4

    12

    June 3, 13

    0

    0

    0

    4

    12

    June 10, 13

    0

    0

    0

    4

    12

    17 June 13

    0

    0

    0

    4

    12

    24 June 13

    0

    0

    0

    1

    13

    June 3, 13

    0

    0

    0

    1

    13

    June 10, 13

    0

    0

    0

    1

    13

    17 June 13

    0

    0

    0

    1

    13

    24 June 13

    0

    0

    0

    2

    13

    June 3, 13

    0

    0

    0

    2

    13

    June 10, 13

    0

    0

    0

    2

    13

    17 June 13

    0

    0

    0

    1

    13

    24 June 13

    0

    0

    0

    For highted above records (model_id / retailer_id combination) there is no record in tab1 but they have entered in master_info then the recordings should come for all model_id/retailer_id with all the 0 values

    Hello

    Thanks for posting the sample data.

    It is unclear what dates you want to include in the output.  The following query shows how you can generate every Monday in a given range.  If you only want to include the dates that are actually present in tabl1 and/or tab4, you can simplify this a bit.

    WITH date_range AS

    (

    SELECT TRUNC (TO_DATE (' 3 June 2013', 'DD-Mon-YYYY'))

    , 'IW '.

    ) AS first_monday

    , TRUNC (TO_DATE (24 June 2013 ', 'DD-Mon-YYYY') + 6)

    , 'IW '.

    ) AS last_monday

    OF the double

    )

    all_mondays AS

    (

    First_monday SELECT + (7 * (LEVEL - 1)) AS sell_date

    OF date_range

    CONNECT BY LEVEL<= 1="" +="" (="" (last_monday="" -="">

    / 7

    )

    )

    SELECT mi.model_id

    mi.retailer_id

    am.sell_date

    , Cost of NVL (t1.cost, 0) AS

    , NVL (t1.rebat, 0) IN the refund

    , NVL (t1.cost, 0)

    -(NVL (t1.rebat, 0))

    + NVL (t4.discount, 0)

    ) AS final

    E master_info

    CROSS JOIN all_mondays am

    LEFT OUTER JOIN tab1 t1 ON t1.model_id = mi.model_id

    AND t1.retailer_id = mi.retailer_id

    AND t1.sell_date = am.sell_date

    LEFT OUTER JOIN tab2 t2 ON t2.retailer_id = mi.retailer_id

    LEFT OUTER JOIN tab 3 t3 ON t3.dealer_id = t2.dealer_id

    LEFT OUTER JOIN tab4 t4 ON t4.model_id = t1.model_id

    AND t4.dealer_group = t3.dealer_group

    AND t4.discount_date = t1.sell_date

    ORDER BY mi.retailer_id

    mi.model_id

    am.sell_date

    ;

    The results are not exactly what said you you wanted.  I suspect it's because of typos in that you posted.

  • Trigger on a several tables

    IHAVE a requirement like this.but explained in the form of two table emp and Dept.

    I have a table emp table(empno,ename,deptno) and dept (deptno, dname)
    I have a third emp_details (empno, ename, deptno, dname) of table

    I have a procedure that returns the empdetails
    I have a query in th eabove procedure, select * from emp_details; that returns all the details.

    I want to write a trigger of such that,.
    If I insert or update a row in the emp and dept table and then he should get inserted/updated in the table of emp_details also.
    I am able to write triggers ona single table. I can't get the rows inserted or updated when it comes to multiple tables.

    Data:

    create table emp
    (key primary empno number,)
    Ename varchar2 (20).
    DEPTNO number
    )

    create table dept
    (key primary number depno,)
    DNAME varchar2 (20)
    )

    Insert into dept values(10,'hyderabad');
    Insert into dept values(20,'bangalore');

    Insert into emp values(1,'A',10);
    Insert into emp values(2,'B',20);


    CREATE TABLE EMP_DETAILS
    AS
    SELECT E.ENAME, E.EMPNO, E.DEPTNO, D.DNAME
    Of
    EMP E, DEPT. D
    WHERE E.DEPTNO = D.DEPTNO;


    CREATE OR REPLACE PROCEDURE PROC_EMP_DETAILS (P_EMPNO EMP. EMPNO % TYPE OUT, P_ENAME EMP. ENAME OUT TYPE, P_DEPTNO EMP %. DEPTNO % TYPE OUT, P_DNAME MIN. DNAME % OUT TYPE)
    AS
    / * EXAMPLE OF CODE * /.
    BEGIN
    SELECT * FROM EMP_DETAILS;
    END;
    /

    I tried like this

    CREATE OR REPLACE TRIGGER TRIG_EMP_DETAILS
    AFTER INSERT OR UPDATE ON EMP
    FOR EACH LINE
    REFERENCING OLD AS OLD AGAIN AS NEW
    BEGIN
    INSERT INTO EMP_DETAILS VALUES(:NEW.) EMPNO,: NEW. ENAME,: NEW. DEPTNO,?)

    ???? -As a column, we get dept table how to represent that?

    Could you please guide me in this regard?



    Thanks in advance
    KVB

    Trigger on a several tables

    I think that you don't need triggers on several tables: one is enough:

    CREATE OR REPLACE TRIGGER trig_emp_details
      AFTER INSERT OR UPDATE
      ON emp
      FOR EACH ROW
    BEGIN
      INSERT INTO emp_details
        SELECT :new.empno, :new.ename, :new.deptno, dname
          FROM dept
         WHERE deptno = :new.deptno;
    END;
    
  • A block of data, several tables

    In the manual of Concepts 10.2 is the following definition:

    Table directory
    This part of the data block contains information about the table with lines in this block.

    11.2 Concepts manual, the definition has been changed:

    Table directory
    + For a table in a heap, this directory contains metadata about the tables whose lines are stored in this block. Several tables can store lines in the same block. +

    How many tables can store lines within a single block? A block belongs to a point belongs to a segment belongs to an object.

    The only case I could think of where it is true is in a cluster in the table.

    Of http://docs.oracle.com/cd/E14072_01/server.112/e10713/tablecls.htm#i25478

    A cluster of the table is a group of tables that share common columns and store related data in the same blocks. When the tables are grouped, a single data block can contain several tables lines

  • Several Tables of contents, ePub TOC navigation

    Re: http://forums.Adobe.com/message/5608816#5608816

    If create two mor several tables of contents of a book, one that becomes the navigation exported ePub toc?

    The EPUB uses the single name in the Options of the EPUB Export:

  • Mergre in several tables

    Hello! Is it possible to MERGE INTO several tables under certain conditions? It's that if the condition is satisfied the data is intended to a single table, if not the other.

    You can not. Only inserts can be multi-table.

  • ORA-24005: must use DBMS_AQADM. DROP_QUEUE_TABLE to drop queue tables

    When I drop the simple control panel drop I get this error.


    ORA-24005: must use DBMS_AQADM. DROP_QUEUE_TABLE to drop queue tables

    solution

    This error come when you deposit QUEUE_TABLE with normal drop table command.

    To remove the queue table, you should use DBMS_AQADM. DROP_QUEUE_TABLE procedure.

    BEGIN
    DBMS_AQADM. DROP_QUEUE_TABLE ("the queue table name", TRUE);
    END;
    /

  • Performance in the treatment of the based on a game, several tables from target

    Welcome.

    I have question about a treatment based on a game, when mapping have several tables in the target. I noticed that OWB generate SQL code that usually build a query for each table in the target insertion. Suggest that each table has results from different stages of the treatment, so multi table insert cannot be used. Looking for generated code PL/SQL, I feel that each insert query managed independently and so each make analyses of source table and joins on its own.
    To make my question more concrete, I will introduce two simple examples of stream ETL:
    1) start-> (table scan)--> (joins)--> (inserting into the table t1)
    2) start-> (table scan)--> (joins)-> two targets: (insert into table t1)
    -> two targets: (deduplicator)--> (insertion in table t2)
    Admit, that scans and joins are very expensive comparing to insert rows. Thus, it is usually, if oracle performs scans of tables 2 and joined in example 2) and example 2) take twice longer than example 1)?
    Or fact Oracle is so smart that it can cache the result of entering the first query and use it again in the second query?

    Best regards
    Pawel

    Hi Pawel,

    Thus, it is usually, if oracle performs scans of tables 2 and joined in example 2) and example 2) take twice longer than example 1)?

    Yes, you are right

    Or fact Oracle is so smart that it can cache the result of entering the first query and use it again in the second query?

    Nor the database Oracle or OWB don't is not to intermediate capabilities query result caching.
    While the Oracle database feature "result cache queries", but it must match exactly to SQL source and it store only the final query result...

    Kind regards
    Oleg

  • Add several tables on a Page

    Hello

    I am building an application that handles (APEX 4.0) material inventory. I have an entry page that adds data to two or more tables at once. The page has two forms on it pointing to two separate tables. However when I try to run the page, it fails and returns an error:

    ORA-06550: line 1, column 437: PL/SQL: ORA-00904: "ORH_LAST_UPDATE_DATE": invalid identifier ORA-06550: line 1, column 7: PL/SQL: statement ignored
    Error failed to process row in the IDD_ID_DATA table.

    As far as I can see in the application, this column is not in question (I don't even do anything for her and she is nullable). I looked at the application itself as well as some research online but can't find anything useful...


    So my question is this: is it possible to add several tables to a page? If yes how?

    I'm new to APEX so any help would be greatly appreciated!

    UPDATE:

    I received an email from support of APEX team:

    «The answer is simple, it's you will need manually code processes query (and DML) If you want to maintain multiple tables on a page (there is a limit of a table when you use the integrated process).»
    For this I suggest that you remove the process generated by the wizards and create processes of PL/SQL with insert, update, delete statements as needed. "This encoding is not difficult but takes much longer when you can use the integrated process.

    I've been playing with code PL/SQL and the final result is the following:

    Start
    INSERT INTO table1
    VALUES)
    : P2_Item_Field1,.
    (: P2_Item_Field2);
              
    INSERT INTO table2
    VALUES)
    : P2_Item_Field1,.
    (: P2_Item_Field2);
    end;

    I used this code in a PL/SQL custom in the treatment process > section to the Page processing and it seems to work fine now. The only downside to this method is that if the name of a Page element is changed the code will also have to be changed. Except that I had no problem.

  • Creating a combined chronology based on several chronologies in several tables

    Hello
    I need to extract a timeline for a customer based on valid_from and valid_to dates in several tables.
    For example: I have a table named customers with an id, a valid_from a valid_to date and a table named contracts with contrat_name and customer_id and valid_from valid_to:

    CUSTOMERS:
    ID | VALID_FROM | VALID_TO
    1. 01.03.2010 | 01.01.4000

    CONTRACTS:
    CONTRACT_NAME | CUSTOMER_ID | VALID_FROM | VALID_TO
    Contracted | 1. 01.03.2010 | 01.10.2010
    ContractB | 1. 01.10.2010 | 01.01.4000

    The following statement would now give me the correct chronology:
    Select customer cus.id, con.contract_name, greatest(cus.valid_from,con.valid_from) least(cus.valid_to,con.valid_to) valid_to valid_from
    customers cus
    stupid contracts on cus.id = con.customer_id inner join;

    CUSTOMER | CONTRACT | VALID_FROM | VALID_TO
    1. Contracted | 01.03.2010 | 01.10.2010
    1. ContractB | 01.10.2010 | 01.01.4000

    It works, but I get a problem whenever I have a point from the time there is no contract for a client, but I would always like to have these periods in my calendar:

    Suppose the following data and the same select statement:

    CUSTOMERS:
    ID | VALID_FROM | VALID_TO
    1. 01.03.2010 | 01.01.4000

    CONTRACTS:
    CONTRACT_NAME | CUSTOMER_ID | VALID_FROM | VALID_TO
    Contracted | 1. 01.05.2010 | 01.10.2010
    ContractB | 1. 01.12.2010 | 01.03.2011

    What I would now get would be:
    CUSTOMER | CONTRACT | VALID_FROM | VALID_TO
    1. Contracted | 01.05.2010 | 01.10.2010
    1. ContractB | 01.12.2010 | 01.03.2011

    But what I get is the following:
    CUSTOMER | CONTRACT | VALID_FROM | VALID_TO
    1. null | 01.03.2010 | 01.05.2010
    1. Contracted | 01.05.2010 | 01.10.2010
    1. null | 01.10.2010 | 01.12.2010
    1. ContractB | 01.12.2010 | 01.03.2011
    1. null | 01.03.2011 | 01.01.4000

    What I won't is generate a result with contract = null any time, there is no contract because I actually want to join the chronology of several different tables into one and it would be very complicated to assume things based on what data can or can not be found in a specific table.

    Thanks for any help or ideas,
    Kind regards
    Thomas

    Hi, Thomas,.

    Whenever you have a problem, after the sample data in a form that people can use to recreate the problem and test their ideas. CREATE TABLE and INSERT statements are great.
    For example:

    CREATE TABLE     customers
    (     customer_id     NUMBER (6)     PRIMARY KEY
    ,     valid_from     DATE          NOT NULL
    ,     valid_to     DATE          NOT NULL
    );
    
    INSERT INTO customers (customer_id, valid_from, valid_to) VALUES (1, DATE '2010-03-01', DATE '4000-01-01');
    INSERT INTO customers (customer_id, valid_from, valid_to) VALUES (2, DATE '2010-03-01', DATE '4000-01-01');
    
    CREATE TABLE     contracts
    (     contract_name     VARCHAR2 (15)     NOT NULL
    ,     customer_id     NUMBER (6)
    ,     valid_from     DATE          NOT NULL
    ,     valid_to     DATE          NOT NULL
    );
    
    INSERT INTO contracts (contract_name, customer_id, valid_from,        valid_to)
         VALUES            ('Contract 1a', 1,           DATE '2010-03-01', DATE '2010-10-01');
    INSERT INTO contracts (contract_name, customer_id, valid_from,        valid_to)
         VALUES            ('Contract 1b', 1,           DATE '2010-10-01', DATE '4000-01-01');
    
    INSERT INTO contracts (contract_name, customer_id, valid_from,        valid_to)
         VALUES            ('Contract 2a', 2,           DATE '2010-05-01', DATE '2010-10-01');
    INSERT INTO contracts (contract_name, customer_id, valid_from,        valid_to)
         VALUES            ('Contract 2b', 2,           DATE '2010-12-01', DATE '2011-03-01');
    

    If a customer contracts of n, then you might need as much as 2n + lines 1 output for this client:
    (a) 1 row showing the period, not from the date of customers both valid_from 1st contract begins
    (b) n lines indicating the periods under contracts
    (c) n lines indicating the period right after each contract, until the following starts (or valid_to of the client, if there is no next contract)
    However, you will have lines for periods not contacted ((a) or (c)) if their mandate is 0 days.

    This sounds like a job for the UNION. Make a UNION 3 lanes in a subquery to generate (a), (b), and (c), and then put a WHERE clause on the combined, results to filter the lines not length 0.
    In the query subsidiary UNION, (a) can be done with a query GROUP BY, and (c) can be done using the analytical function of LEAD.

    WITH     union_data     AS
    (
         SELECT       ua.customer_id
         ,       NULL               AS contract_name
         ,       MIN (ua.valid_from)     AS valid_from
         ,       MIN (oa.valid_from)     AS valid_to
         FROM       customers     ua
         JOIN       contracts     oa     ON     ua.customer_id     = oa.customer_id
         GROUP BY  ua.customer_id
         --
        UNION ALL
         --
         SELECT       customer_id
         ,       contract_name
         ,       valid_from
         ,       valid_to
         FROM       contracts
         --
        UNION ALL
         --
         SELECT       uc.customer_id
         ,       NULL               AS contract_name
         ,       oc.valid_to          AS valid_from
         ,       LEAD ( oc.valid_from
                     , 1
                     , uc.valid_to
                     ) OVER ( PARTITION BY  uc.customer_id
                        ORDER BY      oc.valid_from
                         )          AS valid_to
         FROM       customers     uc
         JOIN       contracts     oc     ON     uc.customer_id     = oc.customer_id
    )
    SELECT       *
    FROM       union_data
    WHERE       contract_name     IS NOT NULL
    OR       valid_from     < valid_to
    ORDER BY  customer_id
    ,       valid_from
    ;
    

    Output:

    CUSTOMER_ID CONTRACT_NAME   VALID_FROM VALID_TO
    ----------- --------------- ---------- ----------
              1 Contract 1a     01.03.2010 01.10.2010
              1 Contract 1b     01.10.2010 01.01.4000
    
              2                 01.03.2010 01.05.2010
              2 Contract 2a     01.05.2010 01.10.2010
              2                 01.10.2010 01.12.2010
              2 Contract 2b     01.12.2010 01.03.2011
              2                 01.03.2011 01.01.4000
    

    Published by: Frank Kulash, April 20, 2011 06:51
    Examples added

  • ALTER drop partition table for ORA-01031: insufficient privileges

    Hello

    Select * from version of v$.
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE Production 11.2.0.2.0
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production


    I have a table in the schema Y whose partition based on the value should be removed from schema X.

    For example, ALTER TABLE DROP PARTITION Y.TAB_NAME FOR (4853);

    I guess I gave almost all the privileges. Any thoughts?

    Select * from DBA_TAB_PRIVS where table_name = 'Table_name' and recipient = 'X '.

    DEALERSHIP OWNER TABLE_NAME GRANTOR PRIVILEGE HIERARCHY
    ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------------------------- --------- --------------------- --------- ---------------------
    X Y TABLE_NAME Y ALTER YES NO
    X Y TABLE_NAME DELETE YES NO
    X Y TABLE_NAME Y INSERT YES NO
    X Y TABLE_NAME SELECT YES NO
    UPDATE TABLE_NAME Y Y X YES NO
    INDEX OF TABLE_NAME Y Y X YES NO

    6 selected lines
    Additional Prerequisites for Partitioning Operations
    If you are not the owner of the table, then you need the DROP ANY TABLE privilege in order to use the drop_table_partition or truncate_table_partition clause.
    

    reference - http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_3001.htm

    * That said I think seriously to give such a privilege [DROP ANY TABLE] to another schema.*

    I hope this helps!

    Published by: Sri on April 6, 2011 14:12

Maybe you are looking for