Droping tables according to some conditions

I am new to Database side. i want to drop tables which are like 'C$%'.
How should i achieve that ?
What would be query ?

MaheshGx wrote:
Hi I ahve tried your commmand but it is giving following error.
Error report:
ORA-00942: table or view does not exist
ORA-06512: at line 3
00942. 00000 - "table or view does not exist"Then you're doing something wrong. In which case you need to instrument the code to give you step-by-step feedback. For example:
begin
  for t in (select table_name from user_tables where table_name like 'C$%' ) loop
    begin
        dbms_output.put_line( 'Dropping table '||t.table_name );
        execute immediate 'drop table '||t.table_name;
        dbms_output.put_line( 'Table dropped' );
    exception when others then
        dbms_output.put_line( 'Table drop failed with '||SqlErrM(SqlCode) );
    end;
  end loop;
end;If the table names are case sensitive or contains special characters, you need to wrap the table name in double quotes in the drop table statement.
PS. Keep in mind that simply dropping tables like this is VERY unusual. Make sure you are doing the right thing and addressing the problem (which you neglected to mention), correctly. You could be digging a deep and dark hole for yourself by dropping tables, and the wrong ones, like this.

Similar Messages

  • Insert data in same table based on some condition

    Hi. I am new to this forum.
    I have to write a stored procedure to Insert Data into a table say MYTABLE ,having structure as:
    Col1 Col2 Col3 ................ TotalInstallments CurrentInstallment PaidAmount MonthYear
    I have to insert all the data as it is in the same table(MYTABLE) except changing some fields on basis of some conditions:
    1. if PaidAmount>0 && CurrentInstallment<TotalInstallment then
    CurrentInstallment=CurrentInstallment+1
    2. In the MonthYear field I am having data in formate(month/year)ex. 01/2012, 11/2012 ....
    So I have to insert data by incrementing month and year. for example:
    if currentdata is 11/2012 then next data will be 12/2012
    But next will be 01/2013
    I have to select all the records which belongs to previous month(through MonthYear field ) and put checking & changes on each record of the selected data and then insert them into same table(MYTABLE).
    How to achive that?
    Thanks.

    978184 wrote:
    Every thing is working fine but some strange result as:
    when i run my Procedure TRANSFERDATATONEXTMONTH
    1. by Passing Value as : CUSTOMERID_var ='ABX101' and MONTHYEAR_var='12/2012' it insurts 5 rows
    which is correct , since I have 5 records where CUSTOMERID='ABX101' and MONTHYEAR='12/2012' and
    new 5 rows has CUSTOMERID='ABX101' and MONTHYEAR='01/2013' (all other values are as expected)
    2. now when i again run by passing values: CUSTOMERID='ABX101' and MONTHYEAR='01/2013' it inserts 10 records(just double )
    and new records has value CUSTOMERID='ABX101' and MONTHYEAR='02/2013' (while on the basis of condition CUSTOMERID='ABX101' and MONTHYEAR='01/2013' i have in my table only 5 records)
    and all records are duplicate. Some times it inserts three times , while on condition basis it should no. What is happening?Probably, meanwhile you were trying to Insert the First time and the second time, someone did run the procedure that Inserted 5 More records for 01/2013. And, hence your Second run inserted 10 records instead of 5.
    >
    Why it is inserting double of records while i have only 5 records on given condition? Am I missing some thing?Yes, you are. You are missing your Tables, Your Dummy/Sample Data, Working Procedure/Function that can be replicated.
    Without this, we cannot simply believe on assertions that Oracle is behaving incorrectly.
    In addition to this, the GetMonthYear function, should be scrapped. It is un-necessary, when the same logic can be achieved using Oracle ADD_MONTHS function (See my previous post). And you are storing the MonthYear in a Varchar field, which ideally should be a Date field. This eradicates the un-wanted need to cast from VARCHAR - DATE - VARCHAR.
    Please do make some time to read {message:id=9360002} and mentioned relevant details.
    And notice, the code difference in my previous post and in your code.
    Please use
    {noformat}
    (exactly as shown) above and below your code, that indents the code properly for better readability.
    {noformat}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Changing Row backgroundColor according to some condition

    I am using datatable and each row in table should have different color according to a value of one of the property of row.
    Here it is
    <h:dataTable value="#{form.list}" var="item" id="table">
    <h:column>
    <hutputText value="#{item.name}" />
    </h:column>
    <h:column>
    <hutputText value="#{item.status}" />
    </h:column>
    </h:dataTable>
    Each row should be of a color depending on 'status' value of that row.
    Say, if it is pending - it should be red color, if it is approved - it should be green color......
    Any advise is really appreciated.
    Please help me out, Thanks

    Meh. Why spend so much time on a problem when there are easy alternatives.
    <table>
    <tr><th>Name</th><th>Status</th></tr>
    <ui:repeat value="#{form.list}" var="item">
    <tr class="#{form.status}_rowclass"><td>#{item.name}</td><td>#{item.status}</td></tr>
    </ui:repeat>
    </table>

  • Update according to a condition

    how do i update a table according to a condition (i.e. dynamically update).
    I have a table which i need to insert a new record for each customer if they have purchased a specific item before.
    my purchase table has the following columns (id, cust id, purchase id, date).
    how do i insert a new record (sequence id, cust_id, 55, today) for every customer if they have a record in my purchase table with a purchase_id=54?

    how do i update a table according to a ....
    how do i insert a new record Confusing requirement....
    Though from whatever I understand, you want following
    INSERT INTO <TABLE_NAME>
          SELECT sequence id, cust_id, 55, SYSDATE
          FROM purchase_table
          WHERE purchase_id = 54 ;

  • Calling two table controlls based on some conditions......

    I hav a requirement in which i have two table controlls, which i want to call based on some conditions. Like if condition is satisfied the first table controll shud fill up the screen and other wise the secondtable controll shud fill the screen....

    Hello,
    In the main screen where u need to vary with the 2 table controls , create a subscreen area .
    Now create two subscreens with the required table controls respectively.
    You can dynamically call the subscreens accordingly for  the conditions.
    Hope this may help you.
    Neeraj

  • Process message according to a condition

    Gentlemen,
    I created a process, which modifies a table column when a certain button is pressed.
    I want to modify the column in that case only, if the sysdate is later than the "begindate" column of the table. So I modified my process to be conditional.
    It works fine, however I want to notify the user, if the process is not executed because of the condition.
    I'd like to put a message something like: "The event has not started so far".
    I tried to put this message to the Process Error Message region, but it did not work. I think this is not an error, just the condition result was FALSE.
    What is the way to give the above message to the user, according to the condition ?
    Thanks, Attila v

    i'd probably do this: i'd use similar logic from your Condition to set some hidden item in your app that serves as a flag. set that flag up to get set just before your update process. next, i'd make your update process run based on a condition that checks the flag (so you don't have to check your table values twice). lastly, i'd have the next page of your app conditionally display a region with your "The event has not started so far" message if your flag item indicates as much.
    hope this helps,
    raj
    ps-if your update process is regular pl/sql, there's even more flexibility wrt how you set your flag and display your message. you could set your success/didnt_process message to an item within that process, for example, and refer to the item in your process success message using the &ITEM_NAME. syntax.

  • How to find total recs in a local table for a particular condition

    Hi,
    How to find total recs in a local table for a particular condition?
    Thanks,
    CD

    Well, you may want to try this as well, and compare to the LOOP way.  Not sure what kind of overhead you may get doing this way. Here ITAB is our main internal table, and ITAB_TMP is a copy of it.  Again I think there may be some overhead in doing the copy.  Next, delete out all records which are the reverse of your condition.  Then whatever is left is the rows that you want to count.  Then simply do a LINES operator on the internal table, passing the number of lines to LV_COUNT.
    data: itab type table of ttab.
    data: itab_tmp type table of ttab.
    itab_tmp[] = itab[].
    delete table itab_tmp where fld1 <> 'A'.
    lv_count = lines( itab_tmp ).
    Regards,
    Rich Heilman

  • Adobe Form - Hide a table row if a condition met

    Hi Helper
    I am learning how to use Adobe Form - and I am trying to hide a table row if a condition is met by using Formcalc/Jave script - but I donot know how - I was told that I can use "....presence = 'hide'  " property in on of the event(?) but donot know how to write the qualified name for the varable row and what event to use. Could someone please show me how
    Points will be rewarded.
    Thanks

    Hi Liem,
    Here is some more information:
    1)
    Accessing data in Table Cell
    xfa.resolveNode("xfa.data.my_data.tableData[" + this.parent.index  + "].column1").value
    2)  Accessing data nodes in Context
    xfa.datasets.data.my_data.second_node.an_attribute.value == "3"
    I think you will find the WebLog below very useful for your requirements.
    /people/juergen.hauser2/blog/2007/09/03/accessing-data-nodes-in-sap-interactive-forms
    -regards,
    harman

  • How to disable a bean (messageChoice) in a Table region on  a condition?

    Within a Table based region, I have a requirement to disable MessageChoiceBean (Expense Type) based a specific value of expense type.
    This is in iExpense (CreditCardLines page) module. When the user clicks next btn and navigates to CreditCardLines page, BusinessCreditCardLinesVO gets executed. I can loop thru this VO and can check the specific value of Expense Type but I do not know how to get handle of that bean for a given row in VO and disable that particular expense type bean.
    Hope this is clear. Can you please help?
    Thanks,

    Hi,
    When the page is standard, you need to substitute the VO BusinessCreditCardLinesVO, and add a new attribute which will return true or false (according to your condition)
    and assign that to disabled property of the item (like ${oa.XXTTermsAndConditionsPVO1.Accept}).
    Thanks.
    With Regards,
    Kali.
    OSSI.

  • Some Condition types missing during extraction from 2LIS_11_VAKON

    Hi,
    I am extracting conditions data to BI from ECC through 2LIS_11_VAKON. This datasource uses the fields from table KOMV. The Field KSCHL (Condition type) is also being taken from KOMV structure.
    My problem is some condition types are missing during extraction. Say, for example, for a Document condition i have 22 Condition types in KONV table but when i extract the data to BI, nearly 7 conditions are missing, i am getting only 15 condition types for the same document condition in BI.
    Why is this happening? I dont have any filters set. Moreover, this is happening in the Datasource level itself.
    Please advice. Any help on this is highly appreciated.
    Regards,
    Murali

    Hi Murali,
    try to have the manual check with set of data..there must be some mistaken in And and OR logic.
    Thanks,
    Deepak

  • How to reject external table rows with some blank columns

    How to reject external table rows with some blank columns
    I have an external table and I would like to reject rows when a number of fields are empty. Here are the details.
    CREATE TABLE EXTTAB (
    ID NUMBER(10),
    TSTAMP DATE,
    C1 NUMBER(5,0),
    C2 DATE,
    C3 FLOAT(126)
    ORGANIZATION EXTERNAL (
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY EXT_DAT_DIR
    ACCESS PARAMETERS (
    RECORDS DELIMITED BY NEWLINE
    LOAD WHEN (NOT (c1 = BLANKS AND c2 = BLANKS AND c3 = BLANKS))
    LOGFILE EXT_LOG_DIR:'exttab.log'
    BADFILE EXT_BAD_DIR:'exttab.bad'
    DISCARDFILE EXT_BAD_DIR:'exttab.dsc'
    FIELDS TERMINATED BY "|"
    LRTRIM
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL
    FIELDS (
    ID,
    TSTAMP DATE 'YYYYMMDDHH24MISS',
    C1,
    C2 DATE 'YYYYMMDDHH24MISS',
    C3
    ) LOCATION ('dummy.dat')
    REJECT LIMIT UNLIMITED
    So, as you can see from the LOAD WHEN clause, I'd like to reject rows when C1, C2 and C3 are empty.
    The above statement works fine and creates the table. However when I am trying to load data using it, the following error is produced:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "not": expecting one of: "double-quoted-string, identifier, (, number, single-quoted-string"
    KUP-01007: at line 1 column 41
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    It seems that external tables driver does not understand the "NOT (...)" condition. Could anyone suggest how I can achieve what I want in a different way?
    Thank you.
    Denis

    Another method would be to simply remove the "LOAD WHEN condition" and create a view on the external table which filters the data.
    CREATE EXTTAB_VIEW AS
    SELECT * FROM EXTTAB
    WHERE not (c1 is null and c2 is null and c3 is null);

  • How to Concatenate Table name and Where condition at runtime

    I am passing parameter as User and Zone to Stored Procedure.How to concatenate Table Name
    and WHERE CONDITION in SQL Statement.i have different type of users and zones.

    Hi !
    declare
      cur sys_refcursor;
      r emp%rowtype;
      v_sql varchar2(512);
    begin
    -- do your logic here
      v_sql := 'select * from emp';
      open cur for v_sql;
      loop
        fetch cur into r;
        exit when cur%notfound;
        dbms_output.put_line(r.ename);
      end loop;
      close cur;
    end;In this example you can see how can be done this with cursor vars .. You should concatenate v_sql string according to your requirements.
    But as in further posts has already been mentioned , be carefull at publishing such kind of procedures and think on security.
    Also when you want dynamicaly change from clause , you should consider using different records to accept data ? Maybe all your tables has the same structure and then this problem will be smaller.
    T
    T

  • Grey out a particular row in ALV based on some condition.

    Hi All,
    How can we grey out the particular row in ALV based on some condition( I am using the function modules and not OOPS).
    Regards
    Ramesh.

    Hello Ramesh
    In this case you need to add a specific field to your structure:
    TYPES: BEGIN OF ty_s_outtab.
    INLCUDE TYPE <my table or structure>.
    TYPES: CELLTAB   TYPE lvc_t_styl.  " name is arbitrary but this one is most frequently used
    TYPES: END OF ty_s_outtab.
    DATA: gt_outtab  TYPE STANDARD TABLE OF ty_s_outtab
                                 WITH DEFAULT KEY.
    You can use the fieldcatalog to make an entire column non-editable (LVC_S_FCAT-EDIT = ' ' ).
    However, in case of rows you need to inactivate all cells of this row. For sample coding please refer to thread:
    How to conditionally set ALV field as hotspot
    Regards
      Uwe

  • How to disable view buttons on some condition-webdynpro abap

    Hi ALL,
    i have a two buttons in my view ......initially one button must be enable,depending on some condition i want to disable one button on the same view .........in which i am displaying my alv data ........(in the same view).

    check the properties with property name Visible.
    Take one attribute with name as visibile and Type ( WDUI_VISIBILITY-Data Type for "visible" Properties)
    then bind this attribute with property visible.
    then in run time according to the condition pass value '01'-for no visibility and '02' for visible.
    Hope this helps you.
    Regards,
    sarath

  • TABLE for storing the condition type maintained in a RFQ

    Dear All ,
    I am maintaining some condition types ( both at header & item level ) while creating a RFQ .
    I want to know in which table can I find the condition types which I maintained for that particular RFQ.
    I have tried searching EKKO with the following parameter
    Purchasing Document No = RFQ No.
    Statu  = 'A'
    and tried to retrieve the valuein KNUMV field , so that i can pass the value of KNUMV to table KONV and retireve the condition .
    But KNUMV for document type 'A' ( RFQ ) is coming as blank for all the records.
    Requesting help on this .

    Hi,
    Condition types are stored in KONP table. You can try linking tables  EKKO / EKPO with KONP with required fields to get the data stored.
    Regards
    Ram

Maybe you are looking for