Truncate multible tables

how to truncate multiple tables in ssis at once
thx regards dinesh vv

Hello,
I'm sorry, but the above suggestion doesn't work in SSIS 2012, I tried the following to no avail...
TRUNCATE TABLE STG_EMPLOYEE ;
GO 
TRUNCATE TABLE STG_STRAIN ;
GO 
Error message: 
[Execute SQL Task] Error: Executing the query "TRUNCATE TABLE STG_EMPLOYEE ;
" failed with the following error: "ORA-00911: invalid character". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
(Mind you the statement should be TRUNCATE
TABLE table1; and not TRUNCATE table1; as specified in the answer above)
Regards,
Bart

Similar Messages

  • Truncating a table from inside an application

    Hi all,
    Got a new problem to tackle. I am creating an application to calculate a very complex production bonus based on alot of different variables...
    I am working through retrieving all the data and created an apex temp table called site_bonus. I dump all the retireved values I get from Oracle for attendance, SIT data on discipline etc into the temp table as a count of number of occureneces to start the calculation of the bonus factors - here's the gotcha.....
    Prior to dumping the new run data into the temp table I want to truncate the table to remove anyprevious run data so that I dont get duplicate records cuased by a previous run. I created an on demand application process that basically does the following:
    truncate table "SITE_BONUS" /
    ( I basically copied it right from SQL workshop inside apex,by retrieving the SQL fromthe table truncate process where it works....
    When I run it anywhere inside my page as an on demand process It fails with the following error:
    ORA-06550: line 1, column 16: PLS-00103: Encountered the symbol "TABLE" when expecting one of the following: := . ( @ % ; The symbol ":= was inserted before "TABLE" to continue.
    Error
    OK
    I have tried it as a plsql process, an on demand process....and I get teh same error from any page inside my app and I cant figure out why I can do this from SQL worksop but cant call it from a page within my app.....
    Any ideas?
    Edited by: DSULLIVAN on Oct 28, 2009 3:13 PM - I corrected the typo

    You are trying : trucate
    trucate table "SITE_BONUS" /It should be : tuncate
    truncate table SITE_BONUSHope this helps,
    Sam
    +Please reward good answers by marking them correct or helpful!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Can I give access to truncate one table only ?

    Hi,
    We have system where it is deleting one table and inserting records using pro-cobol in a table owned by another schema. It means user b is inserting records in a's table i.e. t. Can I give access to truncate only a.t ? delete any table or drop any table will give access to b to truncate any table in 'a'. I do not want this. How can I achive this ?
    thanks & regards
    PJP

    As Justin already said there is no separate right to simple GRANT TRUNCATE ON TABLE to user.
    From the docs: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10006.htm#sthref9966
    To truncate a table or cluster, the table or cluster must be in your schema or you must have DROP ANY TABLE system privilege.
    So the best way would be to encapsulate this login in a packaged procedure as described by Justin.

  • Help with truncating a table using plsql procedure in different schema

    I have a plsql procedure in schema A that truncates a table that is given in as parameter.
    create or replace procedure truncate_table(schema, table_name)
    EXECUTE IMMEDIATE 'TRUNCATE TABLE '||schema||'.'||table_name;
    end;
    The above procedure has public execute grant.
    I need to truncate a table in schema B. I have a plsql procedure in schema B that calls the truncate_table procedure and passes in the schema B table name.
    Since the table is in schema B, should the delete grant on the table be given to user A or user B to truncate the table in schema B?
    Thanks in advance.

    Procedure created in schema A
    create or replace
    procedure truncate_table(l_schema varchar2, table_name varchar2) authid current_user
    as
    begin
    EXECUTE IMMEDIATE 'TRUNCATE TABLE '||l_schema||'.'||table_name;
    end;from schema B
    grant delete on table1 to Schema_A
    from schema A
    exec truncate_table('Schema_B','Table1');
    Hope this helps.
    Alvinder

  • Space is not released after truncating the table

    Team,
    We have a table of size 550gigs in size and we truncated the table , truncated sucessfully but space is not released in os level, what action we can take to release the space and this table has only one row and contains the binary data.
    Thanks
    PGR

    Team,
    We have a table of size 550gigs in size and we truncated the table , truncated sucessfully but space is not released in os level, what action we can take to release the space and this table has only one row and contains the binary data.
    Thanks
    PGR
    Hello,
    Yes space wont be released immediately .If large extents are in picture which I assume is your case it goes into deferred drop a background process which will execute after some time( time may vary).See below link for details.
    As per BOL if extents are more than 128 it goes in deferred drop.
    http://msdn.microsoft.com/en-us/library/ms177495.aspx
    You should wait for some time .keep checking the free space
    Below discussion will surely help you in understanding.See Jonathan's reply
    http://social.msdn.microsoft.com/Forums/en-US/4aa2537e-246b-4bfe-818d-3482531d9149/sql-server-2005-massive-400gb-table-dropped-space-not-released
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How to TRUNCATE a table dynamically in a Stored Procedure?

    Hi everyone, How can I create a Procedure with dynamic sql to truncate a table name I pass by every time in Oracle? I am running the following query and nothing happens. It neither creates the procedure nor errors out.
    CREATE OR REPLACE PROCEDURE TruncateTable(TableName IN VARCHAR2(50))
    IS
    BEGIN
    SQLCmd VARCHAR(200);
    BEGIN
    SQLCmd := 'TRUNCATE TABLE ' || TableName;
    EXECUTE IMMEDIATE SQLCmd;
    END;
    Could someone please help me?
    Thanks

    Thanks Brendan for the reply. But, it neither does anything after I add a "/" on line9. Just wondering if the syntax of the proc is correct?

  • Privilege for truncating a table of other schema

    Hi friends
    I need to truncate a table of other schema. What privilege the other user has to give to carry out it.
    Thanks
    Edited by: user12892846 on 01-abr-2010 15:59

    DROP ANY TABLEWhile technically correct, above is somewhat dangerous because every schema could be impacted; even SYS.
    Assume SCHEMA_A owns TABLE_A & procedure below.
    CREATE & REPLACE PROCEDURE TRUNCATE_TABLE_A
    AS
    BEGIN
    EXECUTE IMMEDIATE 'TRUNCATE TABLE TABLE_A';
    END TRUNCATE_TABLE_A;
    GRANT EXECUTE ON TRUNCATE_TABLE_A TO SCHEMA_B;
    By doing as above SCHEMA_A can control who & which table(s) can be impacted (in is own schema only).
    Edited by: sb92075 on Apr 1, 2010 7:06 PM

  • Problem in enabling constraint - after disabling and truncation of table .

    Hello Friends,
    I have a table called DRR_TABLES that has list of table names . The requirement is to truncate the tables present in DRR_TABLES except KEY_IDS table and table_name like '%TYPE%' table.
    written a procedure . successfullly truncating the tables from DRR_TABLES but while enabling constraints after truncation , I am getting problem in enabling constraints .
    ERROR at line 1:
    ORA-02270: no matching unique or primary key for this column-list
    ORA-06512: at "schema123.TRUNCATE_DRR_TABLES ", line 49
    ORA-06512: at line 1
    Heres is the code .
    PROCEDURE TRUNCATE_DRR_TABLES is
    x varchar2(200);
    v_tablecount number := 0;
    cursor c is select TABLE_NAME from DRR_TABLES where population_source='PUBLISHING' and TABLE_NAME != 'KEY_IDS' and TABLE_NAME NOT LIKE '%TYPE%';
    BEGIN
    DBMS_OUTPUT.PUT_LINE (' TRUNCATING DRR TABLES ...........');
    OPEN c ;
    LOOP
    FETCH c INTO x ;
    EXIT WHEN c%NOTFOUND;
    for c1 in (select table_name, constraint_name from user_constraints where TABLE_NAME = x and status ='ENABLED' ORDER BY CONSTRAINT_TYPE DESC )
    loop
    begin
    execute immediate ('alter table '||c1.table_name||' disable constraint '||c1.constraint_name|| ' cascade');
    NULL;
    end;
    end loop;
    EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || x ;
    v_tablecount := v_tablecount + 1 ;
    DBMS_OUTPUT.PUT_LINE('TABLE TRUNCATED :'|| x );
    END LOOP ;
    DBMS_OUTPUT.PUT_LINE (' TOTAL TABLES TRUNCATED ' || v_tablecount );
    CLOSE c;
    OPEN c ;
    LOOP
    FETCH c INTO x ;
    EXIT WHEN c%NOTFOUND;
    for c2 in (select table_name, constraint_name from user_constraints where TABLE_NAME = x and status = 'DISABLED' ORDER BY CONSTRAINT_TYPE)
    loop
    begin
    execute immediate ('alter table '||c2.table_name||' enable constraint '||c2.constraint_name);
    NULL;
    end;
    end loop;
    END LOOP ;
    CLOSE c ;
    END TRUNCATE_DRR_TABLES ;
    LINE 49 is the line corresponding to enable constraint statement.
    Edited by: kumar73 on 3 Sep, 2012 11:44 PM

    It is such a pity that a user having 321 posts till date is unaware of basics of Posting a Question.
    1. You need to provide us with your Oracle version
    select * from v$version;2. You need to understand and get accustomed to using tags before and after Code or SQL's for better readability.
    3. You need to provide us with the Table Structure and the Constraints Definition.
    There are many things that looks like Bad Coding practices:
    <font face="Times New Roman" size=2>
    1. Avoid RBAR (Loops).
    2. Implement Bulk Collect.
    3. Why do you need to disable the constraints before truncating? Are you kind of handling the Referential Integrity Constraints?
    4. Duplicate checking of Disabled Constraints.
    5. When the procedure is being executed at Production Environment, are you going to Monitor the DBMS_OUTPUT? Why not Log the Statements into a LOG Table?
    6. Why use a TableCount variable? Would the TableCount Variable be not equal to the Number of Records returned by Cursor C?
    7. What is the need to use a NULL statement after every Execute Immediate?
    8. What is the Need to surround each execute Immediate with Begin .. End block?
    9. Where is your Exception handling Block? Forgot to write?
    </font>
    What has been your effort in finding which Constraint/Table is causing you the trouble?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • RSECLOG - how do i delete/truncate this table???

    Hello BW people,
    we turned on auth analysis 6 or 7 months ago and now we have a 260 gb table and i am trying to delete the logs manually thru RSECPROT but it is taking forever to delete one log (approx 30 mins).
    is there either a program in sap or a manual way of deleteing or truncating this table?
    any help would be very much appreciated.

    Thanks Jorge,
    this has worked perfectly.
    I thought there might be a sap program to do this, but this worked.
    thx,
    Erik

  • How to truncate fact tables using wb_truncate_table

    Hi,
    I've got a sequence of mappings that load various staging tables, dimensions and fact tables.
    At present, I truncate the fact tables manually before loading the dimensions (to avoid foreigh key errors), but would like to write mappings to do the truncations.
    I tried creating mappings using wb_truncate_table in a Pre-Mapping Process operator (using a constant for the filename), but can't figure out how to get this to actually truncate the fact table.
    The manual says to "connect the output attribute of the Pre-Mapping Process operator to the input group of a target operator." However the PMP operator in my mapping doesn't have an output operator (and the add button is greyed out).
    Sorry if I'm missing something obvious, but can anybody help, or advise on a better way to truncate my fact tables before reloading the dimensions?
    Thanks in advance.
    Chris

    got that to work using WB_TRUNCATE_TABLE in a PMP in the first mapping to >populate one of the fact table's dimensions. The problem I was having was in >trying to create a mapping just to do the truncate, but I see now that's not the >way to go.If you want to create a mapping that just truncate some table(s) - it's very easy.
    1. Just create your own function that returns, let's say, char. Inside this function, call WB_TRUNCATE_TABLE and return dummy char (e.g. '1'). Then create some dummy table with only one colum of char type.
    2. Create mapping. place constant operator, your function as transformation operator, and dummy table. Link them CONSTANT - TRANSFORMATION - TABLE.
    That's all. If you want to truncate more tables within one mapping, just add more FUNCTIONS and add more attributes (table names) to the constant operator.

  • How to truncate  schema1 table from schema 2 -URGENT

    Hi all
    Please tell me is there any grant like that
    regards

    IS this
    grant drop any table to schema 2
    only way PapinRTFM: http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_107a.htm
    Prerequisites
    To truncate a table or cluster, the table or cluster must be in your schema or you must have DROP ANY TABLE system privilege. :)

  • Truncate all tables in schema

    Hi,
    I want to truncate all tables (300 tables) in a schema. There are some enabled constraints in this schema. I want to keep all tables attached objects (like indexes, constraints, etc). I’d like to create a procedure to do this job. What's the safe and right way for this?
    I am thinking as follows:
    1- Retrieve all user constraints name using user_constrants view and then disable them.
    2- Retrieve all user tables name using user_tables view and then Truncate them.
    3- Enable all constraints that were disabled in step 1.
    Is this a safe and right way?
    Let me know your thought please. Thanks.

    The table was probably created using double qoutes.
    declare
    v_new_tab_name varchar2(35);
    for c1 in (select table_name from user_tables) loop
       begin
           execute immediate ( 'truncate table '||C1.Table_Name );
       exception
          when others then
              v_new_tab_name := '"' || C1.Table_Name|| '"' ;
              execute immediate (' truncate table '||v_new_tab_name) ;
       end ;
    end loop;
    end;

  • Un-truncate a table

    Hi all, i have truncated a table. How can i recover it back? i searched through the forum and i found posts stating that no rollback is possible after a truncate is issued.
    Is there any way to get back my rows? i have not written anything into the table after i truncated it.

    Your only options are the standard recovery ones: Flashback or restore. If you don't have a backup strategy in place your data is lost. The good news is, you won't do this again.
    To find out more about backup and recovery read the documentation.
    Cheers, APC

  • Truncate DEF$ tables

    Hi,
    What is the impact if I remove / Truncate below tables as this tables are consuming log of space.
    Will the replication process work fine after truncating/ dropping the below tables.
    system.DEF$_CALLDEST;
    system.DEF$_DEFAULTDEST;
    system.DEF$_ERROR;
    system.DEF$_ORIGIN;
    system.REPCAT$_REPSCHEMA;
    system.DEF$_DESTINATION;
    system.DEF$_LOB;
    system.DEF$_TEMP$LOB;
    system.DEF$_PUSHED_TRANSACTIONS;
    system.DEF$_AQCALL;
    system.DEF$_AQERROR;
    Regards,
    Atif Iqbal.

    Do you not have the PURGE job scheduled to run ?
    You should not be manually truncating these tables.
    Hemant K Chitale

  • TRUNCATE multaple Tables???

    Hi,
    Is there any way to truncate multiple tables at the same time.
    i.e. i need to truncate the tables which names begin with 'AS'...
    Thanks...

    Hi,
    It is not possible with SQL.
    But you can do it from PL/SQL.
    BEGIN
      FOR TBL_LIST IN ( SELECT table_name FROM USER_TABLES WHERE table_name LIKE 'AS%')
    LOOP
    EXECUTE IMMEDIATE 'DROP TABLE '||tbl_list.table_name;
    END LOOP;
    END;** NOT TESTED **
    Regards,

Maybe you are looking for

  • ABAP Proxy authorization issue when sending message.

    Hi We have an interface which uses ABAP proxies. This is used to send a message with attachment, but when i send the message I am getting a 401 error message which says unauthorized. I checked all the configs on the sending side and i cant fine anyth

  • Camera Raw Support for Canon 7D MkII

    Just trying to get some idea if I should spend the $99.00 to buy Aperture from the Apple Store.  This might sound a little over the top, but the work flow I miss by not having RAW support in Lightroom is worth the expense of buying Aperture. I do fin

  • ...mobileme photo gallery transfer

    is there a w ay to transfer pix on the web gallery of mobileme back to my imac & iphoto i thought i had them on the iphone and when i synced with a new computer there were gone from the phone. i also thought they were backed up on an external, but no

  • Create Recovery Media Windows 8 without USB drive

    Hi, I recently bought a T530 with Windows 8 pre-installed. I want to create recovery disc(s). However, in the "Create a recovery media" wizard, I don't have the option of selecting DVDs if tick the option "Copy the recovery partition to the media". I

  • Internal server error,out of memory

    hi, we are using oracle 10g application server for our application. we have 20 different modules deployed on the server. for some time it was worked fine.we set all the perameters and fine tuned the server also.now we are getting the problem out of m