Cursor to fill a column with an increase in the value

Hello
I had the example table EMP (empno, full name, etc). I've added the username column and I need to fill it with values: emp1, emp2, emp3,..., emp1000..., etc. (until it corresponds to all employees)
Can you please provide an example of code to fill the column?
Thank you in advance.
update emp
set username='emp'||rownum;

Max
http://oracleitalia.WordPress.com

Tags: Database

Similar Questions

  • How to fill a column with numbers and maintain when adding or deleting lines?

    So far, I've discovered two ways to fill a column with the number:

    1. Enter '1' in a single cell, '2' in the one below, select both, and then use the yellow dot to drag down - it will do the rest.

    2 create a formula such as 'A2 + 1' and drag also.

    However, in both cases it will work if I manually this continues to do for each newly added line at the bottom. Now, that alone would not be that big of a problem if it wasn't for the fact that I'm working with a table where the lines can be added among other rows in the future.

    Having said that, could someone please tell me how to create a column with a number that will increase automatically? I mean - if I add a new line between line 56 and 57, I want the new line to have a '57"in it, and the" old 57 "would now be"58"and so on." " I don't want to drag the whole column, which can be hundreds if not more than a thousand lines.

    Try to put this in the cells in the column:

    = ROW()

    In the formula, you can add or subtract a number if necessary to get the starting number that you need.

    SG

  • Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?

    Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?

    Hello

    2796614 wrote:

    Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?

    Of course, it is possible.  According to what the text file looks like to, you can create an external table that treats the text file as if it were a table.  Otherwise, you can always read the file in PL/SQL, using the utl_file package and INSERT of PL/SQL commands.

    You have problems whatever you wantt?  If so, your zip code and explain what the problem is.

    Whenever you have any questions, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the exact results you want from these data, so that people who want to help you can recreate the problem and test their ideas.  In this case, also post a small sample of the text involved file.

    If you ask about a DML operation, such as INSERT, then INSERT statements, you post should show what looks like the tables before the DML, and the results will be the content of the table changed after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

  • Fill a column with Ajax in tabular form

    Hello

    I have the following problem.

    A tabular presentation, created with the wizard and not with apex_item, has a certain LOV column with different values and attributes of the element the following call:

    1 onChange = "javascript:f_getPV(#ROWNUM#,_this)";

    The column that needs to be filled has ID = f10

    2.
    function f_getPV (pRownum, pInput) {}
    get var = new htmldb_Get (null, & APP_ID., 'APPLICATION_PROCESS is getPV', 0);
    get.addParam ('x 01', pInput.value);
    gReturn = get.get ();
    $("f10_000"+pRownum).text (gReturn); SPAN id
    }


    The application process (On Demand) looks like:

    3.
    declare
    lv_pv_sk number: = apex_application.g_x01;
    number of lv_cost_amt;
    Start
    Start
    Select dc.cost_amt
    in lv_cost_amt
    Since DC default_cost
    where 1 = 1
    and dc.power_value_sk = lv_pv_sk
    and dc.valid_till is null;

    exception
    When NO_DATA_FOUND then
    lv_cost_amt: = 0;
    When TOO_MANY_ROWS then
    lv_cost_amt: = 0;
    end;
    HTP. PRN (lv_cost_amt);
    end;

    Unfortunately, I don't have any population for the f10 ID column.

    Any ideas?

    Hello

    What HTML tag is than f10? If it is a box entry or text you cannot use jQuery text() function.
    Something like this might work then

    $s("f10_000"+pRownum, gReturn);
    

    Kind regards
    Jari

    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0

  • In DataGrid, how to fill a column with zeros (0) records?

    Is there a simple way, in a DataGrid, for fill the records in a column with zeros (0)?

    I have a DataGrid with two columns: colA and colB.  ColA records values from a RemoteObject call.  I need auto-fill (AutoFill) recordings in colB with zeros.  How is that possible?

    Thank you!

    If you need to 0 in the dataprovider, once pass you the loop of result of the data provider and add a dynamic property with value = 0;

    Something like that

    var dp:ArrayCollection = event.result as ArrayCollection collection;

    for (each var item: Object in PD)
    {
    item.demoValue = 0;
    }

    Create a new datagrid column, set demoValue as datafield.

    If it is just for display, add a new column, put an itemrenderer with label = '0 '.

  • TRIGGER - how to auto fill a column with the sequence

    Hello

    I have a table that contains information about the customers... I have bound him to a form of the APEX so that when a user enter information through a form he generates a sequence/trigger number and saves it in the column (named tracking_NO)... I use this tracking_no as key for monitoring purposes.

    My problem is that when the admin will post information from MS access to Oracle, it generates automatically a number for my column 'tracking_No '... Please advice how to use the same trigger Auto Fill a column (tracking_no) when the value is zero.

    Here's my trigger

    CREATE OR REPLACE TRIGGER B.T_CUSTOMER_TRG
    BEFORE THE INSERT OR UPDATE
    ON B.T_CUSTOMERS
    REFERRING AGAIN AS NINE OLD AND OLD
    FOR EACH LINE
    Start
    If: NEW. "' TRACKING_NO ' is null then
    Select T_CUSTOMER_SEQ.nextval in: NEW. "' TRACKING_NO ' from dual;
    end if;
    end;
    /

    Two copies.
    I really think this is a bug coding causing this duplication.

    Published by: PhoenixBai on December 25, 2010 21:50

  • fill a dial with a connection to the local network

    I wanted to share my internet with my itouch but I can not, I was using a verizon 3g wireless device but my phone treats it as a dial-up modem... so it wont let me fill my connection with "connecting to LAN".

    Hello

    In general, Dial-Up connection can be shared.

    Some 3G connections except do not let. You must search for and discover if your sallow configuration for sharing.

    Jack - Microsoft MVP, Windows networking. WWW.EZLAN.NET

  • Need help with Javascript to get the value of standard report column

    Hi all

    Apex 3.1 version

    I have a query SQL (editable report) region where I need to do validations using a process of OnDemand and javascript. For this posting, I need to use the serial number and id of this same report line item. The function is called when the serial number is changed. I can get the serial number easily because it is a text field, however, the item id is a standard report column (which actually a text field or hidden gives me a checksum error, long story). How can I get the value of the standard report column to set the value of an element of the Application to use in my process of application as well as the serial number? Here is my code below.
    <script>
    
    function f_ValidateSerial(pThis)
    {
        
      // The row in the table
    
      var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    
        //alert('Row is '+vRow);
    
    
      // Display the serial number
        //alert('The Serial Number is '+html_GetElement('f21_'+vRow).value);
    
      
     var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ValidateSerial',0);
     get.add('F101_SERIAL_NUMBER',html_GetElement('f21_'+vRow).value);
     get.add('F101_INVENTORY_ITEM_ID',+html_GetElement(?????+vRow).value);   // Here's where I need to get the item id to set application item!!
     
     gReturn = get.get();
     
    if (gReturn)
        { 
          alert(gReturn);
        }
     
      if(gReturn)
        { 
          html_GetElement('f21_'+vRow).value = '';
        }
               
    }
    </script>

    Hello

    Ok

    Item ID is standard report column.
    If you enter this Expression HTML column

    #ITEM_ID#
    

    I guess that the substitution of column item Id is #ITEM_ID #.

    Now, you have hidden input form that is not submitted.
    Then in JavaScript

    get.add('F101_INVENTORY_ITEM_ID',+html_GetElement('item_id_'+Number(vRow)).value);
    

    Kind regards
    Jari

  • APEX4: Filling of fields of database based on the value of SelectList

    Hello

    I have a Select list and 4 fields of text on a form. By choosing a value in the select list, I have to fill out text fields from its values from the database by using the value in the list select as primary key.

    How can I do this in 4 APEX?

    Thanks for the help.
    -Hozy

    OK, the problem was solved on apex.oracle.com

    You were not able to access the application because your application uses DB account as the authentication scheme, who obviously would not work on apex.oracle.com.

    I have change the authentication to Apex on apex.oracle.com scheme.

    About 3-4 truggers were not valid for account forms, the customer and transfer did not work. Who sets also.

    There is no data, then finished by create minimal records juices.

    Now take a look at the Page 14 and dynamic Actions. Only Address1 and Address2 are Benoit updated, based on the customer account. You will need to add additional Dyna for the zip code and city Actions.

    Next time around, please make it easier for someone to help out you by
    1. the manufacture of safe objects are valid
    2. it some (dummy data) in the relevant tables

    Kind regards

  • Column link has failed on the values

    Hello

    I have a report of sql updeatable, where one of the columns is a link (approved) and the other
    is a list of selection (Approval_DAL) among others.
    The report is
    Select
    "APPROVAL_ID,"
    "APPROVAL_DAL,"
    "APPROVER_GROUP_ID,"
    "IDR_ID,"
    "approve" as "approve."
    "Reject" as "reject".
    of IDR_APPROVAL

    By clicking on the link 'Approve' I want to move the selected item selection list value
    APPROVAL_DAL and other values of column to another page.

    I've implemented "Approve" link to go to the page 511
    and set the parameters as follows this page
    P511_APPROVAL_ID #APPROVAL_ID #.
    P511_IDR_ID #IDR_ID #.
    P511_APPROVAL_DAL #APPROVAL_DAL #.

    The value of the selection APPROVAL_DAL never list is passed. Help, please. Thank you.

    Suni

    Hello:
    It just occurred to me that the solution suggested in my previous post is not a viable solution. You can try the following instead

    Set the attributes "column" for the column of the APPROVAL_DAL report to

    ID = #ROWNUM xxx_ #.

    Change the specification of the link for the approval column has a target type of URL. For the URL, specify

    JavaScript:SetLink('#APPROVAL_ID#','#IDR_ID#','xxx_#rowNum#')

    Add the JS in the header HTML page below

    
    

    CITY

  • Fill a column with serial number

    Hello, all seniors... !

    my table has a column empty NWT (number), I would now like to fill with a series of numbers
    for as many records that are also present.

    examples of table data.
      1  SELECT  TXN_DATE
      2  FROM PTXN
      3* WHERE ROWNUM <10
    
    TXN_DATE
    ----------
    18/03/2010
    02/02/2010
    10/02/2010
    05/04/2010
    15/05/2010
    25/01/2010
    03/02/2010
    15/01/2010
    25/04/2010
    
    9 rows selected.
    
    I issue this command;
    update ptxn
    set tno = rownum
    
    With the above Update SQL, the TNO column got filled with the exact number of records. Like this,
    SELECT  TXN_DATE,tno
    FROM PTXN;
    
    TXN_DATE         TNO
    ---------- ----------
    03/02/2010          1
    15/01/2010          2
    02/02/2010          4
    25/04/2010          8
    25/01/2010          3
    18/03/2010          6
    15/05/2010          9
    10/02/2010          5
    05/04/2010          7
    
    9 rows selected.
    what I want actually is to sort my table (ptxn) in the column "txn_date" wise and complete series.
    Like this;
    TXN_DATE NWT
    ---------- ----------
    15/01/2010 1
    25/01/2010 2
    02/02/2010 4
    02/03/2010 8
    02/10/2010 3
    2010-03-18 6
    2010-05-04 9
    2010-04-25 5
    2010-05-15 7


    How can I change my statement Update ot any other solution, please suggest.

    Using PL/SQL:

    SQL> select * from PTXN ;
    
    TXN_DATE         TNO
    --------- ----------
    07-MAR-10
    26-FEB-10
    01-MAR-10
    08-FEB-10
    03-MAR-10
    16-APR-10
    11-APR-10
    08-MAY-10
    14-MAR-10
    18-APR-10
    
    10 rows selected.
    
    SQL> begin
      2   for r in (select rowid i, TXN_DATE, row_number() over (order by TXN_DATE) n from PTXN) loop
      3     UPDATE PTXN p
      4        set TNO = r.n
      5      where rowid = r.i;
      6   end loop;
      7  end;
      8  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from PTXN
      2  order by 1;
    
    TXN_DATE         TNO
    --------- ----------
    08-FEB-10          1
    26-FEB-10          2
    01-MAR-10          3
    03-MAR-10          4
    07-MAR-10          5
    14-MAR-10          6
    11-APR-10          7
    16-APR-10          8
    18-APR-10          9
    08-MAY-10         10
    
    10 rows selected.
    

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/31/le-direttive-di-compilazione-pragma/]

  • How to display a column with a representation of the image color in Windows Explorer on Windows 7?

    OK, here's my situation...

    I have a directory with 300 + JPG images in it; I'm hoping to use some (if not all) of these images for a project.

    However, the project has very specific requirements for the image dimensions, resolution, and a representation of the colors; So I need to evaluate the supplied images to validate if they are all in line with these requirements.

    If I right click on an individual image and choose Properties - then click on details, I can see the image information such as:

    • Dimensions,
    • horizontal resolution,
    • vertical resolution, and
    • color representation.

    ... which would be perfect if I had only 1 or 2 images to cross; but with more than 300 images, it becomes cumbersome.

    So: I put the "Détails" view folder and added columns for dimensions, horizontal and vertical resolution resolution.

    This helps my cause, because I can then sort the directory... and quickly see if the images are too small, too big, or unacceptable resolution.

    However, I have not found a way to add a column for the representation of colors.

    Is it possible to add a column for the representation of colors?

    Hello

    Unfortunately there is no other option to define the representation of colors in Windows Explorer. If you want to provide feedback about it, then check out the link:

    Windows 7 comments

  • Show a column with a list of the DOUBLE values;

    Hello, how to display something like:

    COL1
    -------
    A
    B
    C
    D
    E
    F

    drbiloukos wrote:
    ORA-00904: "REGEXP_REPLACE": invalid identifier
    00904, 00000 - '% s: invalid identifier '.
    * Cause:
    * Action:
    Error on line: column 132: 28

    I'm on 9i

    Really? I've seen that mentioned anywhere before. How everybody had to know that you are using an older version of the database does not support?

    In any case...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'I Need a List with Words not Letters' as txt from dual)
      2  --
      3  select substr( txt
      4               , decode(level, 1, 1, instr(txt, ' ', 1, level-1)+1)
      5               , decode(instr(txt, ' ', 1, level), 0, length(txt), instr(txt, ' ', 1, level)
      6                 - decode(level, 1, 0, instr(txt, ' ', 1, level-1))-1)
      7               ) val
      8  from t
      9* connect by level <= length(txt)-length(replace(txt,' '))+1
    SQL> /
    
    VAL
    ------------------------------------
    I
    Need
    a
    List
    with
    Words
    not
    Letters
    
    8 rows selected.
    
    SQL>
    
  • Help with query - Conversion of the value of the line to the value of the column for the same column

    CREATE TABLE TESTY
    (
      BATCH_ID  VARCHAR2(100 BYTE),
      LINE_NUM  NUMBER,
      STRING    VARCHAR2(100 BYTE),
      AMOUNT    NUMBER
    )
    /
    Insert into testy
       (BATCH_ID, LINE_NUM, STRING, AMOUNT)
     Values
       ('DBA', 1, '101-201', 100)
    /
    
    Insert into testy
       (BATCH_ID, LINE_NUM, STRING, AMOUNT)
     Values
       ('DBA', 1, '101-202', 200)
    /
    
    Insert into testy
       (BATCH_ID, LINE_NUM, STRING, AMOUNT)
     Values
       ('DEVELOPER', 2, '101-201', 110)
    
    /
    Insert into testy
       (BATCH_ID, LINE_NUM, STRING, AMOUNT)
     Values
       ('DEVELOPER', 2, '101-202', 210)
    /
    
    Insert into testy
       (BATCH_ID, LINE_NUM, STRING, AMOUNT)
     Values
       ('DEVELOPER', 2, '101-203', 310)
    /
    COMMIT
    /
    
    BATCH_ID     LINE_NUM     STRING     AMOUNT
    DBA          1          101-201     100
    DBA          1          101-202     200
    DEVELOPER     2          101-201     110
    DEVELOPER     2          101-202     210
    DEVELOPER     2          101-203     310
    
    Required Output 
    
    BATCH_ID     LINE_NUM  AMOUNT1 AMOUNT2
    DBA          1         100     200
    DEVELOPER    2         110     210
    Only need to this result for string IN (101-201', 101-202').

    Can anyone help. ?

    Thank you

    Hello

    In Oracle 8.1 or more

    SELECT       batch_id, line_num
    ,       SUM (CASE WHEN string = '101-201' THEN amount END)     AS amount1
    ,       SUM (CASE WHEN string = '101-202' THEN amount END)     AS amount2
    FROM       testy
    GROUP BY  batch_id, line_num
    ORDER BY  batch_id, line_num
    ;
    

    From Oracle 11.1, you can also use SELECT... PIVOT.
    For more information, see the FAQ forum {message identifier: = 9360005}

  • Change column bg-color according to the values in this column.

    Version of the apex is 4.2.4

    To keep it short, I want the background of one of my field to be red when it is NULL, when there are data in it, I want it to be green.

    The first is what it looks currently, second photo, that's how I want it to look!

    pPy2VYX.png

    Option

    Use the column layout features.

    It is a bit of a hack, but it works well.

    1. Add a column to your query that contains the logic for your choice of color.

    decode (department_id, 30, 'BLUE', 'RED') AS DEPT_COLOR

    2 - cut the column in the report properties - so it does not appear.

    3 - update the column in question-> column-> Expression HTML formatting

    Add the desired HTML logic.

    Ex:

    #DEPARTMENT_ID #.

    Now it works OK for some styles and formatting - but the DIV in a table cell is kind of a weird look.

    Option

    Create a report model that put this condition of the column in place.  To create a column a different color, you will need to use a level line model.

    Option

    Put in a bit of jQuery with option 1.

    -Create a class that you can button

    #DEPARTMENT_ID #.

    -Create a region on the bottom of the page

    Note: This will not work if you are using one of the reports that have the '' mouse highlighting. ''

Maybe you are looking for