How to create a table from an existing table with new column

Hi !
Please help me.
I want to create a table from an existing table with data and add two new column to the new table.
What will be the syntax?

craete table new_table as select a.*, 'somevalue' new_col1, 'somevalue'
new_col2 from old_table a;Also there is a pitfall - newly created table will accept column type and precision from the select statement, so further you can be needed to modify columns
if you want to have VARCHAR2 instead of CHAR for example:
SQL> create table new_dept as select dept.*, 'New data' new_col from dept;
Table created.
SQL> desc new_dept
Name                                      Null?    Type
DEPTNO                                             NUMBER(2)
DNAME                                              VARCHAR2(14)
LOC                                                VARCHAR2(13)
NEW_COL                                            CHAR(8)
SQL> alter table new_dept modify (new_col varchar2(8));
Table altered.
SQL> desc new_dept
Name                                      Null?    Type
DEPTNO                                             NUMBER(2)
DNAME                                              VARCHAR2(14)
LOC                                                VARCHAR2(13)
NEW_COL                                            VARCHAR2(8)Rgds.
Didn't see michael's post - it reflects the fix for this problem using CAST.
Message was edited by:
dnikiforov

Similar Messages

  • How to create a Group from an existing email -

    I just want to create a Group from an existing email received.  Don't want to add people individually to Address Book, then drag them to the Group.  Would prefer to copy/paste the addresses into the Group.  I'm part of a team at work wth 25 people!  Do I really have to add their addresses individually?  Seems ridiculous.  Don't even need their names - just the emails, so when I type in "United," for example, I get all the folks in that Group which is named "United."
    Thanks.

    There was a "magical" set of Applescripts that would have done that, but it no longer works.
    There is no way in the OS to do that besides making the Applescript yourself using the current Script Editor.
    Another way to do what you want is to select all of the addresses (select one, then cmd-A). Then, drag the selection to somewhere in the Finder. That will create a text clipping. You can then drag that text clipping into the address field in Mail.
    The text clipping will be named with the first few email addresses. You can rename it in the Finder.
    Each one can be your own "distribution" list.

  • How to create XMLTYPE View from the XMLType table

    Hi:
    I have a large XML file and inserted to the XMLTYPE table
    For the XQUERY purpose I would like to create XMLView of the table.
    The examples I got from Oracle to create XML view are for small files.
    Can some one help me how to create XMLType VIEW for large XML Files ( 20,000 lines )?
    Ali_2

    Have a look at the examples given on XMLType Views (based on relational tables) or standard views (based on XMLType storage) in the FAQ url located on the main page of this forum site regarding XMLDB.

  • How to  create a datasource from a pool table ?

    Hi guys,
    Is there anyone who faced the same problem.
    I need to create an datasource from the table TIV5T to get texts in BW .
    This table is a pool table . When i want to create the DS in RSO2 i got the message :
    Only transparent tables and database views can be extracted
    I try to create a  projection vue, or use the standard vue  : same error.
    Any Idea ??
    Thank you .
    Dinah

    Hi DInah,
    Please go through the following threads.
    Re: How to extract data from a pool table?
    Datasource on Pool Table
    Regards,
    Ravikanth

  • How to create a Gradientcolor from two existing swatches

    Hello all,
    I have 2 colors in the swatches palette.has anyone how to create a new gradient color from this to swatches.
    So far I can get my to colors from the palette and extract their color:
    aSwatch1 = sAISwatchList->GetSwatchByName( colList, colorName1 );
    aSwatch2 = sAISwatchList->GetSwatchByName( colList, colorName1 );
    iErr = sAISwatchList->GetAIColor( aSwatch1, &colorP1);
    iErr = sAISwatchList->GetAIColor( aSwatch2, &colorP2);
    // now somehow create a new gradient:
    iErr = sAIGradient->NewGradient( &gradientHnd );
    but what do now. to get the new color from colorP1 and colorP2. I need a simple linear gradient.
    Any hints?
    regards
    Michael

    Hello,
    > Please, excuse any ignorance below. I'm not well versed in the actual artistic side of Illustrator, just the implementation
    excused because you're the one of the few people here who give thoe most usefull answers
    > Isn't that to be expected though? From my admittedly limited understanding, the gradient being saved is really just a sequence of colour stops. I would have thought since the angle of the gradient is more of a property of how its applied to the path (or whatever) that it wouldn't make sense to save it on the gradient colour.
    No, not from my view (and needs ).
    The color for the gradient has a type of AIGradientStyleMap. this struct contains the angle für the linear gradient etc. This color is added to the swatchpalette so it shoud keep the value.
    If you replace the CreateGradientSwatch function in SnpGradien.cpp of the SnippetRunner with the following code a 2nd swatch with an different angle is added to the swatchpalette when creating a new linear gradient is created (name seems not what it should but 2 swatches are created. Applying this 2 swatches to a rectangle also the angle is changed as it should be.
    So from my point of view Illustrator doesn't take the angle when a new color/swatch is created in the swatch panel. Why the angle is saved by creating a style is another question and difficult to answer without looking inside the source of Illustrator
    ASErr SnpGradient::CreateGradientSwatch(const AIGradientHandle gradient, AISwatchRef& swatch)
    ASErr result = kNoErr;
    try {
    // Insert new swatch at end of general swatch group.
    swatch = sAISwatchList->InsertNthSwatch(NULL, -1);
    // Get gradient name.
    ai::UnicodeString gradientName;
    result = sAIGradient->GetGradientName(gradient, gradientName);
    aisdk::check_ai_error(result);
    // Set swatch name.
    result = sAISwatchList->SetSwatchName(swatch, gradientName);
    aisdk::check_ai_error(result);
    // Create the swatch color using the gradient.
    AIColor swatchColor;
    swatchColor.kind = kGradient;
    swatchColor.c.b.gradient = gradient;
    swatchColor.c.b.gradientAngle = 30;
    swatchColor.c.b.gradientLength = 1;
    AIRealPoint origin = {0,0};
    swatchColor.c.b.gradientOrigin = origin;
    swatchColor.c.b.hiliteAngle = 0;
    swatchColor.c.b.hiliteLength = 0;
    SnippetRunnerLog::Instance()->WritePrintf("gradientAngle: %.1f",swatchColor.c.b.gradientAngle);
    SnippetRunnerLog::Instance()->WritePrintf("gradientLength: %.1f",swatchColor.c.b.gradientLength);
    SnippetRunnerLog::Instance()->WritePrintf("gradientOrigin (v / h): %.1f /  %.1f", swatchColor.c.b.gradientOrigin.v, swatchColor.c.b.gradientOrigin.h);
    SnippetRunnerLog::Instance()->WritePrintf("gradientAngle: %.1f",swatchColor.c.b.gradientAngle);
    SnippetRunnerLog::Instance()->WritePrintf("hiliteLength: %.1f",swatchColor.c.b.hiliteLength);
    // Set the swatch color.
    result = sAISwatchList->SetAIColor(swatch, &swatchColor);
    aisdk::check_ai_error(result);
    // making a 2nd swatch
    AISwatchRef swatch2;
    swatch2 = sAISwatchList->InsertNthSwatch(NULL, -1);
    result = sAISwatchList->SetSwatchName(swatch2, (ai::UnicodeString("Grad2")));
      // Create the swatch color using the gradient.
      AIColor swatchColor2;
      swatchColor2.kind = kGradient;
      swatchColor2.c.b.gradient = gradient;
      swatchColor2.c.b.gradientAngle = 60;
      swatchColor2.c.b.gradientLength = 1;
      swatchColor2.c.b.gradientOrigin = origin;
      swatchColor2.c.b.hiliteAngle = 0;
      swatchColor2.c.b.hiliteLength = 0;
    result = sAISwatchList->SetAIColor(swatch2, &swatchColor2);
    catch (ai::Error& ex) {
    result = ex;
    return result;
    The CS3/CS4 question is easy: for CS3 i use the CS3 SDK and for CS4 I#m working with the CS4 SDK :-)

  • How to create af:tree from single database Table

    Hi,
    i want to create tree Like this: and also we can add node anywhere.
    Parent01
    ----|parent01-child01
    --------|parent01-child01-child01
    --------|parent01-child01-child02
    -------------|parent01-child01-child02-child01
    Parent02
    ----|parent02-child01
    ----|parent02-child02
    --------|parent02-child02-child01
    and for this i have created Table like this :
    Table name Treetable
    NODEID     NUMBER(38,0) --> Primary Key
    NODENAME     VARCHAR2(50 BYTE) --> This is the name will display as a node
    DESCRIPTION     VARCHAR2(255 BYTE)     
    ROOTIND     CHAR(1 BYTE) --> to decide root node
    SEQUENCENO     NUMBER(38,0)     --> order to display node
    PARENTKEY     NUMBER(38,0) -->FK (refering to NODEID(PK) of this table)
    But when i am creating tree, its showing root node for each row in the table. but my requirement is: The Row marked as ROOTIND='Y' , show that row only as Root (Example in above tree:Parent01 & Parent02 )
    any help highly appreciated :)
    Thanks
    Pratap Rudra
    Edited by: 995114 on Apr 30, 2013 2:50 PM

    Hi,
    check this http://www.oracle.com/technetwork/developer-tools/adf/learnmore/32-tree-table-from-single-vo-169174.pdf
    Frank

  • HT5071 How to create an iBook from an existing PDF

    I just published a book, paperback. Can I now take it and make it into an iBook?
    Will it need a new ISBN number and things like that?
    Thanks Sarah

    !.) Yes, it's your content to distribute thru other channels if you like. Opne the PDF, and then select/cloy and paste into the iBooks Author template of your choosing. Format and style accordingly, then submit to the store.
    2.) An ISBN is optional.
    See iBooks Author: Publishing and distribution FAQ - Support

  • HELP!!!!! How to create 3D canvas from simple 2D picture with mirror edges

    Hi everyone,
    I really need your help. I have to create over 2000 3D canvas pictures from simple 2D pictures. You can see example by clicking on the link bellow http://www.wedoprints.co.uk/s2g/wedoprints/can1.png  
    Can anyone tell me the easiest way to do such amount of 3D canvas pictures? Coz I will spend ages creating each canvas picture manually. I think there should be any modules or other software I can use. I will appreciate any help because I am in a real trouble at the moment.
    THANKS IN ADVANCE

    You can do it manually in PSE
    Open picture file
    Duplicate background layer
    Open a blank layer between the background and background copy layers
    Fill this layer with any color - I used 50% gray for demonstration
    Make the background copy layer active and get the transform tool (CTRL+T). Skew and scale the layer as desired. Commit when finished
    Open the Effects palette, and apply a high drop shadow
    Double click on the fx on this layer to bring up the Style settings dialog to tailor the drop shadow to suit

  • How to create a PDF from DWF or Revit with hyperlinks?

    DWF file has 20 sheets of engineering drawings.  First 10 are plans with section, detail and elevation callouts.  In DWF I can click on one of these callouts and be brought directly to the detail sheet with the detail on it (one of the second 10 pages in the DWF).  Is there a way to get this to work in PDF format - click on a section mark on plan and automatically go to the page with the section on it.

    You could convert all of the sheets to PDF, combine all of them, then use the Link tool to create the callout/page jump effect you're looking for.

  • Create a database from 32bit rman backup with NEW name on a 64bit system

    Hello,
    i'm more programmer than database admin but i need to set up a 10gR2 apex development server based on our productive instance in a short time.
    For that i want to use a rman backup of the productive machine (SLES 10 32bit, DB10GR2+ASM, APEX 3.1).
    Because of the less time i got, i want to use an existing machine (SLES 11 64bit, DB10GR2+ASM) as destination.
    On this machine i want to create a new instance from the backup i took. I Already read note 881395.1 but i'm quite unsure about 2 things
    a) It's VERY IMPORTANT that the development instance has another name than the productive instance.
    When i follow 881395.1 and set the enviromental variable ORACLE_SID to another new name. Will this be all? Or will there be problems using another SID because of references in the controlfile or sth. like that?
    b) It's VERY IMPORTANT that the datafiles aren't stored in the same path and with the same names as the productive instance. It is another server but there is already a copy of the database (our dba tried to set up a standby solution on this machine) and i don't want to bother this!
    How can i rename the datafiles before restoring the backup from scatch?
    I found this: set newname for datafile 1 to '<filesystem based filename>';
    Will this help? Do i need to rename every single file? Or is it possible to set a path in which all datafiles will be restored?
    c) What about the 32bit to 64 bit thing? Will this work? Or do i need to convert the database? How? RMAN Convert?
    Or could RMAN convert anyhow used to realize the whole thing?
    Thank you very much for your support!
    Regards
    Daniel

    Hello,
    i'm more programmer than database admin but i need to set up a 10gR2 apex development server based on our productive instance in a short time.
    For that i want to use a rman backup of the productive machine (SLES 10 32bit, DB10GR2+ASM, APEX 3.1).
    Because of the less time i got, i want to use an existing machine (SLES 11 64bit, DB10GR2+ASM) as destination.
    On this machine i want to create a new instance from the backup i took. I Already read note 881395.1 but i'm quite unsure about 2 things
    a) It's VERY IMPORTANT that the development instance has another name than the productive instance.
    When i follow 881395.1 and set the enviromental variable ORACLE_SID to another new name. Will this be all? Or will there be problems using another SID because of references in the controlfile or sth. like that?
    b) It's VERY IMPORTANT that the datafiles aren't stored in the same path and with the same names as the productive instance. It is another server but there is already a copy of the database (our dba tried to set up a standby solution on this machine) and i don't want to bother this!
    How can i rename the datafiles before restoring the backup from scatch?
    I found this: set newname for datafile 1 to '<filesystem based filename>';
    Will this help? Do i need to rename every single file? Or is it possible to set a path in which all datafiles will be restored?
    c) What about the 32bit to 64 bit thing? Will this work? Or do i need to convert the database? How? RMAN Convert?
    Or could RMAN convert anyhow used to realize the whole thing?
    Thank you very much for your support!
    Regards
    Daniel

  • How do i transfer photos from pc to iphone with new itunes 11?

    I find new itunes a nightmare....please advise how to transfer photos from PC to iPhone it used to be so easy :-(  many thanks

    The same way it worked in every previous version of iTunes.
    Connect the device to the computer.
    Select the Photos tab.
    Select the folder to sync to the device.

  • How to create DB partitioning in active data tables for ods?

    hi all,
    Can anyone let me know how to create DB partitioning in active data tables for ods. if any docs pls share with me at my email id : [email protected]
    regds
    haritha

    Haritha,
    The following steps will briefly explain you to improve the performance in terms of DB partitioning as well as loading. Please find the same,
    transaction RSCUSTA2,
    oss note 120253 565725 670208
    and remove 'bex reporting' setting in ods if that ods not used for reporting.
    hope this helps.
    565725
    Symptom
    This note contains recommendations for improving the load performance of ODS objects in Business Information Warehouse Release 3.0B and 3.1 Content.
    Other terms
    Business Information Warehouse, ODS object, BW, RSCUSTA2, RSADMINA
    Solution
    To obtain a good load performance for ODS objects, we recommend that you note the following:
    1. Activating data in the ODS object
    In the Implementation Guide in the BW Customizing, you can implement different settings under Business Information Warehouse -> General BW settings -> Settings for the ODS object that will improve performance when you activate data in the ODS object.
    1. Creating SIDs
    The creation of SIDs is time-consuming and may be avoided in the following cases:
    a) You should not set the indicator for BEx Reporting if you are only using the ODS object as a data store.Otherwise, SIDs are created for all new characteristic values by setting this indicator.
    b) If you are using line items (for example, document number, time stamp and so on) as characteristics in the ODS object, you should mark these as 'Attribute only' in the characteristics maintenance.
    SIDs are created at the same time if parallel activation is activated (see above).They are then created using the same number of parallel processes as those set for the activation. However:if you specify a server group or a special server in the Customizing, these specifications only apply to activation and not the creation of SIDs.The creation of SIDs runs on the application server on which the batch job is also running.
    1. DB partitioning on the table for active data (technical name:
    The process of deleting data from the ODS object may be accelerated by partitioning on the database level.Select the characteristic after which you want deletion to occur as a partitioning criterion.For more details on partitioning database tables, see the database documentation (DBMS CD).Partitioning is supported with the following databases:Oracle, DB2/390, Informix.
    1. Indexing
    Selection criteria should be used for queries on ODS objects.The existing primary index is used if the key fields are specified.As a result, the characteristic that is accessed more frequently should be left justified.If the key fields are only partially specified in the selection criteria (recognizable in the SQL trace), the query runtime may be optimized by creating additional indexes.You can create these secondary indexes in the ODS object maintenance.
    1. Loading unique data records
    If you only load unique data records (that is, data records with a one-time key combination) into the ODS object, the load performance will improve if you set the 'Unique data record' indicator in the ODS object maintenance.
    Hope this helps..
    ****Assign Points****
    Thanks,
    Gattu

  • How to create olap cube using Named Query Table in Data source View

     I Create on OLAP Cube using Existing Tables Its Working Fine But When i Use Named Query Table with RelationShip To other Named query Table  It Not Working .So give me some deep Clarification On Olap Cube for Better Understanding
    Thanks

    Hi Pawan,
    What do you mean "It Not Working"? As Kamath said, please post the detail error message, so that we can make further analysis.
    In the Data Source View of a CUBE, we can define a named query. In a named query, you can specify an SQL expression to select rows and columns returned from one or more tables in one or more data sources. A named query is like any other table in a data source
    view (DSV) with rows and relationships, except that the named query is based on an expression.
    Reference:Define Named Queries in a Data Source View (Analysis Services)
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to create Criterian For more than one table

    Hi,
    I have one problem how to create criteria for more than one table in that using one criteria hot to get the values from database in that more than onetable for getting these values .Please send me the exampke code.
    reagrds,
    raghu

    Hi,
    I don't think its possible to create fieldcatalog for different tables,
    but if you want to do so create a dummy table which has all the fields which you want in fieldcatalog.
    populate the data from different table to that dummy table
    then create fieldcatalog for that table and pass it in the function module...
    Regards,
    Siddarth

  • Create one tables from 2 different tables

    Hi,
    How I can create one table from 2 different tables. Source tables have data and I want to include it in new table.
    I try this:
    create table NEW_ONE
    select * from OLD_ONE
    union
    select * from OLD_ONE2;
    But it didn't work correctly :/

    I don't have any error. This syntax create table NEW_ONE, but this table have columns only from OLD_ONE table :/ There aren't any column from OLD_ONE2 :/ Any suggestions?
    I don't forget about "as" in my query, only in this post.
    Edited by: tutus on Sep 8, 2008 6:36 AM

Maybe you are looking for

  • "You do not have permission to open the application....."

    I'm getting the above error message when trying to launch an install application from CD, from a managed user account. I can launch it successfully from the admin user account - but then of course I can't install in the correct user account properly.

  • Backup cd wont restore or be recognized by itunes

    Old desktop was crashing and i normally used media player to back up all my music but took a chance and used itunes and it worked to the tune of 22cds.. I bought a new laptop and installed itunes and no prompt came up for restoring library or importi

  • DAB+ radio for N8 available in Australia?

    Anybody know if the DAB+ radio for N8 will be available in Australia soon? I presume one can buy it on-line from UK ....  and does anyone know if it is any good? One big question apart from reception may be what it does to battery life. Thanks Paul.

  • Making a Cut Line, around a vector image.

    The job: I have thousands of little vector images i need to put a cutline around. The solution: I have a little program that will record my mouse and keyboard strokes, repeat said recording as many times as i tell it to, so i can easily automate all

  • Applicazione risulta installata su app store

    Salve a tutti, Ho un problema con App Store: dopo aver formattato il mio macbook 13" White del 2009 e reinstallato MacOSX Mountain Lion 10.8.2; ho aperto App Store per installare alcune applicazioni precedentemente Acquistate ed ho notato che diverse