Column Datatype Change

Hi,
I created a table with some 10 columns earlier, now one of the column datatype needs to be changed to varchar2(2), which actually in the database it is number.
The thing the table now contains 10 records. Its not allowing me to modify the column datatype, because it has rows in it. How to change the column datatype with data in the table. Pl reply ASAP.
Thanks

See the following example.
Let's modify deptno column from number to varchar2 :
SCOTT@demo102> desc emp2
Name                                      Null?    Type
EMPNO                                              NUMBER(4)
ENAME                                              VARCHAR2(10)
JOB                                                VARCHAR2(9)
MGR                                                NUMBER(4)
HIREDATE                                           DATE
SAL                                                NUMBER(7,2)
COMM                                               NUMBER(7,2)
DEPTNO NUMBER(2)
SCOTT@demo102> select count(*) from emp2;
  COUNT(*)
        14
SCOTT@demo102> alter table emp2 modify deptno varchar2(2);
alter table emp2 modify deptno varchar2(2)
ERROR at line 1:
ORA-01439: column to be modified must be empty to change datatype
SCOTT@demo102> alter table emp2[b] add deptno2 varchar2(2);
Table altered.
SCOTT@demo102> update emp2 set deptno2=deptno;
14 rows updated.
SCOTT@demo102> commit;
Commit complete.
SCOTT@demo102> alter table emp2 drop column deptno
SCOTT@demo102> /
Table altered.
SCOTT@demo102> alter table emp2 rename column deptno2 to deptno
SCOTT@demo102> /
Table altered.
SCOTT@demo102> desc emp2
Name                                      Null?    Type
EMPNO                                              NUMBER(4)
ENAME                                              VARCHAR2(10)
JOB                                                VARCHAR2(9)
MGR                                                NUMBER(4)
HIREDATE                                           DATE
SAL                                                NUMBER(7,2)
COMM                                               NUMBER(7,2)
DEPTNO VARCHAR2(2)
SCOTT@demo102>
Pl reply ASAP.Since this is saturday, and saturday is an unworked day in most of countries, and since this forum is based on volunteers, you cannot ask ASAP...
Nicolas.

