Noob question to try to replicate the rows in a table

Simplification of the problem is that I have a table with user_id, name, year where useridentifier is pk. I would like to take advantage of all the lines that correspond to year = 2008 and insert them into the same table, but start the user_id a number and year = 2009.

I know that this does not work, but that's what I want to do in noob-code:

INSERT in the TABLE)
user_id, name, year
) (VALUES
SELECT User_id_seq.nextval after starting at 3500, name, 2009 of the same table to insert in the place where year = 2008
);

I considered using a temporary table, I've also seen mention of sliders, but do not understand what they are. I'm really, really new to Oracle and SQL in general, but am familiar with programming and shell scripts. I know more in-depth research could land me what I want, but I think my search syntax would be just as weak as my knowledge of the subject. I just think that it's something so basic and easy that my research are not using the right conditions to catch a shot.

Hello

is a fixed number practice

INSERT INTO TEST_1
   (SELECT t.user_id + ,
           t.NAME,
           (t.YEAR + 1)
      FROM TEST_1 T
     WHERE t.YEAR = 2008);

COMMIT;

Kind regards

Tags: Database

Similar Questions

  • cannot access the rows of a table not nested element

    What Miss me? I'm under Oracle 12 c (12.1.0.1.0)

    CREATE TYPE dim_O AS OBJECT )

    dimension_id number

    label_en varchar2()300( )

    );

    CREATE TYPE dim_T AS TABLE OF dim_O;

    DECLARE

    dims_t dim_T

    START

    SELECT CAST(MULTISET( )) 

    SELECT  DIMENSION_ID LABEL_EN

    DE    DIMENSIONTABLE -actual physical table in oracle

       DIMENSION_ID IN (3001 3002 3003()

    ) AS dim_T) "dim_rec"

    BY dims_t

    DE    DOUBLE;

    FOR I IN dims_t. FIRST... dims_t. LAST LOOP

    DBMS_OUTPUT. Put_line() dims_t() I). dimension_id);

    END LOOP;

    -exit from the loop above is

    -3001

    -3002

    -3003

    -The following statement fails: cannot access the rows of a table not nested element

    UPDATE TABLE ( SELECT dimension_id FROM TABLE (dims_t) ( )

    Dimension_id SET = WHERE = dimension_id 3004 3003

    -The following statement fails: cannot access the rows of a table not nested element

    UPDATE TABLE ( SELECT dimension_id FROM TABLE (CAST (dims_t in dim_T () ) ( )

    Dimension_id SET = WHERE = dimension_id 3004 3003


    END;

    I'm trying to understand this example very simple, but to no avail.

    Can someone tell me why I get this error?

    Thank you all in advance for your time.

    Marc

    What Miss me? I'm under Oracle 12 c (12.1.0.1.0)

    CREATE TYPE dim_O () AS OBJECT

    number of dimension_id

    label_en varchar2 (300)

    );

    CREATE TYPE dim_T AS TABLE OF dim_O;

    DECLARE

    dims_t dim_T;

    BEGIN

    SELECT CAST (TYPE MULTISET)

    SELECT DIMENSION_ID, LABEL_EN

    OF DIMENSIONTABLE -actual physical table in oracle

    WHERE DIMENSION_ID IN (3001,3002,3003)

    () AS dim_T) 'dim_rec '.

    IN dims_t

    FROM DUAL;

    I'm IN dims_t.FIRST... dims_t.Last LOOP

    DBMS_OUTPUT. Put_line(dims_t (i) .dimension_id);

    END LOOP;

    -exit from the loop above is

    -3001

    -3002

    -3003

    -The following statement fails: cannot access the rows of a table not nested element

    UPDATE TABLE (SELECT dimension_id FROM TABLE (dims_t))

    SET dimension_id = dimension_id = 3003 3004 WHERE;

    -The following statement fails: cannot access the rows of a table not nested element

    UPDATE TABLE (SELECT dimension_id FROM TABLE (CAST (dims_t as dim_T)))

    SET dimension_id = dimension_id = 3003 3004 WHERE;

    END;

    I'm trying to understand this example very simple, but to no avail.

    Can someone tell me why I get this error?

    You get it because dims_t is an array of OBJECTS - not a table of scalars. But your SELECT statement returns scalar.

    There IS NO such object, named "dimension_id"; It is an ATTRIBUTE of the object DIM_O. DIMENSION_ID is a SCALAR which, as says the exception, is a "No nested table element; If you cannot select/Update lines of it.

    What you do is equivalent to the following:

    DECLARE

    dims_t dim_T;

    number of dim_id;

    dim_o design;

    BEGIN

    Design: = dim_o (3, 'ghi');

    SELECT DIM_O (DIM_ID, LABEL) BULK COLLECT INTO table DIMS_T (d_o);

    end;

    /

    ORA-06550: line 7, column 59:

    PL/SQL: ORA-22905: cannot access the rows of a table not nested element

    ORA-06550: line 7, column 1:

    PL/SQL: SQL statement ignored

    This SELECTION is trying to design it as a table when it's a SCALAR - so the same exception you get.

  • How to select all the rows in a Table

    Hello

    JDEV 11.1.1.2.0 work.

    I need to select all the lines all in the click of a button, how can I achieve this? Here is table unique selection/multi selection.

    someone can help me.

    Published by: user5802014 on June 30, 2010 08:32

    Rather than try to direct you to the message that I want to say, I'll just copy the code here with credit to Frank Nimphius

    The post is a hyperlink on the word present in the step 5 post of my "how to search in the forum" :)

    RichTable _table = employeesBackingBean.getEmployeeTable1();
       RowKeySet rks = new RowKeySetImpl();
      CollectionModel model = (CollectionModel)_table.getValue();
      int rowCount = model.getRowCount();
          for (int i = 0; i < rowCount; i++) {
               model.setRowIndex(i);
               //note that in the simple POJO case, the row key is the same
               //as the index. However, it would be wrong to just rely on this
               //because other models or custom table models my return a more
               //comples key. Therefore we iterate over the available rows to
               //obtain the keys.
               Object key = model.getRowKey();
               //add the row keys to the RowKeySet to mark selected
               rks.add(key);
           }
       _table.setSelectedRowKeys(rks);
       AdfFacesContext.getCurrentInstance().addPartialTarget(_table);
    
  • Get all the rows of a table control

    Hi all

    I have a table with a column control. What function can I use to extract all lines? I have to go row by row and read each line or is it possible to do in a function?

    Thank you

    Kanu

    Assuming that Garay in the column have all of the same data type, you can retrieve the entire column with a single statement:

    GetTableCellRangeVals (Panel, control, VAL_TABLE_COLUMN_RANGE (1), array, VAL_COLUMN_MAJOR);

    The array passed must be large enough to recover all data. Alternatively, you can replace the VAL_TABLE_COLUMN_RANGE with the appropriate statement of MakeRect macro. In the event that your table was built of dynamically, you can get the naked, imber of lines using GetNumTableRows and size your table accordingly.

    The above macro is defined in userint.h as well as some other useful macros that can be used to access the data in a table.

    There are a few precautions to be taken in the case of string values or a certain type of cell (ring, combo box, button...) that are described in the hell of the function.

  • How increase automatically the rows in a table

    Dear friends,

    In apex 4.1 I don't see Adding line in the process due to which i m unable to increase the lines in a table automatically when you click on the button to add a line. Can u please help me in this regard how improve rows in apex 4.1?

    Concerning
    Kamran

    Hi Keita,

    To do this, you must create a separate process for the tabular presentation.

    Please check that you remove it

    javascript.addRow () in the box add row button and change to submit the page.

    Create a process page, select form---> Data Manipulation---> add lines of tabular presentation---> give the necessary lines as you wish (5).

    Brgds,
    Mini

    ----------------------
    Mark responds promptly

  • In the face of the question and try to set the affinity through VCO workflow rule

    In the face of the question then to attempt to set the affinity through VCO workflow rule I'm trying to write workflow VCO to set up the level of affinity of cluster, but it throws the error message cannot convert ClusterComputeResource 'mycluster' to com.vmware.vim.vi4.ClusterConfigSpec (Workflow: create vm-virtual machine affinity rule / Scriptable task (item1) #19) my script to workflow is var rule = new VcClusterAntiAffinityRuleSpec(); Rule.Key = - 30; Rule.enabled = true; Rule.Name = ruleName; rule.userCreated = true; Rule.VM = MV; var clusterSpecRules = new Array(); var clusterSpecRule = new VcClusterRuleSpec(); clusterSpecRule.operation = VcArrayUpdateOperation.add; clusterSpecRule.info = rule; clusterSpecRules.push (clusterSpecRule); var clusterSpec = new VcClusterConfigSpec(); clusterSpec.rulesSpec = clusterSpecRules; var m = computeCluster.vimHost //spec = task = computeCluster.reconfigureCluster_Task (computeCluster, spec, true); Note: In the above code, what are the entry parameter computeCluster entered type parameter VC:clusterComputeResource ruleName is a parameter of type String - APR

    Here is the code I use, give it a shot.

    var affinitySpec = new VcClusterAffinityRuleSpec();
    affinitySpec.enabled = true;
    affinitySpec.name = att_ruleName;
    affinitySpec.userCreated = true;
    affinitySpec.vm = att_vmArray;

    var clusterRuleSpec = new Array (new VcClusterRuleSpec());
    clusterRuleSpec [0] = new VcClusterRuleSpec()
    .operation clusterRuleSpec [0] = VcArrayUpdateOperation.add;
    clusterRuleSpec [0] .info = affinitySpec;

    var clusterConfigSpec = new VcClusterConfigSpecEx();
    clusterConfigSpec.rulesSpec = clusterRuleSpec;

    att_task = att_clusterComputeResource.reconfigureComputeResource_Task (clusterConfigSpec, true);

  • Noob question: move a layer in the opposite direction of another layer animation

    So say I have an icon that I animate on the axis y + 40px, but instead try to back key the other layer each time, is there an expression that I can write to have the other layer move in the opposite direction of the Y the same quantity of units (ex:-40px)?

    Thank you!

    We must define what traffic there is relative to. For example, if you want a layer of mirror movement are another layer from the first image, you could do it like this:

    p = thisComp.layer("leader").transform.position;

    value + [0, p.valueAtTime (0) [1] - p [1]]

    If you want to mirror around a value of y specific reference, it would be like this:

    yRef = 540;

    p = thisComp.layer("leader").transform.position;

    value + [0, yRef - p [1]]

    There are other variations/interpretations - depends on what you are looking for exactly.

    Dan

  • Noob question - apply a texture to the text layer

    I tried looking for the answer, but probably do not know the right keywords to use, but how to apply a texture (image) to only appear above a certain layer as a text layer?  Which means I want the texture to show only text and not anywhere else.

    Use the texture layer as a track matte for the text layer.

  • Highlight the row in a table hint

    Hello!

    I'm evaluating the LabVIEW and try to do a few simple steps. Now, I have a table hint that contains all the values of frequency of 50-60. I need to calibrate for each frequency, and I would like to insist on each row of the table. Well, I use SelSize and SelStart property nodes, and it works very well the selected line is displayed. But I have only about 20 lines visible, and to see the rest I need to scroll through the table. How to change the position of scroll programmatically? Or maybe you can suggest the best way to highlight the lines?

    Found the solution: the IndexVals property node defines the line/column numbers to be displayed in the upper left corner of the table hint.

    Kudo goes to AndrewAlford for his reply in this topic:

    http://forums.NI.com/T5/LabVIEW/highlight-a-row-in-table/m-p/320036#M165245

  • Dynamically add and partially fill the rows in a table

    Hello

    I am trying to create a score card into a tool of the Apex.

    I am considering using a form master detail with the work items to be marked as the master and the score Board being the detail section.

    Each work in the Master table item has a type of work assigned, which translates into a job category, and each category of work has several criteria to be noted.

    I wish that when a user selects an element of work and is branched to the detail page, the tabular presentation adds a number of lines having previously met the criteria.

    For example, a user must click on an element which is a part of category "Car Wash".

    Arriving on the form, the tabular form should have 3 rows with 2 columns. Column A personnel action (IE. Washed with SOAP?, rinsed with water?, dried?) And column B would have a group of yes/no radio.

    If the user has selected a work item from the category 'Room cleaned' instead, the tabular presentation would load with 2 lines added columns A and b. column A personnel action (IE. Bed made?, rags storage?) And column B would have a group of yes/no radio

    Is this possible with tabular forms or is there a better way to do it? I included the picture of how the tables are related.

    Ideas on the best way to approach the question is appreciated!

    TabExample.png

    Sorry for the late reply!

    And you're right about the lines being temporary. If the user does not mark the editable column in this line and select apply, the lines will never entered in the database.

    I managed to find a way to fix this since I posted this even though I'm not sure if it's the most effective way to do it.

    I have created a process that runs when the page after the header and written lines of the secondary table (item Action Scores) given of the Association. In this way when loading the form of tables, it loads with all the correct rows with null values in the column group radio for Yes / No.

    That's what I came with, but if there is a more effective way without making too complicated, I'd love to learn!

  • Conditional read only the rows in a table

    We have a requirement only under a certain condition (which may change each line), a line can be read only or editable and are uncertain how to implement this with APEX

    for example, lets say a table has the following features

    columns: ID, Date, editable

    1, September 12, 2015, Y

    2, September 15, 2015, Y

    3, 18 September 2015, N

    4, 19 September 2015, N

    5, 22 September 2015, Y

    Thus, when this data displays on a page in a tabular presentation, the date ONLY are editable for lines 1, 2 and 5. For lines 3 and 4, the date cannot be changed

    In the ADF, we get this by setting the attribute readonly on the date component to "row.bindings.Editable.inputValue =='N" ""-this would be evaluated by line and switch read only one or off for each date listed in the table.

    Help, pointers would be greatly appreciated!

    See you soon,.

    Brent

    Here is a link to a starting point: dynamic Action on a tabular presentation. Jeff Kemp on Oracle it shows how to condition the unalterable columns.  The same logic would apply only to a line level...

    Thank you

    Tony Miller
    Los Alamos, NM

  • Column of the row on a table (using the SQL query)

    Data in my table looks like this.

    Data in the table

    ===============

    COL_1, COL_2

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

    1 ABCD

    2 ABC

    3 ABCDE

    4             AB

    5 ABCDEFGH

    Now, he must, for the entire line, length COL_2 text exceeds 3, display the text remaining in the new line. For example, the first row (COL_1 = 1), COL_2 length is 4, so in SQL output two lines will be displayed as shown below. Also, the last row (COL_1 = 5), the length is 8, then, in SQL, output 3 lines will be displayed as below. And for the COL_1 = 2 & 4, only 1 rank will be displayed as the text COL_2 length is less than or equal to 3.

    OUTPUT

    ===============

    COL_1, COL_2

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

    1 ABC

    1             D

    2 ABC

    ABC 3

    3             DE

    4             AB

    5 ABC

    5 DEF

    5             GH

    We need to implement using SQL only.

    Hello

    the solution of etbin uses recursive subquery factoring available on Oracle 11 g 2.

    Since you have not mentioned your version I write here 2 alternatives using CONNECT BY and Xquery:

    with mydata as

    (

    Select 1 c1, c2 'ABCD' Union double all the

    Select 2, 'ABC' from dual union all

    Select 3, 'ABCDE' from dual union all

    Select option 4, "AB" dual union all

    Select 5, "ABCDEFGH" of the double

    )

    Select c1, substr (c2, level * 3-2, 3) C2

    of mydata

    connect by substr (c2, level * 3-2, 3) is not null

    and c1 = c1 prior

    and prior dbms_random.random is not null;

    C1 C2

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

    1 ABC

    0%

    2 ABC

    ABC 3

    3

    4 AB

    5 ABC

    5 DEF

    5 GH

    9 selected lines.

    with mydata as

    (

    Select 1 c1, c2 'ABCD' Union double all the

    Select 2, 'ABC' from dual union all

    Select 3, 'ABCDE' from dual union all

    Select option 4, "AB" dual union all

    Select 5, "ABCDEFGH" of the double

    )

    Select a.c1, x.c2

    of mydata one

    , xmltable ("ora: tokenize($c2,",")")

    passing regexp_replace (a.c2, '(.{1, 3}) \1 ',',') as "c2".

    path of columns c2 varchar2 (30) '.'

    ) x

    where x.c2 is not null;

    C1 C2

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

    1 ABC

    0%

    2 ABC

    ABC 3

    3

    4 AB

    5 ABC

    5 DEF

    5 GH

    9 selected lines.

    Edit: corrected the Xquery solution using a simplified regexp_replace.

    Kind regards.

    Alberto

  • Delete the row in a table

    Adding table rows works fine when I use this script: Table.Row1.instanceManager.addInstance (1);

    When users click on Delete, always, it removes the second (and shifts the rest upwards), any line, they want to remove. I have the following script to delete a table row:

    Table.Row1.instanceManager.removeInstance (1);

    What I have to change in order to remove the line that is clicked?

    Hello

    Add to that a proceeding is easy because you must specify true or false (1 or 0)

    but for deletion line is a little different, instead of this, or specify true false, you must specify which line to remove...

    If your button Delete is inside the line itself, you can use the index of the parent of the button line delete

    Table.Row1.instanceManager.removeInstance (this.parent.parent.index);

  • Validate the rows of a table in a page jspx

    Hi, I use the JDeveloper, 10.1.3.5.0 and JHeadstart 10.1.3.3.88. In my requirement, the number of lines is displayed dynamically (i.e., multiple of 5 as 5,10,15,20(maximum)). I need to validate the displayed lines. The user must select at least one line for each of the 5 ranks (1 of 5 rows, 1 of 5-10 lines like that). Please suggest me in how to make these postings.

    Thank you and best regards,

    Y. Cecilia Babu

    This has been achieved by, using the iterator on the AMImpl scale. for example, after you click the button, button action attribute must be a tot in the bean, the bean method call may call the current method to the AMImpl level and then, using the iterator, all the lines are posted based on validations, the values will be stored in the database.

  • A few reasons why we should allow no movement of the row of a table?

    I'm curious to know if there is a reason why we should not allow movement row for a given table request?

    A lot of features like the return of flame, etc. requires movement line is activated?

    are there specific situations that we should not do. I talk about this in general, but if you ask for the specific oracle version, it is oracle 11.2.0.3

    THX

    Delphine

    It seems that Jonathan Lewis is interested also:

    Movement of line | Notebook of the Oracle

Maybe you are looking for