How to rename and delete a particular column in a table?

Hello

Suppose I have a table with the following defination:

create table t1
(a number not null,
b varchar2 (20).
c varchar2 (20));

eventually I want to rename the column b to x and the next step I want to remove column c and all of its contents. How to do this?

Hello

To copy the column b: column a

UPDATE  t2
SET     b  = a;

To drop a constraint:

ALTER TABLE  t2
DROP CONSTRAINT  on_b;

Tags: Database

Similar Questions

  • How to set the color for a particular column in the table in advance?

    How can we set the color for a particular column in advance table based on a few feteched of vo in process request query parameter?

    Hello

    Reference http://oraclearea51.com/blog/dynamically-color-the-rows-in-an-oa-framework-advanced-table.html

    and prev thread. Can color us the lines in the column of a table

    It will be useful.

    Kind regards
    GYAN

  • How to find the value max and min for each column in a table 2d?

    How to find the value max and min for each column in a table 2d?

    For example, in the table max/min for the first three columns would be 45/23, 14/10, 80/67.

    Thank you

    Chuck,

    With color on your bars, you should have enough experience to understand this.

    You're a loop in the table already.  Now you just need a function like table Max and min. loop.  And you may need to transpose the table 2D.

  • CHKUPD loads at startup. How to find and delete this file?

    CHKUPD loads at startup. How to find and delete this file?

    CHKUPD loads at startup. How to find and delete this file?

    Not a matter of Microsoft/Windows.

    http://answers.Microsoft.com/en-us/search/search?searchterm=CHKUPD&CurrentScope.ForumName=Windows&CurrentScope.filter=windows_xp-files&askingquestion=false

  • How to add and delete pages in a pdf document?

    How to add and delete pages in a pdf document?

    The easiest way is to use the Page thumbnails Panel.

    But you can also use the Pages pane.

  • How to remove and delete the in computer HP recovery Partition.

    Hello

    How to remove and delete the Partition Recovery on HP computer after I installed win 7 (clean install) befor was Vista?

    Thank you


  • How to create and delete partitions automatically?

    How to create and delete partitions automatically?
    The environment is (10.2.0.3) 10g Oracle on the RHEL4.0 system.
    I want to partition the table of MESSAGES by date (NUMTODSINTERVAL(1,'DAY')). One partition per day. Because the table is huge, only 2 partitions (as of yesterday and today) are required to be available online. All partitions as earlier than the day before will be saved, and then dropped. I want to do the partition to create and delete the work performed automatically. How to do?

    Thank you

    junez wrote:
    Could do in detail?

    Here is an example of a procedure (part of a package) that adds/add a partition to an existing partitioned table schedule:

    procedure AddHourlyPartition( tableName varchar2, hour date, partitionName IN OUT varchar2 ) is
            sqlCreate       varchar2(4000);
            d               date;
    begin
            partitionName := GetHourlyPartitionName( hourly );  -- name of partition to create
    
            if existsPartition( tableName, partitionName ) then
                    -- nothing to do
                    return;
            end if;
    
            d := TRUNC(hour,'hh') + (1/24);                                -- upper date limit of the partition
    
            sqlCreate :=
            'ALTER TABLE '||tableName||'
                    ADD PARTITION '||partitionName||'
                    values less than
                            (TO_DATE('''|| TO_CHAR(d,'yyyy/mm/dd hh24:mi:ss') ||''',''yyyy/mm/dd hh24:mi:ss''))'
            ;
    
            ExecSQL( sqlCreate );
    
    end;
    

    The partition is safer to create partitions according to the experience?

    It is always better to write good packages in PL/SQL. Packages can (and should) use the application programming interfaces (API). Because our partition custom package that allows the management of partition. Or a messageLog package that allows for logging of application messages, errors, and debugging messages. Or a Notification package that allows to be send by email or SMS notifications. Etc.

    Design and software development, we should always approaches a "+ Lego mentality +"-which is to create building blocks ("+ Lego bricks +") which can be used and reused over and over again. Modularization is of crucial importance in software engineering as the result is not only of reusable code, but also the code that is easier to maintain, extend easier and easier to debug.

  • How to remove and delete a downloaded file

    How can I remove and delete a downloaded file. I downloaded a large file a PDF I want to remove

    You open the folder via the context menu of the PDF file?

    That should open the folder where you saved the file in Windows Explorer and there you can delete (delete) the file.

  • How to find and delete all the exact words

    How search and delete all the exact words, I tried adobe 11 Pro and I still need to know how to do this

    No, this feature in Acrobat Pro XI can remove all occurrences of the text you're looking for in a single operation.

  • How to find and delete the dupes in Photos

    How to find and remove the many dupes in Photos

    Duplicate Finder in the App Store will clean the photo library. However, I would be careful to make sure that nothing is really a duplicate.

  • How to access and delete the Photos "iCloud"?

    Here's the problem in detail: I go to 'contacts' app, I go to the photo of a contact, click on it and then I get a box, right?

    -Default Photos

    iCloud - Photos

    -Faces

    -Camera

    OK, under 'Photos iCloud' there are very risky pictures I ever intend to be downloaded in iCloud. It's okay, I say, I'll just open "iCloud" and delete them. Boy, if it were that easy...

    So, I open "finder" and go to "iCloud Drive" on the left. There is nothing contained in iCloud drive. I go to iCloud.com and click on the pictures, it says "Welcome to photos, go into settings to allow iCloud photos." So, I'm a computer major and I don't know where these photos are available on the internet. They are not in my repertoire "iCloud Drive" they are not on 'iCloud.com', but they appear in the contacts under «iCloud Photos»

    What Miss me?

    You have the iCloud as library enabled in your photo library?  If yes then you will need to remove them from your local library in order to remove from the library to iCloud.

  • With CVI SQL Toolkit, how to add the new variable param column in a table.

    Dear all:

    I used the CVI Sql toolkit to create a database, but now I don't know how to add a new column to a table in variable param.

    I know, to add a column with the name of constant column could be down by below:

    DBImmediateSQL ((hdbc, "alter table table1 add column1 char [100]");

    But if Column1 is a param variablae how can I write the code? Please advise?  It will be appreciated if you could give me an example.

    Best regards!

    HI -.

    If you look at the parameters that you pass to the SQL function, you can see that the second parameter is a string constant. In your code, you can create an array of characters (string). You can then use sprintf to programmatically determine what will be the contents of this variable. In the function call, you can put the variable instead of the literal string, and you will have a customizable SQL statement.

    Hope this helps-

    John M

  • How to find a value in any column of the table - essentially a search

    Hi guys,.

    Thanks in advance for your help.

    I'll try to find a value in any column of the table? How can I do?

    An example of value would be "FEDERAL."

    Using Oracle 11 g and SQL Developer.

    Thank you

    It's a question that is asked in the past several times (but not recently from what I remember).

    Michaels has provided in the past, solutions which are quite clever, just using SQL...

    10g of solution

    Michaels > var val varchar2 (5)

    Michaels > exec: val: = "Sub".
    PL/SQL procedure successfully completed.

    Michaels > select distinct substr (: val, 1, 11) "keyword."
    substr (table_name, 1, 14) "table."
    substr (t.column_value.getstringval (), 1, 50) ' / value of the column.
    CLO.
    Table
    (xmlsequence
    (dbms_xmlgen.getxmltype ("select" | column_name))
    || 'from ' | table-name
    || ' where upper (')
    || column_name
    || ') as superior (' %' |: val)
    || '%'')'
    ) .extract (' LINES/rowset / * "")
    )
    ) t
    -where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'SERVICES')
    order of the "Table".

    11g upwards

    SQL > select table_name,.
    column_name,
    : search_string search_string.
    result
    from (select column_name,
    table_name,
    "ora: view("' ||) " table_name | "") / LINE /' | " column_name | "[ora:contains (text ()," %' |: search_string | ")]. (%») > 0]' str
    CLO
    where table_name in ('EMP', 'Department')),
    XMLTable (columns str result varchar2 (10) path '.')
    /

    TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
    ------------------------------ ------------------------------ -------------------------------- ----------
    DEPT                           DNAME                          es                               RESEARCH
    EMP                            ENAME                          es                               JAMES
    EMP                            JOB                            es                               SALESMAN
    EMP                            JOB                            es                               SALESMAN

    4 selected lines.

  • Delete the last column in a table

    Hey there,

    is it possible that a script selects the last column of a table (there are tables with columns 3 and 4 on a page) and deletes it?

    And is it possible that this is happening on a specific layer?

    Greetings

    Hi, ELP,.

    Use the code below:

    //remove column
    var myTable = app.activeDocument.stories.everyItem().tables.everyItem().columns[-1].remove();
    
    //remove column with layer
    var myTable = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    alert(myTable.length)
    
    for(i=0; i
    

    Concerning

    Siraj

  • How to set the value of a column in a table according to another column?

    Hello world!

    I use Apex 4.1.
    My question is how can I set the value of a column in a table according to another column?
    I have a table and when I insert the value in the column content, I want to change this value in the note column with the note, which is generated with pl/sql function (function of string returned if the typed value is in the range).

    I tried to use javascript as
     $('input[name=f02]').live('change', function(){
    if($(this).val()!='1'){
    $('input[name=f03]').val("test")}
    }); 
    for the development of the column note to test if the value typed in the content of the column is not 1, but this code assigns the value to all the lines and I need to set only the specified line.

    Can someone give me a hint in any way to do this if possible?

    Kind regards
    drama9346

    You will need create a process on your page type PLSQL and develop this process "we demand" of the page. In this process, you can run the PLSQL you need. That is to say to retrieve the note value as described in your PC:

    and when I insert the value in the column content, I want to change this value in the note column with the note, which is generated with pl/sql function (function of string returned if the typed value is in the range).

    In this process, you must provide a return value of the call, and you can do this by using htp.p. Example:

    DECLARE
       --putting x01 in a var to simplify
       l_test_var VARCHAR2(200) := apex_application.g_x01;
       l_return VARCHAR2(200);
    BEGIN
       -- a simplistic test
       IF LENGTH(l_test_var) BETWEEN 10 AND 20 THEN
          l_return := 'String is between 10 and 20';
       END IF;
    
       --this will write l_return to the buffer, and the ajax callback will receive this
       htp.p(l_return);
    END;
    

    And the code that I wrote above, which is javascript, would need to go where your current code is that binds to the onchange event. The result should be that, when a change is made to this element, an ajax request is made on the server. When the call is finished, it will be the value returned in the item you want.

Maybe you are looking for

  • Omen of HP: HP keyboard light Isuues Omen

    Hello Recently bought a harbinger of HP, in the first few weeks of use worked fine but recently the backlit keyboard stopped ligting upward, the only lights that work now are the power button and animated speakers all keys, including the macro keys n

  • PCI device driver

    Hello where can I find the PCI driver for my laptop (model HP Pavilion: 15-n044tx) for windows 8?

  • How many counters should I use at the same time?

    I have the cDAQ-9172 and 9411. There is the specification of 9411, 6DI 9411 channels. The NOR-DAQmx help tell Note  Terminal PFI are available when the unit is installed in the location of a chassis OR cDAQ-9172 or Groove 5 6. So, I don't know if thi

  • my yahoo Messenger has frozen completely

    I clicked on a name on my cam friends live messenger list and mailbox is now completely frozen, I run a full scan to see if it will solve the problem.

  • Cards for new SDXC (extended capacity Secure) USB drives

    Hello Just a question for Dr.Lucky or someone who can help. I read the info SDXC to sdcard website but there are a few points I want to be clarified. New SDXC format was launched and are of exFAT file system format, I long as I understand it, you can