Similar Messages

  • OBIEE - changing imported column datatypes

    Hi All,
    I am trying to join 2 tables in physical layer but the columns on which I am making join condition have different datatypes defined(one is datetime,another is timestamp).Hence, I am getting error incompatible datatypes can't be joined.
    I don't want to change the columns datatypes in ohysical layer bcz I am not sure if some other report using this rpd might be using the join conditions based on existing datatypes.Is there any alternative to this?
    Please suggest.
    Thanks,
    Neha

    Please try to use this function. it is good if we have sample data for both columns.Please provide if you have issues using following function
    Evaluate( 'to_date(%1,%2)',Evaluate( 'TO_CHAR(%1)' as char,20090101) , 'yyyymmdd')
    Thanks
    NK

  • How to start a workflow when a value in specific column is changed?

    HI !! 
    I would like that  my workflow will run only if a value on a specific colunm will change.
    is there a way to do it without using a third colunm ?
    thank you !
    nikita.

    Hi,
    According to your post, my understanding is that you wanted to start a workflow when a value in specific column is changed.
    When you create workflow, if you check the “start the workflow automatically when an item is changed”, the workflow will be started automatically once the item is edited.
    In the other word, no matter which column we changed, the the workflow will be started automatically.
    As a workaround, we can add condition or action to make the workflow excute the next step only if the value in specific column is changed.
    There are two options to achieve it.
    Use the “Wait for Field Change in Current Item" action”. If you add the action at the first,  the workflow will excute the next step until the column is chaned to the specific value.
       2. User the “If any value equals to value” condition. If you add the condition at the first, the workflow will excute the next step if the condition is satisfied.
    Thank you for your understanding.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Repositioning viewport of column size change

    I have a JTable with multiple columns and rows. Columns can be resized or moved by dragging the column headers. Whenever a column is resized the table viewport jumps to the top of the table. I am looking for a way to either hold the viewport at the current location (i.e. the location immediately prior to performing the column size change) or to reposition it to that location after the column size change bumps it to the top.
    I have set a TableColumnModelListener to handle the margin change events and the column moved events. In the case of the column moved event (which also bumps the viewport to the top) I can reposition the viewport to the original location with no problem, but the columnMarginChanged event seems to generate a whole flurry of viewport repositioning events, many of which occur after the actual columnMarginChanged event has been processed, thereby overriding any viewport repositioning that I attempt in the event handler.
    I have set a change linstener on the table's viewport to handle repositioning events, but I have no way of determining if the event was triggered by a column resizing operation or by a legitimate scrolling operation.
    Does anyone have any suggestions?

    I'm using 1.4.2_06 on XP and don't experience this problem.
    If you need further help then read this link on [url http://www.physci.org/codes/sscce.jsp]Creating a Simple Demo Program before posting again.

  • Column Datatype modify

    Hi,
    How can i modify a column datatype varchar2(100) into blob in a table.
    Regards,
    Fame

    create table x (y varchar2(100));
    insert into x values ('A');
    commit;
    alter table x rename column y to z;
    alter table x add (y clob);
    update x set y = z;
    commit;
    alter table x drop column z;
    Table dropped.
    Table created.
    1 row created.
    Commit complete.
    Table altered.
    Table altered.
    1 row updated.
    Commit complete.
    Table altered.
    drop table x purge;
    create table x (y varchar2(10));
    insert into x values ('A');
    commit;
    alter table x rename column y to z;
    alter table x add (y blob);
    update x set y = utl_raw.cast_to_raw (z);
    commit;
    select * from x;
    update x set y = (z);
    commit;
    select * from x;
    alter table x drop column z;
    Table dropped.
    Table created.
    1 row created.
    Commit complete.
    Table altered.
    Table altered.
    1 row updated.
    Commit complete.
    Z          Y
    A          A
    1 row selected.
    1 row updated.
    Commit complete.
    Z          Y
    A          
    1 row selected.
    Table altered.

  • How to enable AI(accent insensitiv) for one column without changing session

    Following is my test SQL:
    create table accent_test(col varchar2(10 char);
    insert into accent_test values('INDIA');
    insert into accent_test values('india');
    insert into accent_test values('InDiÄ ');
    Following SQL can only enable CI(Case insensitive), but can’t enable AI(accent insensitive):
    select *
    from accent_test
    where NLS_UPPER(col, 'NLS_SORT=GENERIC_BASELETTER') LIKE NLS_UPPER('INDIA', 'NLS_SORT=GENERIC_BASELETTER')
    COL
    INDIA
    india
    Upper SQL can’t return the third row ‘InDiÄ’ which includes accent character.
    I know following SQL can enable AI by changing the session. However it will change the whole session and other columns in one table:
    SQL> ALTER SESSION SET NLS_COMP=LINGUISTIC;
    SQL> ALTER SESSION SET NLS_SORT=GENERIC_BASELETTER;
    Is there any solution to enable AI for only one column without changing the session?

    convert(<Any Chinese Character>, 'US7ASCII') will all return same character '?'.might be an matter of using the right characterset:
    SQL> select 'ä' str, convert('ä', 'JA16SJIS') converted_str from dual union all
    select 'á', convert('á', 'JA16SJIS') from dual union all
    select 'â', convert('â', 'JA16SJIS') from dual union all
    select 'à',  convert('à', 'JA16SJIS') from dual
    STR CONVERTED_STR
    ä   a           
    á   a           
    â   a           
    à   a           
    4 rows selected.

  • Record column level changes of table for audit.

    Hi Experts,
    I need  suggestion on recording column level changes in table for internal aduit purposes, our company policy does not allow us to enable CDC and CT on database levels so I am looking for whar are other the best ways for doing the same ?
    I know we can use triggers and OUTpUT clause to record the changes on tables but Is there any other light weight solution for recording changes on transactions tables which very gaint tables. 
    Seeking your guidnace on solution side ?
    Shivraj Patil.

    OUTPUT should be the best choice for your case as this would be much lighter than Trigger.

  • Summary column value changing to NULL in RDF

    Hello Everybody.
    For the existing query column in RDF, which is used by one of the summary column as source.
    If the query is getting changed as per the bussiness requirement, the source of the Summary column is changing to NULL.
    Is there any way not to allow this change in RDF. Because lot of query modifications are done.And it consumes lot of time to change every source of the Summary columns being used.
    Appreciate your help.
    Thanks.

    In general this shouldn't happen. Did you define proper ALIAS'es for the column the summaryitems are based on?

  • Explorer InfoSpaces on HANA Views - column label changes cause issues?

    Key question is – do simply label changes in HANA view cause issues with Explorer InfoSpaces?  Furthermore, on source view changes, does the InfoSpace also need to be adjusted?
    What we have observed is this
    1. InfoSpaces have been created using the “SAP HANA appliance” connection highlighted below. The corresponding “Home” screen is shown below that, so there are around 14 or so InfoSpaces that should be available.
    2. Yesterday, there was a production deployment that contained some changes to the underlying views in the form of label changes (not column name changes).
    3. Now, in the “Manage” screen we cannot see these same 14 InfoSpaces available under the expected connection. Instead, they are all available under the “Source Unavailable” node with the default action of “Change Source” shown.
    Additionally, we are seeing some strange behavior where certain facets are actually containing the wrong data. For example, in a facet/column called “Source Type”, where the expected values are “NBP or PBP”, we are seeing Material numbers like “00001112453”. This leads me to believe that there is a mapping issue under the covers.
    Thanks,
    Justin

    Our BOE Explorer is Version: 14.1.1 Build: 1072   - I’m not sure how this corresponds with your 69.01 to 74 numbers (release note numbers?).
    But it sounds identical to your description.
    One of our observations: if we change the sorting on a facet pane using the upper right sort control the values are corrected for a while, at least until we change a measure and the set of facets get updated with the miss-mapped values again.    This only occurs on some models and we haven’t been able to determine what the underlying criteria might be that aggravates the problem. 
    Thanks for your input – it helps us determine a viable path forward.
    Cheers,
    Tony

  • Urgent: Datatype change, cannot refresh business area

    First time I've pulled the Urgent thing but I have a problem. We had a datatype change for an ID field and I cannot refresh the associated business area because it get the following error message after it analyses the differences. There are several areas where this field is referenced, but it is only showing me one. When I try to refresh I get the following:
    "This item is used elsewhere, its datatype cannot be changed".
    The item is used in several joins within this business area. If they are all changed when the business area refreshes, things should work fine. Any thoughts?

    So in the database you changed the datatype for this ID field. This ID field I assume is a foreign key in other database tables. Where those tables updated also to the new datatype?

  • DB column name changes and APEX

    All,
    I found out that the database architect is planning to make changes to several of the column names in all of the tables I use in a large application. So...rather than open every screen, every condition, every procedure, etc. looking for the db fields I need to change, I am hoping I can find a way to do it in sql*plus.
    At a minimum, I hope to be able to create a report for each table/column referenced in the application that will show the pages and places where it is referenced. Any ideas?
    Thanks,
    Steve

    Patrick directed me to the Object Dependencies report - and it would work but you have to click on the "count" to see where it is referenced. I am hoping for a detail report. Patrick also suggested editing an application export to do global column name changes - that will also work. If you have done it differently, let me know.
    Steve

  • Power View Enhancement Request - Allow for columns to drop off PowerView when column name changes in data model instead of rendering the PowerView inaccessible

    Currently in PowerView, if a column name changes in the tabular model, and that column is being used in a PowerView chart, the PowerView will become inaccessible.
    It would be nice if it functioned similar to Pivot Table. If a column name changes for a column that is being used in a Pivot Table, the field is just removed from the chart, and the user can select the newly named column. 

    Hi plantm,
    After testing the issue in my environment, I can reproduce it. After we change a column name which is used in a Power View chart, Power view will render the message that” The external data connection has been disabled for this Power View report. Please enable
    the connection.” when we reopen the file.
    To fix this issue, we can click Refresh button under POWER VIEW menu, then it would prompt us that” Power View was not able to complete the action due to a query failure. This can happen if the structure of your data has changed, in which case closing and
    re-opening the application will resolve the problem.”
    According to the error message, we should try to reopen the file to fix this issue. Power view will render the message that” Please refresh to see the data for this Power View Sheet. You can set properties in the Connection Properties dialog so that the
    data refreshes automatically when you open the file.” when we reopen the file. Then we can refresh it again, the report will be displayed without that field.
    Based on my research, inherently what the message means is that Power View cannot be used as a tool for snapshot reporting. With an Excel PivotTable, we can see the data last saved in the PivotTable. Power View, however, does not behave the same way – it
    won’t render the last saved state. If we want to avoid this message when we reopen the file, there are two methods:
    When we create the Power View report, we can select the checkbox that “Refresh data when opening the file”.
    After it’s been set up, go to Connections on the Data menu, then choose Properties.
    For more details about the settings, we can refer to the following blog:
    http://www.sqlchick.com/entries/2013/3/30/creating-a-power-view-report-in-excel-2013-which-uses-an-ext.html
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Fact columns Datatype is changing from char to int in OBIEE 11g

    Hi ,
    I am taking measure columns - "product description","tot cost" against a dimension "project name" .
    I am generating this report in a planing form and OBIEE .
    in planing form :
    product description tot cost
    project name
    P1 A 1500
    p2 B 1700
    p3 C 1800
    in obiee report :
    product description
    project name
    P1 16 1500
    p2 17 1700
    p3 19 1800
    Somehow , measure's datatype are getting changed from char to number , in OBIEE report.
    By default , the data type for all fact's is Double .I tried changing that to varchar , but result is same .
    Do I need to change anything in physical layer / RPD .
    OBIEE version : 11.1.1.6
    Essbase version : 11.1.2

    Hi ,
    Thanks for your reply . To confirm , the data type of product description column is "double" in essbase .
    I found out ,thers's a RDBMS table , consisting of two columns - ID, text value . where product description's are in text value's with the corresponding ID's(integer values) .
    Now , when I am creating a form in planning , its fetching the text values of product description (there's some inbulit setting's available for this in plannng) .
    However , in obiee its fetching the ID values of product description .
    So ,
    1. Is there any similer setting I can do for OBIEE , so that it's fetches only text value's of product description .
    2. If not , then I have to join the essbase fact table with this RDBMS table . I am not sure how to do it .

  • Changing column datatype value

    Can any body forward me the SQL for changing the datatype value from
    Varchar2(64) to Varchar2(2)
    Arif

    You can do that if the column is empty, or its contents size is not bigger than the new size :
    SQL> create table test_tab(a varchar2(100));
    Table created.
    SQL> alter table test_tab modify a varchar2(50);
    Table altered.
    SQL> insert into test_tab values('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
    1 row created.
    SQL> alter table test_tab modify a varchar2(40);
    Table altered.
    SQL> ed
    Wrote file afiedt.buf
      1* alter table test_tab modify a varchar2(20)
    SQL> /
    alter table test_tab modify a varchar2(20)
    ERROR at line 1:
    ORA-01441: cannot decrease column length because some value is too big
    SQL>

  • Change column datatype from varchar2 to number(10) and keep existing data

    Hi,
    I need to change the datatype on a column that already has data in it from a varchar2 to number(10). The data that is already there is not necessarily number data, however I must be able to keep the old data to. We are running 10g. Does anyone have any ideas? Thanks. Here's the current data.
    Current Values for From_Value
    T
    U
    T2
    K
    M
    A
    T
    T1
    O
    E
    S
    NSTU
    4

    Example of keeping the data in the current column and adding a new numeric column for numeric data:
    SQL> drop table t purge;
    Table dropped.
    SQL> create table t(i int, x varchar2(10));
    Table created.
    SQL> insert into t values(1, 'T1');
    1 row created.
    SQL> insert into t values(2, 2);
    1 row created.
    SQL> --
    SQL> alter table t add (xn number);
    Table altered.
    SQL> --
    SQL> begin
      2  for c in (select i, x from t)
      3  loop
      4   begin
      5   update t set xn = to_number(c.x) where i = c.i;
      6   exception
      7    when invalid_number then null;
      8   end;
      9  end loop;
    10  end;
    11  /
    PL/SQL procedure successfully completed.
    SQL> show errors
    No errors.
    SQL> select * from t;
             I X                  XN
             1 T1
             2 2                   2

Maybe you are looking for

  • Problem Upgrading Logic Studio to 9.1.1 From 9.0.2

    I was on Snow Leopard with Logic Pro with version 9.0.2. I upgraded to Lion (big regrets but that's whole different story) bottom line is that version 9.0.2 no longer runs. I get a pop-up window that says "You Can't Use this Version...".  Not a big o

  • Deductible and non-deductible tax in CIN???

    Hi experts Can anybody explain me about deductible and non-deductible tax  in CIN. Explain me with clear example from purchasing with excise duty point of view . With some example of duty with some amount . Thanks SAP-MM

  • Project name variable

    In Captivate 4, you can set project name by accessing the Edit -> preferences menu. My question is, is there a system variable that tracks the project name? Thanks.

  • Nvidia video card update

    recently my pc crashed lost everything and started over. everything has updated but the Nvidia video card. when it is up dated system says a updated has caused an issue and has to go back to the last restore point. i have never had this problem befor

  • W510 - Two HDDs - Two Windows Setup

    Hi all, I have purchased a hdd caddy from ebay, which works fine and a second SSD (which will arrive this week) for my W510. My intention is to have a second Windows 7 installed on the second drive purely for work purposes, so that the primary HDD wi