need a script to create multiple tables as the other columns in tables

I need script to create multiple tables as the other columns of tables respectively.

lets consider I want to create tables from table1... table99 like tablex1... .tablex99 columns (without data) respectively (i.e table1 as tablex1, table99 as tablex99).
declare

cursor c is select object_name from all_objects where object_type='TABLE';

begin

for i in c loop

execute immediate 'create table '||i.object_name||'_x as select * from '||i.object_name||' where 1=2';

end loop;

end;

use can use this and put your user names accordingly.
If you get any error please post the error.

Tags: Database

Similar Questions

  • Script to create multiple virtual machines model works is not for the network adapter variable

    We are working on a script to create multiple virtual machines from a template. The script works fine, but when we try to include commands to set the NIC to a group of specific ports on a dvswitch script errors on. Here's what we have so far. This script (less network variables) works, but we would like to include the network configs in the script as well.

    -------------------

    This is the part of the script that configures the network/dvswitch adapter... but does not work properly.

    $myResourcePool = get-ResourcePool-name DQOL

    $dsName = get-Datastore-name "DQOL-DS01.

    $myTemplate = get-Template-name "DQVTemplate".

    $distributedSwitchPortGroup = get-VirtualSwitch-distributed - name "CVE-dvS04-Nexus - k 5 | Get-VirtualPortGroup-name '979-DQ-SHARED '.

    New-VM-name MyVM1-model $myTemplate - Networkname ResourcePool - $myResourcePool - OSCustomizationSpec $mySpecification $distributedSwitchPortGroup - Datastore

    (Get-$dsName data store)

    New-VM-name MyVM2-model $myTemplate - ResourcePool $myResourcePool - OSCustomizationSpec $mySpecification - Datastore (Get-$dsName data store)

    _____________________

    !!!!!!!  This part works, but without specifying a network/dvswitch... card!

    $myResourcePool = get-ResourcePool-name DQOL

    $dsName = get-Datastore-name "CVE-SAN-ISG-DS02-02ef.

    $myTemplate = get-Template-name "DQVTemplate".

    New-VM-name MyVM3-model $myTemplate - ResourcePool $myResourcePool - OSCustomizationSpec $mySpecification - Datastore (Get-$dsName data store)

    New-VM-name MyVM4-model $myTemplate - ResourcePool $myResourcePool - OSCustomizationSpec $mySpecification - Datastore (Get-$dsName data store)

    Here is the error we get:

    New-VM: all parameters can be resolved by using the specified named parameters.

    C:\Users\capuanoj\Desktop\Create-multiplevms-fromtemplate.ps1:6 char: 7

    + New-VM < < < <-name MyVM1-model $myTemplate - Networkname $distributedSwitchPortGroup - ResourcePool

    ePool - OSCustomizationSpec $mySpecification - Datastore (Get-$dsName data store)

    + CategoryInfo: InvalidArgument: (:)) [new-VM], ParameterBindingException)

    + FullyQualifiedErrorId: AmbiguousParameterSet, VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM

    You cannot use the - model and Networkname - parameters of the cmdlet New - VM in a single order, because both are in different parameter sets. You must first create the virtual machine and then use the cmdlet Set-NetworkAdapter to change the portgroup of the virtual machine. As in example 4, assistance from cmdlet Set-NIC:

    --------------  Example 4 --------------

    C:\PS>$myNetworkAdapters = Get - VM | Get-NetworkAdapter-name "NIC 1.
    $myVDPortGroup = get-VDPortgroup-name MyVDPortGroup
    Together-NetworkAdapter NetworkAdapter - $myNetworkAdapters - $myVDPortGroup Portgroup

    Retrieves all network named "NIC 1" cards of all virtual machines and connects to the specified distributed port group.

  • Multiple constraints on the same column

    Hello experts, we can use Multiple forced on the same column in oracle as creating table, I want to add a key single and forced to check on the same column is this possible? Thanks in advance,

    If you want, seems to be possible

    CREATE TABLE t1

    (col1 VARCHAR2 (50))

    CONSTRAINT ck1 CHECK (col1 IN ('A', 'B', 'C'))

    CONSTRAINT PRIMARY KEY (col1) pk1

    );

  • Change of primary key on the Table clears the other columns

    Preliminary info/Installation
    JDeveloper 11 g 11.1.1.6.0
    We have a table (object view or entity) that has 8 columns. The primary key is composed of 4 1 columns.
    The table is displayed in a page fragment.
    2 of the 4 non-primary key columns are LOV.
    All the 8 columns are needed.
    The table is editable including 2 of primary key columns.

    Question
    Assume that the table displays the 3 lines. If we change a rank 1 non-primary key column and a primary key in row 2 column, everything works well when we are committed to the database
    If, however, we first change a primary key column, then a primary key on a different line column, then the column/row primary key that changed us first, gets annihilated and the other columns LOV on this same line. The 2 columns that are not LOV keep data as it should. We then get a validation error because the required data are not present. All this happens before we try all commit to the database. If debug us and look the iterator, it has the old data in this document, before and after any performance on the binding.
    If we look at and update the data via the App Module, everything works well. We have tried to update the view, etc. through valueChangeListener also with no luck.

    If you change the primary key value, it should not be the primary key.

    This is true in the design of database relational regardless of how access you the data. In addition, EO don't like if you change the primary key value.

    Have you considered adding a surrogate key (use a sequence) and make your PK course a unique key?

    John

  • How to create multiple hierarchies from the same physical table

    Hi all

    I have a physical table to join with a fact table: there are 3 different hierarchies, which share the last 2 levels inside the dimension table. It's the logic diagram of hierarchies:

    Dimension services
    -Business
    -Sector
    -Type
    -Operator
    -Product
    Partner of dimension
    -Partner
    -Operator
    -Product
    Contractor of dimension
    -Contractor
    -Operator
    -Product

    All columns are in the same table physical source. I tried to create 3 table logic source from the same physical table, everyone with all the columns and create a hierarchy for each dimension table, but it gives me nQSError: 15011.

    Any suggestion? Maybe the physical table alias can help for the creation of tables of different sizes?

    Thanks in advance,
    Concerning

    Hello

    It is a basic rule that you cannot create multiple hierarchies in a single dimension table, so what you do is create three tables of alias and slip into MDB layer in 3 different sizes and on top these tables create 3 different dimension hierarchies.

    Check if useful/correct

    Thank you.

  • Submitting a form by creating multiple lines in the DB table

    Hi all

    I created a new Apex application and have created a table with columns - USER_ID, ADDRESS, TELEPHONE, CREATEDON etc.

    I want to read the USER_ID of the user and complete this field on the form and fill in the CREATEDON field with the date system. These two fields are hidden on the form.

    Now, when the user fills his address and phone on the form and click on send, 3 identical rows are inserted into the DB table. The values of user and date system are set correctly.

    To set the UserID field, I inserted a $APP_USER. in the default value of the form section. I am not able to understand why the Apex is to insert several lines even when you click the submit button once.

    Help, please.

    The problem is solved now. I noticed that add default values for the form fields added process duplicate. That's why the form has been processed three times. Remove the additional process solved the problem.

  • How to create multiple tables with SQL commands

    Hi, first of all, is it possible to create a table and then one more both with SQL commands?
    because I tried to do this in the following way
    Example:
    CREATE TABLE 'HB_Product')
    "productId" number 4 NOT NULL.
    "productName" VARCHAR2 (20) NOT NULL,
    "prodPricePerTon" NUMBER (10,2).
    "HB_Product_PK" PRIMARY KEY CONSTRAINT ("productId")
    )
    /
    CREATE TABLE 'HB_Operations')
    "orderNo" NUMBER (5) NOT NULL,
    'lineNo' number 4 NOT NULL.
    "billNo" NUMBER (10) NOT NULL,
    'actions' VARCHAR2 (15).
    'place' VARCHAR2 (15).
    "actDate" DATE NOT NULL,
    "totWeight" NUMBER (6.3).
    'HB_Operations_PK' CONSTRAINT PRIMARY KEY ('lineNo')
    )
    /

    I copied some of the syntax for creating the table object browser, but I preffer to use my own sql.
    It gives me an error "Missing or option not valid."

    Can someone explain to me how to do it properly, or why it is not possible?

    Best regards from Stan!

    862377 wrote:
    so you're saying I can't do several tables at the same time?

    Yes... Well,... not this way

    You can do this way

    create schema authorization alex
    CREATE TABLE "HB_Product" (
    "productId"    NUMBER(4) NOT NULL,
    "productName"    VARCHAR2(20) NOT NULL,
    "prodPricePerTon"    NUMBER(10,2),
    CONSTRAINT "HB_Product_PK" PRIMARY KEY ("productId")
    )
    CREATE TABLE "HB_Operations" (
    "orderNo"    NUMBER(5) NOT NULL,
    "lineNo"    NUMBER(4) NOT NULL,
    "billNo"    NUMBER(10) NOT NULL,
    "actions"    VARCHAR2(15),
    "place"    VARCHAR2(15),
    "actDate"    DATE NOT NULL,
    "totWeight"    NUMBER(6,3),
    CONSTRAINT "HB_Operations_PK" PRIMARY KEY ("lineNo")
    )
    /
    

    The question is: why do you want to create "at the same time? What is the harm in creating one after the other?

    some tips (maybe not desired):
    do not use quotation marks in your statement, this will create column names and the table out.

  • My iTunes library creates multiple listings for the same artist (spelled identically)

    I use iTunes for years and thought I knew how to do everything that I need in there and solve any problem that I've run across.  But in the last 10-14 days, he began to behave strangely, and I'm completely stumped.  I don't know if it's a problem with a new version, if maybe my library file has become corrupted, or if I'm missing something obvious, but as someone who spends hours meticulously entering all the right data to my iTunes library, that drives me crazy.

    For some reason any recently, iTunes has begun to create several artist registrations for a handful of artists in my library (in only general I have a LOT of material for.)  Thus, for example, when I scroll my iTunes under 'Artists' library I noticed that Bruce Springsteen four times:

    Bruce Springsteen (12 albums, songs of 234)

    Bruce Springsteen (16 albums, 201 songs)

    Bruce Springsteen (2 albums, 22 songs)

    Bruce Springsteen (2 albums, 41 song)

    It would be only incredibly annoying, but it actually divides some albums through multiple "artists" so that securities 1,4,6,7 will be an artist under a listing and the rest on another.

    I created a smart playlist with the criteria ' artist contains 'bruce' "selected all titles of springsteen and changed the artist on EACH of them to ensure that there is no variation in spelling or spacing.  It does not exist. (Springsteen is the worst offender, having four entries of artist, but there's another 3-4 artists who do the same thing)

    It drives me crazy because there seems to be no rhyme or reason to it, and it is debilitating to my efforts to clean and organize my library.  I try to avoid manually recharge all my music in iTunes I have dozens of playlists I've spent hours creating and would not have to start over on those.

    Any suggestions?

    You have already tried the first method, so try the other here:

    Fix split Album or artist listings in iTunes

  • How to avoid creating multiple instances of the application?

    Hello

    We have a user interface Application. The application has been set to Auto run at startup and as a Module system.

    The application has a file listener that checks all new emails.

    When we start the application from the user interface by clicking on the application icon, it seems that the multiple instance of the application is created. For this reason when send us an email to request it is receiving emails several times. Sometimes simple, double and sometimes even five times.

    public class MyApplication  extends UiApplication implements FolderListener,
            SystemListener, GlobalEventListener {
    
        // Boot
        public static void main(String[] args) {
            if (args != null && args.length > 0 && args[0].equals("gui")) {
                // code to initialize the app
                fromService = false;
                // register the notification
                Notification n = new Notification();
                n.registerNotificationObjects();
    
                Utilities.writeLog(GUID, "MyApplication GUI Starting up");
                MyApplication service = new MyApplication();
                service.enterEventDispatcher();
            } else {
                Utilities.writeLog(GUID, "OnBoardV2 Service Starting up");
                MyApplication service = new MyApplication();
                service.enterEventDispatcher();
            }
        }
    
        public void messagesAdded(FolderEvent e) {
            /// Receive messages
            }   
    
    }
    

    In this regard, any help will be apreciated!

    Thank you

    I don't know if it's your entire code, but if you register your application as a file time listener never, it is called, then you save several headphones. The listener does not cause deleted your app closes, you must explicitly remove the listener. You must either put the listener in its own class and only sign up to start or find a way to check if the listener is already registered whenever the application is called.

  • Help! Need a script to automatically open files with the same name but in another location.

    Good morning friends,

    So for my work, I need a script to open files with the same name but located in a different folder. But since I'm a total noob when it comes to programming, I can't understand how do. That's what I have in mind:

    -J' I manually open an image.

    -The script will look for a file with the same name in another folder that I've specified.

    -The script will then select the channel CMYK of the second file and copy and paste it into the first file.

    -The second file is then closed without saving the changes.

    I have problems with the part where the script searches for a file with the same name as the opened file. I would really appreciate help. Thanks in advance.

    If (app.documents.length > 0) {}

    myDocument var = app.activeDocument;

    var Nomdoc = myDocument.name;

    try {var basename = docName.match (/(.*)-.)} [ ^\.] +$/)[1]}

    catch (e) {var basename = thedoc.name};

    var path = / * path of folder to insert as a string here * / + ' / ' + base name + / * insert file extension, including the period as a string here * /;

    If (queue (path) .exists == true) {var otherDocument = app.open (File (path))};

    };

  • AcriveSync has created multiple numbers for the same contact

    I recently had my transferred to my new pre phone book and set up my corp email.

    A lot of my contacts are mixed up (last names starting with O come in T, and these records have multiple records for the same phone number.  How can I fix?

    Hey thanks - I thought about it.  Turns out there have a lof of contacts in my constituency of corp I do not even know (or use).  I went in a deleted them and now al is good.  Thank you!

  • How do I see the search for the other column table in a report

    Hello

    I created a 'form on the report' to get entry to reception.  Reception table has the column account_code.  How add place holder account_name column whose value can be fetch from table account_master.

    It is an interactive report on the form region.  I've learned there are two ways, one is to alert the request in the "source" of the report and include account_name column by joining the table account_master.  Another way is to create a calculation field? (not sure).

    I need to know what is the best way to achieve this.  I use APEX 4.2.6. EPG.

    Thank you

    -Anand

    Hi Anad,

    To configure a new column, you must run the page

    In the interactive report drop-> select the columns-> relating to the structure and then save it as the primary default report

    Thank you

    Sunil bhatia

  • How to create dynamic action of the link column in the classic report

    I have an apex page to display a modal window using jquery. In the modal window, I have a classic report with a column of link I want to capture its click event.
    I thought I could create a dynamic action with selection of type = jquery selector. Not sure if I need to do anything on the link column and do not know the syntax
    jquery selector. Would appreciate help or direction?

    Always zip code using .

    ...\
    

    tags as described in the FAQ.

    I created a region of report with the following query:

    Select empno, ename, 'SELECT' from emp
    where (ename like '%'||ltrim(rtrim(:P2_SEARCHPU))||'%'
    or :P2_SEARCHPU is null)
    

    There is no alias specified for the "SELECT" column, Oracle uses so the content of the column as a default alias. It comes

    'SELECT'
    

    Instead of

    SELECT
    

    The necessary jQuery selector would be:

    td[headers="\'SELECT\'"] a
    

    However the need to release the single quote everywhere is a ticking time bug. SELECT an Oracle reserved word means use it as any type of identifier is either too smart.

    You should always use a valid Oracle identifier as an alias explicit when a column contains a literal value or a complex expression:

    select
        empno
      , ename
      , 'SELECT' link_text
    from
        emp
    where
        (  ename like '%'||ltrim(rtrim(:P2_SEARCHPU))||'%'
         or :P2_SEARCHPU is null)
    

    APEX will use the column alias LINK_TEXT as the ID attribute of the column header and the cells in the column will reference it in their headersattributes. The jQuery selector is:

    td[headers="LINK_TEXT"] a
    
  • Need to move virtual machines and power over the other ESXi HA and issues of Configuration of power

    Dears

    Need to move virtual machines and power on ESXi others using the HA and Power Options

    So what are the Options I need activate and deactivate:

    Turn on Vsphere HA

    Activate the tracking host

    Admission control (disabled)

    VM Machine Options

    VM restart priority (medium)

    Response from the host of off the power isolation

    VM monitoring (people with disabilities)

    Monitoring of (high) sensitivity

    Heartbeat of data store (select one of cluster data warehouses taking into account my preferences) of the data store is checked

    On each:

    Start/stop of the virtual machine is turned off

    Please indicate the required Options and on virtual machines, we are not turning on?

    Just to be clear, that VMware HA will only restart the VMS if ESXi hosts fails - or surveillance of the VM is turned on which will be monitors VMs will they crash or suspend and restart the virtual machine affected.

    and just to be clear, that the response of insulation parameter has nothing to do whther THAT HA will work or not - it does come into play if the ESXi host is isolated of the HA - Cluster

    xMotion works only between active ESXi hosts that can communicate with the server vCenter - and if the ESXi host broke down or became isolated and vMotion may not work.

    vMotion is automated with DRS that vMotion will a VM who need more resources to an ESXi host with enough reosurces.

  • Multiple values for the same column in the columns of diffétent in the same row?

    Hi all
    I wonder how you can display different values for the same column in different columns on the same line. For example, using a CASE statement, I can:

    CASE WHEN CODE IN ('1 ', ' 3') THEN COUNT (ID) AS 'Y '.
    CASE WHEN CODE NOT IN ('1 ', am') THEN COUNT (ID) AS "N".

    Yes, that will produce two columns but will produce null values to empty and also two separate registers.


    Any ideas?

    Thank you

    Are you sure that this code works for you?

    Select ID
             ,CASE WHEN MODE_CODE IN ('1', '3') THEN COUNT( No) END as "Fulltime"
             ,CASE WHEN MODE_CODE NOT IN ('1', '3') THEN COUNT( No ) END  as "Other"
    From table
    group by ID
    

    I guess the code above fails because MODE_CODE is not in your group by?

    My suggestion would be to put the CASE in the COUNT:

    Select ID
             ,COUNT(CASE WHEN MODE_CODE IN ('1', '3') THEN No END) as "Fulltime"
             ,COUNT(CASE WHEN MODE_CODE NOT IN ('1', '3') THEN No END)  as "Other"
    From table
    group by ID
    

    CASE expressions return no. when the respective conditions are true and NULL otherwise.
    COUNTY will have non-null values.

Maybe you are looking for