Drop table to specific account.

Hello All,
I am using 11.2.0.3.0 on linux box. I have a requirement to given drop tables privilege to specific account. for example , I need to give ability to user c to drop tables from user A and user B schema. I know, "drop any table" would do the trick. but , is there anyway around? I mean, by creating trigger or some other methods.
thanks a lot for all the help in advance.

937853 wrote:
Hello All,
I am using 11.2.0.3.0 on linux box. I have a requirement to given drop tables privilege to specific account. for example , I need to give ability to user c to drop tables from user A and user B schema. I know, "drop any table" would do the trick. but , is there anyway around? I mean, by creating trigger or some other methods.
thanks a lot for all the help in advance.I am not sure that you can give users to drop tables in other schemas . Only the creator has the privilege of teh drop table and the other option is drop any table . So you may want to tell us that why you want to do this?
Aman....

Similar Messages

  • DROP TABLE works through SSMS but not via T-SQL Query

    Hello All,
    I am trying to drop a number of tables (1,000+) in a particular database by scripting the actions in T-SQL. When I run the query I get error 3701 on every table which points to a permissions issue. However, I am able to delete tables one by one using
    the tree-view in the SSMS Object Explorer. 
    1. I have tried starting query sessions with both the DBO of the database and the SA account to no avail. (Both had the sysadmin role when I tried.)
    2. Both the DBO account and the SA account are able to drop tables using SSMS Object Explorer.
    Do I need a specific GRANT of permissions to use T-SQL versus SSMS or am I missing something even more fundamental?
    TIA, Simon
    <code>
    DECLARE @Company VARCHAR(max), 
    @ID VARCHAR(max), 
    @NAME VARCHAR(max), 
    @TABLE_CATALOG VARCHAR(max),
    @NAV_DATABASE VARCHAR(max),
    @TABLE_NAME VARCHAR(max), 
    @STATEMENT VARCHAR(max),
    @OBJECT_NAME VARCHAR(max),
    @OBJECT_NAME_BARE VARCHAR(max),
    @OBJECT_TYPE VARCHAR(max);
    SET @TABLE_CATALOG = 'NAV_PENTA_TEST_GAAP';
    SET @NAV_DATABASE = @TABLE_CATALOG
    IF @TABLE_CATALOG <> DB_NAME() 
    BEGIN
    DECLARE @ERRORMSG VARCHAR(max);
    SET @ERRORMSG =  'You are not in the correct database. You specified ' + @TABLE_CATALOG + ' but you are currently in a session for ' + db_name();
    RAISERROR(@ERRORMSG, 18, 1);
    RETURN;
    END;
    -- To hold the object names (tables) from Navision
    CREATE TABLE #NavisionObjects
    [CompanyName]
    VARCHAR(max),
    [ID] VARCHAR(max),
    [Name]
    VARCHAR(max),
    [TABLE_NAME]
    VARCHAR(max)
    -- To hold the object names (tables) from SQL only
    CREATE TABLE #NavisionSQLObjects
    [TABLE_NAME]
    VARCHAR(max)
    -- Holds the list of dependent objects
    CREATE TABLE #DependentObjects
    [name] VARCHAR(max),
    [type] VARCHAR(max)   
    WITH T AS (
    SELECT [Company Name],[ID],[Name],[Company Name]+'$'+[Name] AS TABLE_NAME 
    FROM [Object]   
    WHERE [Name] like '%IT IS%' AND [Company Name]>''
    UNION ALL
    SELECT [Company Name],[ID],[Name],[Name] AS TABLE_NAME 
    FROM [Object]   
    WHERE [Name] like '%IT IS%' AND [Company Name] IN ('',' ')
    INSERT INTO #NavisionObjects SELECT [Company Name],[ID],[Name],[TABLE_NAME] FROM T;
    UPDATE #NavisionObjects SET TABLE_NAME = TABLE_NAME+ID WHERE ID LIKE '1%';
    INSERT INTO #NavisionSQLObjects 
    SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES 
    WHERE TABLE_CATALOG = @TABLE_CATALOG AND TABLE_NAME LIKE '%IT IS%' AND TABLE_TYPE='BASE TABLE';
    --SELECT * FROM #NavisionObjects where CompanyName like 'E15%' order by TABLE_NAME;
    --SELECT * FROM #NavisionSQLObjects where TABLE_NAME like 'E15%' order by TABLE_NAME;
    DECLARE cTables CURSOR FOR SELECT A.CompanyName,A.ID,A.[TABLE_NAME] FROM #NavisionObjects A
    INNER JOIN #NavisionObjects B ON B.[TABLE_NAME]=A.[TABLE_NAME]
    OPEN cTables;
    FETCH NEXT FROM cTables INTO @Company,@ID,@TABLE_NAME;
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
    PRINT 'Storing dependencies for [' + @TABLE_NAME + ']';
    BEGIN TRY
    INSERT INTO #DependentObjects 
    EXEC sp_depends @TABLE_NAME;
    END TRY
    BEGIN CATCH
    PRINT 'Could not get dependencies for table [' + @TABLE_NAME + ']';
    END CATCH
    FETCH NEXT FROM cTables INTO @Company,@ID,@TABLE_NAME;
    END
    CLOSE cTables;
    Drop dependent objects first so that table drops are less likely to fail. 
    DECLARE cdo CURSOR FOR SELECT [Name],[Type] FROM #DependentObjects;
    OPEN cdo;
    FETCH NEXT FROM cdo INTO @OBJECT_NAME, @OBJECT_TYPE;
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
    BEGIN TRY
    SET @OBJECT_NAME_BARE = 
    CASE 
    WHEN CHARINDEX('dbo',@OBJECT_NAME) = 1
    THEN RIGHT(@OBJECT_NAME,LEN(@OBJECT_NAME)-4)
    ELSE @OBJECT_NAME
    END;
    SET @STATEMENT = 'DROP ' + @OBJECT_TYPE + ' [' + @OBJECT_NAME_BARE + ']';
    PRINT @STATEMENT;
    EXEC sys.sp_sqlexec @STATEMENT;
    END TRY
    BEGIN CATCH
    PRINT 'Could not DROP object [' + @OBJECT_NAME + '] of type ' + @OBJECT_TYPE + ', SQL Error ' + CAST(@@ERROR AS VARCHAR(max));
    END CATCH
    FETCH NEXT FROM cdo INTO @OBJECT_NAME, @OBJECT_TYPE;
    END
    CLOSE cdo;
    DEALLOCATE cdo;
    OPEN cTables;
    FETCH NEXT FROM cTables INTO @Company,@ID,@TABLE_NAME;
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
    PRINT 'Removing [' + @TABLE_NAME + ']' ;
    BEGIN TRY
    SET @STATEMENT = 'TRUNCATE TABLE dbo.[' + @TABLE_NAME + ']';
    PRINT @STATEMENT;
    EXEC sys.sp_sqlexec @STATEMENT;
    END TRY
    BEGIN CATCH
    PRINT 'Could not truncate table [' + @TABLE_NAME + ']';
    END CATCH
    BEGIN TRY
    SET @STATEMENT = 'DROP TABLE dbo.[' + @TABLE_NAME + ']';
    PRINT @STATEMENT;
    EXEC sys.sp_sqlexec @STATEMENT;
    BEGIN TRY
    SET @STATEMENT = 'DELETE FROM [Object] WHERE [Company Name] = ' + CHAR(39) + @Company + CHAR(39) + ' AND [ID] = ' + CHAR(39) + @ID + CHAR(39) + ' AND [TABLE_NAME] = ' + CHAR(39) +
    @TABLE_NAME + CHAR(39) ;
    EXEC sys.sp_sqlexec @STATEMENT;
    print @STATEMENT;
    END TRY
    BEGIN CATCH
    PRINT 'Could not Delete Object [' + @TABLE_NAME + '], from Object table, SQL Error ' + CAST(@@ERROR AS VARCHAR(max));
    END CATCH
    END TRY
    BEGIN CATCH
    PRINT 'Could not DROP table [' + @TABLE_NAME + '], SQL Error ' + CAST(@@ERROR AS VARCHAR(max));
    END CATCH
    FETCH NEXT FROM cTables INTO @Company,@ID,@TABLE_NAME;
    END
    CLOSE cTables;
    DEALLOCATE cTables;
    DROP TABLE #DependentObjects;
    DROP TABLE #NavisionObjects;
    DROP Table #NavisionSQLObjects;
    </code>

    3701 = ...does not exist or you don't have permission.
    Most of the time it means the former. So there are probably some problems in your DROP TABLE statements. Since there is a whole lot about Navision in the script, I decline from trying to figure out what. But I encourage you to study the PRINT statements.
    I think that it would be a good idea to include the schema name, in cases these tables are not in dbo after all.
    Note: rather than writing:
       SET @STATEMENT = 'DROP ' + @OBJECT_TYPE + ' [' + @OBJECT_NAME_BARE + ']';
    write:
       SET @STATEMENT = 'DROP ' + @OBJECT_TYPE + quotename(@OBJECT_NAME_BARE)
    Somewhat briefer. And it works also when the object name includes a right bracket.
    sp_sqlexec is undocumented, use sp_executesql instead.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Drop Table, User, Drop * ORA-00604: error occurred at recursive SQL level 1

    Greetingss,
    Installed 11.2.0.1 several months ago and upgraded to 11.2.0.2 a month ago without issues. However prior to upgrade I was able to drop schema objects. Since upgrade I do not recall specifically dropping any objects. However, now trying to drop a few objects and discovered all drops attempted are failing, i.e. tables, packages, users, function, views, directories, etc. Create or Replace and Alter all appear to still work.
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE     11.2.0.2.0     Production
    TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    5 rows selected.
    SQL> connect sys as sysdba
    Connected.
    SQL> create user drop_test identified by drop_test account unlock;
    User created.
    SQL> alter user drop_test default tablespace users;
    User altered.
    SQL> grant connect, resource, dba to drop_test;
    Grant succeeded.
    SQL> connect drop_test/drop_test
    Connected.
    SQL> create table a (a number);
    Table created.
    SQL> create view av as select * from a;
    View created.
    SQL> create function ac return number as
    2 result number;
    3 begin
    4 select count (*) into result from a;
    5 return result;
    6 end;
    7 /
    Function created.
    SQL> insert into a values (1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select ac from dual;
    AC
    1
    1 row selected.
    SQL> select * from av;
    Enter
    A
    1
    1 row selected.
    SQL> drop function ac;
    drop function ac
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06550: line 3, column 83:
    PLS-00302: component 'DBMS_XDBZ' must be declared
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> drop view av;
    drop view av
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06550: line 3, column 83:
    PLS-00302: component 'DBMS_XDBZ' must be declared
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> drop table a;
    drop table a
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06550: line 3, column 83:
    PLS-00302: component 'DBMS_XDBZ' must be declared
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> connect sys as sysdba
    Connected.
    SQL> drop function drop_test.ac;
    drop function drop_test.ac
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06550: line 3, column 83:
    PLS-00302: component 'DBMS_XDBZ' must be declared
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> drop view drop_test.av;
    drop view drop_test.av
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06550: line 3, column 83:
    PLS-00302: component 'DBMS_XDBZ' must be declared
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> drop table drop_test.a;
    drop table drop_test.a
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06550: line 3, column 83:
    PLS-00302: component 'DBMS_XDBZ' must be declared
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> drop user drop_test;
    drop user drop_test
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06550: line 3, column 83:
    PLS-00302: component 'DBMS_XDBZ' must be declared
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> drop user drop_test cascade;
    drop user drop_test cascade
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06550: line 3, column 83:
    PLS-00302: component 'DBMS_XDBZ' must be declared
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> get /x92
    1 select owner, object_name, object_type, status
    2 from dba_objects
    3* where object_name = 'DBMS_XDBZ'
    SQL> /
    OWNER OBJECT_NAME OBJECT_TYPE STATUS
    PUBLIC DBMS_XDBZ SYNONYM VALID
    XDB DBMS_XDBZ PACKAGE VALID
    XDB DBMS_XDBZ PACKAGE BODY VALID
    3 rows selected.
    SQL> @invalid
    no rows selected
    SQL> l
    1 select
    2 owner c1,
    3 object_type c3,
    4 object_name c2
    5 from
    6 dba_objects
    7 where
    8 status != 'VALID'
    9 order by
    10 owner,
    11 object_type
    12*
    Advanced appreciation for any assistence provided.
    best Regards

    Greetings,
    Yes I do use XDB and Application Express. I can also create and delete resources in XDB repository without issue.
    SQL> select schema_url from dba_xml_schemas;
    Enter
    SCHEMA_URL
    http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/dav.xsd
    http://xmlns.oracle.com/xdb/XDBResConfig.xsd
    http://xmlns.oracle.com/xdb/XDBStandard.xsd
    http://xmlns.oracle.com/xdb/log/xdblog.xsd
    http://xmlns.oracle.com/xdb/log/ftplog.xsd
    http://xmlns.oracle.com/xdb/log/httplog.xsd
    http://www.w3.org/2001/xml.xsd
    http://xmlns.oracle.com/xdb/xmltr.xsd
    http://xmlns.oracle.com/xdb/XDBFolderListing.xsd
    http://www.w3.org/1999/xlink.xsd
    http://www.w3.org/1999/csx.xlink.xsd
    http://www.w3.org/2001/XInclude.xsd
    http://www.w3.org/2001/csx.XInclude.xsd
    http://xmlns.oracle.com/xdb/stats.xsd
    http://xmlns.oracle.com/xs/roleset.xsd
    http://xmlns.oracle.com/xs/securityclass.xsd
    http://xmlns.oracle.com/rlmgr/rclsprop.xsd
    http://xmlns.oracle.com/rlmgr/rulecond.xsd
    http://xmlns.oracle.com/ord/meta/dicomImage
    http://xmlns.oracle.com/xdb/xdbconfig.xsd
    http://xmlns.oracle.com/streams/schemas/lcr/streamslcr.xsd
    http://xmlns.oracle.com/xs/dataSecurity.xsd
    http://xmlns.oracle.com/xs/aclids.xsd
    http://xmlns.oracle.com/xs/principal.xsd
    http://xmlns.oracle.com/xdb/XDBSchema.xsd
    http://xmlns.oracle.com/xdb/XDBResource.xsd
    http://www.w3.org/2001/csx.xml.xsd
    http://xmlns.oracle.com/xdb/csx.xmltr.xsd
    http://xmlns.oracle.com/ord/dicom/datatype_1_0
    http://xmlns.oracle.com/ord/dicom/orddicom_1_0
    http://xmlns.oracle.com/ord/dicom/mddatatype_1_0
    http://xmlns.oracle.com/ord/meta/iptc
    http://xmlns.oracle.com/ord/dicom/standardDictionary_1_0
    http://xmlns.oracle.com/ord/meta/xmp
    http://xmlns.oracle.com/ord/dicom/anonymity_1_0
    http://xmlns.oracle.com/ord/dicom/constraint_1_0
    http://xmlns.oracle.com/ord/dicom/metadata_1_0
    http://xmlns.oracle.com/ord/dicom/mapping_1_0
    http://xmlns.oracle.com/ord/dicom/preference_1_0
    http://xmlns.oracle.com/ord/dicom/privateDictionary_1_0
    http://xmlns.oracle.com/ord/meta/exif
    http://xmlns.oracle.com/ord/dicom/rpdatatype_1_0
    http://xmlns.oracle.com/ord/meta/ordimage
    http://www.opengis.net/gml/geometry.xsd
    http://www.opengis.net/gml/feature.xsd
    demo_customer_t.xsd
    http://xmlns.oracle.com/spatial/georaster/georaster.xsd
    http://localhost:8080/source/schemas/poSource/xsd/purchaseOrder.xsd
    http://xmlns.oracle.com/ord/dicom/UIDdefinition_1_0
    http://xmlns.oracle.com/ord/dicom/attributeTag_1_0
    http://xmlns.oracle.com/ord/dicom/manifest_1_0
    http://www.w3.org/1999/xlink/xlinks.xsd
    53 rows selected.
    SQL>
    I will have to review the notes provided via the links. I hope that there is a solution available that is in alternative to re-installing XDB.
    Best Regards
    Edited by: RealDitto on Aug 24, 2011 10:40 AM

  • Dropping tables in Oracle 10g Express

    I have several schemas created in my oracle express db. And I have created 1 user, 'met' that has privs to do anything in any schema.
    If user met drops a table in the acct schema, it does not go in the acct recyclebin like I would think. It is renamed BIN$...... and left in the acct schema.
    If acct drops a table in the acct schema, then it shows up in the acct recyclebin as the same name it had in the schema.
    We have 40+ schemas, and I don't want to login as each individual user to manage there tables, I want one account to manage them all, but do not want to leave alot of BIN$..... tables in the schema when I drop a table.
    I know I can purge them, and remove them for good, but If I want to drop a table, and have a backup for a while, I want it to be in the recyclebin.
    Anyway to fix this, or is this just how it work?

    You may want to use the purge command:
    PURGE recyclebin;
    Or disable the recycle bin parameter, which will diables the flashback feature and won't allow you to recover any mistakenly dropped table:
    RECYCLE_BIN=FALSE;
    Regards.

  • Drop table for multiple tables

    Hi All,
    I want to drop multiple tables in one drop statement.
    Can it be possible?
    Thanks in advance!!
    SA

    Hi,
    CASCADE CONSTRAINTS must be taken into account. E.g.,
    set pages 0
    spool c:\windows\temp\drop.sql
    select 'DROP TABLE '||TABLE_NAME || ' CASCADE CONSTRAINTS;' from user_tables WHERE table_name like 'ZTEST%';
    spool off
    @c:\windows\temp\drop.sqlHere is a test case:
    SQL> set echo off
    SQL> create table ztest1 (ff NUMBER PRIMARY KEY);
    Table created
    SQL> insert into ztest1 select 1 from dual;
    1 row inserted
    SQL> create table ztest2 (gg NUMBER, constraint gg_fk foreign key (gg) references ztest1(ff));
    Table created
    SQL> insert into ztest2 select 1 from dual;
    1 row inserted
    SQL> drop table ztest1;
    drop table ztest1
    ORA-02449: unique/primary keys in table referenced by foreign keys
    SQL>
    SQL> set pages 0
    SQL> spool c:\windows\temp\drop.sql
    Started spooling to c:\windows\temp\drop.sql
    SQL> select 'DROP TABLE '||TABLE_NAME || ' CASCADE CONSTRAINTS;' from user_tables WHERE table_name like 'ZTEST%';
    DROP TABLE ZTEST1 CASCADE CONSTRAINTS;
    DROP TABLE ZTEST2 CASCADE CONSTRAINTS;
    SQL> spool off
    Stopped spooling to c:\windows\temp\drop.sql
    SQL> @c:\windows\temp\drop.sql
    SQL> DROP TABLE ZTEST1 CASCADE CONSTRAINTS;
    Table dropped
    SQL> DROP TABLE ZTEST2 CASCADE CONSTRAINTS;
    Table dropped
    SQL>

  • Drop Tables from Excel

    This is my code that I want to excecute using ORAOLEDB driver in Excel. It executes fine from Rapid/SQL but it will not run in Excel and I am not finding any docuemntation on much of anything to do with oraOLEDB.
    Declare
    PROCEDURE DropTable (tbl IN VARCHAR2) AS
    in_Exists int;
    BEGIN
    select count(*) into in_Exists from all_tables where UPPER(table_name) = upper(tbl);
    IF in_exists > 0 THEN
    EXECUTE IMMEDIATE ('DROP TABLE ' || upper(tbl) || ' CASCADE CONSTRAINTS PURGE');
    COMMIT;
    END IF;
    END;
    BEGIN
    DropTable('tmpEMP');
    DropTable('NOMSEmplExtract');
    DropTable('NOMSEmplRegionDX');
    DropTable('NOMSEmplRegionSubG');
    DropTable('NOMSEmplState');
    END;

    877648 wrote:
    My goal for all this is.
    To run a main set of quiries to get the data formated the way I want, then for serveral worksheets I will do quries off the main query to get the specific data. So using Temp tables may not always be the way I need to go.
    The error when running the Main query is this (I think this may be because it does not return data, but not sure).
    "The Query did not run, or the database table could not be opened.
    Check the database server or contract your database administrator. Make sure the external database is available and hasn't been moved or reorganized, then try the operation again."Well, that's not much information to go on. :-/
    a) Running queries off a main query is tantamount to a query loop and sounds like it'll be slow. If you really can't do it all in a single query then fair enough, but always aim to incorporate everything in a 1 hit query if you can so that all the work is done in the SQL engine, which is the best place for processing data.
    b) The fact the "query did not run", I'm guessing is referring to you calling that procedure you've shown us? (If not show us what it is doing at the time). If that procedure is not running you need to determine why not, so perhaps add some debug messages (log them to a table or something with an autonomous transaction procedure) and see how far it gets. It could be something as simple as needing explicitly granted permissions on those tables rather than relying on role based grants. It could also be to do with dependencies, because dropping tables at run time can render other things "invalid", which is why Oracle provides Global Temporary Tables so you don't have to create and drop tables at run time.

  • Unable to drop table

    Hello,
    I'm currently tring to drop a table using a process trigered by a button click
    Icreated my button and also a "PL/SQL process" and I put
    DROP TABLE &P0_TABLE_NAME. CASCADE CONSTRAINTS;
    inside field "source" with ticking the checkbox "Do not validate PL/SQL code (parse PL/SQL code at runtime only)."
    But when a click on the button I have the following error
    ORA-06550: line 1, column 7: PLS-00103: Encountered the symbol "DROP" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe
         Error      Error while dropping table
    OK      
    Do anyone have a clue about this ?
    Debug trace is
    A C C E P T: Request="Purge"
    0.00: Metadata: Fetch application definition and shortcuts
    0.00: alter session set nls_language="AMERICAN"
    0.00: alter session set nls_territory="AMERICA"
    0.00: ...NLS: Set Decimal separator="."
    0.00: ...NLS: Set NLS Group separator=","
    0.00: ...NLS: Set date format="DD-MON-RR"
    0.00: ...Setting session time_zone to +02:00
    0.00: NLS: wwv_flow.g_flow_language_derived_from=0: wwv_flow.g_browser_language=en-us
    0.00: Fetch session state from database
    0.01: ...Check session 2289784661666743 owner
    0.01: ...Check for session expiration:
    0.01: ...Metadata: Fetch Page, Computation, Process, and Branch
    0.01: Session: Fetch session header information
    0.01: ...Metadata: Fetch page attributes for application 121, page 2
    0.01: ...Validate item page affinity.
    0.03: ...Validate hidden_protected items.
    0.03: ...Check authorization security schemes
    0.03: Session State: Save form items and p_arg_values
    0.03: ...Session State: Save "P0_TABLE_NAME" - saving same value: "STATPHI_595730051"
    0.04: ...Session State: Save "P2_TABLE_NAME" - saving same value: "STATPHI_595730051"
    0.04: ...Session State: Save "P2_TYPE" - saving same value: "2"
    0.04: ...Session State: Save "P2_CALENDAR" - saving same value: "PA"
    0.04: ...Session State: Save "P2_FILE_NAME" - saving same value: ""
    0.04: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.04: Branch point: BEFORE_COMPUTATION
    0.04: Computation point: AFTER_SUBMIT
    0.04: Tabs: Perform Branching for Tab Requests
    0.04: Branch point: BEFORE_VALIDATION
    0.04: Perform validations:
    0.04: Branch point: BEFORE_PROCESSING
    0.04: Processing point: AFTER_SUBMIT
    0.04: Item button "P2_PURGE_TABLE" pressed process.
    0.04: ...Process "DROP TABLE": PLSQL (AFTER_SUBMIT) DROP TABLE &P0_TABLE_NAME. CASCADE CONSTRAINTS;
    0.06: Encountered unhandled exception in process type PLSQL
    0.06: Show ERROR page...
    0.06: Performing rollback...
    ----

    Hi user631592 ;-)
    You can't used directly a DDL statment.
    But you can use an EXECUTE IMMEDIATE in your process.
    SO
    BEGIN
    EXECUTE IMMEDIATE ' DROP TABLE STATPHI_595730051';
    END;
    Regards

  • Drop table if exists in sql statement

    Oracle: 10G
    Is there a way to check if table exist and then only drop table. Something like:
    drop table (select table_name from user_tables where lower(table_name) = 'o2i_filing_dest')

    As already suggested, you could e.g. use an anonymous PL/SQL block as part of your SQL script, e.g. something like that:
    set echo on
    spool <your_log_file>
    WHENEVER SQLERROR EXIT FAILURE
    DECLARE
      PROCEDURE EXEC_DONT_FAIL( P_CMD IN VARCHAR2 ) IS
        e_table_or_view_does_not_exist exception;
        pragma exception_init(e_table_or_view_does_not_exist, -942);
        e_type_does_not_exist exception;
        pragma exception_init(e_type_does_not_exist, -4043);
        e_sequence_does_not_exist exception;
        pragma exception_init(e_sequence_does_not_exist, -2289);
      BEGIN
        EXECUTE IMMEDIATE P_CMD;
      EXCEPTION
      WHEN e_table_or_view_does_not_exist OR e_type_does_not_exist OR e_sequence_does_not_exist THEN
          NULL;
      END;
    BEGIN
      EXEC_DONT_FAIL('drop type <type_name1> force');
      EXEC_DONT_FAIL('drop view <view_name1>');
      EXEC_DONT_FAIL('drop table <table_name1> purge');
      EXEC_DONT_FAIL('drop sequence <seq_name1>');
    END;
    CREATE TABLE ...Note that the literals in angle brackets are just placeholders for demonstration purposes, you need to use your actual object names/file names there.
    Of course you could also use a FOR ... LOOP in the PL/SQL block that queries e.g. USER_OBJECTS to find out which objects to drop.
    That way it is ensured that only expected exceptions will be ignored but all others will raise and stop your script in that case.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/
    Edited by: Randolf Geist on Sep 25, 2008 10:09 AM
    Clarification regarding angle brackets added

  • ORA-00604 error occured at recursive level1,ORA-20123 Insufficient privileges: you cannot drop table cls_lrn_tab_unique TABLE,ORA-06512

    Dear All,
         I created one table like
    create table cls_lrn_tab_unique (F_no number unique UK_F_NO );
    after performing some operations I want to delete the same.
    At that time i got following error. Please help me and tell what is the reason for the error.
    ORA-00604 error occured at recursive level1
    ORA-20123 Insufficient privileges: you cannot drop table cls_lrn_tab_unique TABLE,
    ORA-06512 at line no 2
    Thanks and Regards
    Prasad

    26bffcad-f9a2-4dcf-afa0-e1e33d0281bf wrote:
    Dear All,
         I created one table like
    create table cls_lrn_tab_unique (F_no number unique UK_F_NO );
    after performing some operations I want to delete the same.
    At that time i got following error. Please help me and tell what is the reason for the error.
    ORA-00604 error occured at recursive level1
    ORA-20123 Insufficient privileges: you cannot drop table cls_lrn_tab_unique TABLE,
    ORA-06512 at line no 2
    Thanks and Regards
    Prasad
    ORA-20123 is a localized/customized error code & message; therefore any solution depends upon what is unique inside your DB now.
    I suspect that some sort of TRIGGER exists, which throws posted error, but this is just idle speculation on my part.
    How do I ask a question on the forums?
    https://forums.oracle.com/message/9362002#9362002

  • How to recover the data from a  dropped table in production/archive mode

    How to recover the data/change on a table that was dropped by accident.
    The database is on archive mode.

    Oracle Version. ? If 10g.
    Try this Way
    SQL> create table taj as select * from all_objects where rownum <= 100;
    Table created.
    SQL> drop table taj ;
    Table dropped.
    SQL> show recyclebin
    ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
    TAJ              BIN$b3MmS7kYS9ClMvKm0bu8Vw==$0 TABLE        2006-09-10:16:02:58
    SQL> flashback table taj to before drop;
    Flashback complete.
    SQL> show recyclebin;
    SQL> desc taj;
    Name                                      Null?    Type
    OWNER                                              VARCHAR2(30)
    OBJECT_NAME                                        VARCHAR2(30)
    SUBOBJECT_NAME                                     VARCHAR2(30)
    OBJECT_ID                                          NUMBER
    DATA_OBJECT_ID                                     NUMBER
    OBJECT_TYPE                                        VARCHAR2(19)
    CREATED                                            DATE
    LAST_DDL_TIME                                      DATE
    TIMESTAMP                                          VARCHAR2(19)
    STATUS                                             VARCHAR2(7)
    TEMPORARY                                          VARCHAR2(1)
    GENERATED                                          VARCHAR2(1)
    SECONDARY                                          VARCHAR2(1)
    SQL>M.S.Taj

  • Can database activities of creating or dropping tables/packages be tracked in the security/system logs

    Can database activity like create or drop tables and packages be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?
    Can purging of oracle log, n case the file has become big or even tempered be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?

    2765539 wrote:
    Can database activity like create or drop tables and packages be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?
    Can purging of oracle log, n case the file has become big or even tempered be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?
    Your first question is easy, you configure audit to log to the OS audit trail with
    alter system set audit_trail=os scope=spfile;
    and then enable audit for whatever actions you want to capture. All documented in the Security Guide.
    Your second question makes no sense unless you explain what you mean by "oracle log".

  • Drop table

    I created a table with tablename USER using an access to oracle converter. now I am unable to drop the table, it says invalid table name.

    These are keyword and NOT at all recommended as table name. You can find those types of words by querying
    SELECT * FROM v$reserved_words ORDER BY 1 and avoid use of these words as object name.
    However. Now you can enclose the name with a double quote to overcome the situation.
    DROP TABLE "USER"

  • Cannot drop table

    Versions are Oracle 11.2.0.1.0 and SQL Developer 4.0.0.12 on Windows 7 Ultimate SP1.
    Hi
    I'm following the CBT Nuggets SQL Fundementals training (video #11) and cannot drop a table I have just created.  The command executed and error are:
    drop table newprods;
    Error starting at line : 1 in command -
    drop table newprods
    Error report -
    SQL Error: ORA-00604: error occurred at recursive SQL level 1
    ORA-20000: Cannot drop object
    ORA-06512: at line 2
    00604. 00000 -  "error occurred at recursive SQL level %s"
    *Cause:    An error occurred while processing a recursive SQL statement
               (a statement applying to internal dictionary tables).
    *Action:   If the situation described in the next error on the stack
               can be corrected, do so; otherwise contact Oracle Support.
    As the HR user I created two tables and created a FK constraint between them.  After truncating the table with this FK, I am unable to drop it.  Even if I remove the FK, the error is the same.  Issing the command in SQL*Plus gives the same error.
    This is the first time I have created any tables since installing Oracle on this machine and is my first attempt at dropping a table.  I have not created any sequences, triggers or views based on these newly created tables.
    Does anyone have any ideas?
    Cheers

    C:\Oracle>sqlplus hr@orcl
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 4 18:58:55 2013
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> CREATE TABLE table1 (column1 VARCHAR2(20 BYTE));
    Table created.
    SQL> select * from table1;
    no rows selected
    SQL> drop table table1;
    drop table table1
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-20000: Cannot drop object
    ORA-06512: at line 2
    SQL>
    Can I run a query to see if there are any triggeres on the table?
    EDIT: Ok it looks like no triggers:
    SQL> show user
    USER is "SYS"
    SQL> select * from DBA_TRIGGERS where table_name like '%table1%';
    no rows selected
    SQL> select * from USER_TRIGGERS where table_name like '%table1%';
    no rows selected

  • Error when trying drop table

    Why ?
    SQL> drop table SYSADM.TMP_FATOR cascade constraints;
    drop table SYSADM.TMP_FATOR cascade constraints
    ORA-00054: resource busy and acquire with NOWAIT specified

    check the active sessions and kill them all except for the one you are logged into ...and then try drop the table
    --Chaitanya                                                                                                                                                                                                                                                               

  • How to restore a dropped table when recycle bin is purged??

    how to restore a dropped table when recycle bin is purged??

    You should be asking general database questions in General Questions - and not in the Objects forum.
    Restoring a dropped table means restoring a logical or physical backup of that table.

Maybe you are looking for

  • Itouch device not recognized by itunes

    My Ipod touch does is not recognized by itunes under devices.  Please help.  I have tried the steps by resetting the itouch but does not work.

  • Audio Mixer Won't Slide

    We are currently editing a project that has lots of sound fx. When I open the audio mixer I can only adjust the level slider on 3 of my tracks. All of the other tracks say -inf, and they won't move. Even if I enter a number in the box it stays at 0.

  • Duplex Printing Solved for Unsupported HP990C Printer Driver in OS10.6

    I couldn't find this posted concisely anywhere so I thought I would pass it along. I have an HP990Cse which was one of the unsupported printer drivers in OS10.6 (the Gutenprint driver was provided which only supports basic print functions and did no

  • Selection of records in TABLE CONTROL.

    hello friends, this is venkat. I have been using a table contrlo to display the contents of a custom table. my table control can display 10 records in one shot and my custom table had more than that. vertical scroll bar has been working properly so i

  • Lightroom 4.2 isn't passing file to Elements 11 for editing

    I've got LR 4.2 and PSElements 11, both showing Camera Raw 7.2. I've successfully set Elements 11 as my external editor within LR4.2. The problem is that when I try to initiate an PSElements 11-based external Edit session to a file from within LR4.2,