Automatically increase a column

Hello

Suppose I have a med_icd10 table

with column

med_icd_sn (of the sequence),

med_icd_id,

med_icd_code,

descr1,

Descr2,

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

The med_icd_id column now has values

010100100100001

010100100100002

010100100100003

and I did a tabular form of detail.

The Med_Icd_id column is hidden from the user

I wish that when the user inserts a new row, the column med_icd_id increase in the background.

for example, to become

010100100100004

010100100100005

010100100100006

but not

0101001001000011

0101001001000012

0101001001000013

I want stable length

010100100100010

010100100100011

010100100100012

How I can do this,

I mean, find the last value of this column and to wear it, when the user inserts a new line?

In what trigger?

Thank you very much.

I think you have two issues here:

1 is associated plsql. How to increase the sequence by replacing zeros.

You can try something like:

set serveroutput on;
declare
l_Med_Icd_id varchar2(15) := '010100100100009';
l_last_zero pls_integer := instr(l_Med_Icd_id,'0',-1);
begin
  dbms_output.put_line (substr(l_Med_Icd_id, 1, l_last_zero - 1) -- left part of the string will remain fixed
        ||lpad(substr(l_Med_Icd_id, l_last_zero) + 1, 15 - l_last_zero + 1, '0'));
end;

2nd is related forms: I think the prior insertion is a good trigger to set the value. If you have to deal with multirecord, you can use: system.trigger_record to calculate the increase, like this:

... || LPAD (substr (l_Med_Icd_id, l_last_zero) +: system.trigger_record, 15 - l_last_zero + 1, '0'));

Tags: Oracle Development

Similar Questions

  • When I record Captivate automatically increases my level 100 volume

    Hello

    I'm doing a Powerpoint presentation where I need to record an audio for each slide. Whenever I have the record button, Captivate increase my level 100 volume automatically. For the moment, I save and readjust the level while recording and then use the editing tools in Captivate to cut the "reajdusting process". However, this takes too long and is very tedious. I know others have had this problem before. No there is no way to solve this problem?

    In fact I did everything the side Windows of the things like unchekcing 'allow applications to take exclusive control of this device.

    Calibrate you the microphone with Captivate? It would be useful that you mentioned the version you are using. No audio record in PPT, but in Captivate, please.

  • Create a table with auto increase of columns

    I remember there is a single line of SQL to create a column that can auto increase. -Does anyone know it? something like below:

    CREATE TABLE HAS
    (
    ID INTEGER AUTOINCREMENT
    )

    Thanks a lot for your help!

    Not in Oracle, no.

    You can simulate the SQL Server AUTOINCREMENT feature by

    -Creating a table
    -Creating a sequence
    -Creating a level trigger line BEFORE INSERT on the table that populates the column, i.e.

    CREATE TABLE a (
      a_id integer primary key
    );
    
    CREATE SEQUENCE a_id_seq;
    
    CREATE TRIGGER trg_a
      BEFORE INSERT ON a
      FOR EACH ROW
    BEGIN
      SELECT a_id_seq.nextval
        INTO :new.a_id
        FROM dual;
    END;
    

    Justin

  • Increase the column width in an IR

    Hello

    I tried to increase the size of a column in an IR

    I found a way to change the title of
    <div style=""> Name </div>
    The problem is that I got the code div too, when I do a CSV export.

    Y at - it something to avoid this?

    Thank you

    Uji.

    Hello

    Check out Apex generated div id of the tag. Usually, it is apexir_ and the alias column.
    You can inspect HTML easily with Firefox and Firebug.

    Add in the HTML page header

    
    

    Where apexir_ENAME is the id of the div tag Apex has generated for report heading div

    BR, Jari

    Published by: jarola on June 10, 2010 11:49

    typos corrected

  • How to increase the column header

    Hello, can I know Table or in Labview 2012 multicolumn Listbox is available to change the format of the header of column as picture below?

    I don't think you can merge cells (like Excel) with a MCL LabVIEW

  • Automatically update the column in the table in OBIEE

    Hi people,

    I have a requirement to say I need to update a column of table based on a condition, but this update should happen on a daily basis (I mean that it would be held once per day) by checking if all the records in this column meets the condition then update

    example:-column = 'pending', then using the "approved". As records of transactions every day in the table lights. OBIEE should check and update the line so the next time it does not show this line as "pending".

    I thought of 2 approaches to this
    (1) through the write-back, it is possible to update but manually (the question is it can't be automated or on demand on daily basis and update multiple records on a go)
    (2) write a stored procedure or a function of update, but how can I perform this procedure either regular or run once daily.how to use it?

    Any thoughts on the above two points or any method you can think off the coast.

    Any help is appreciated!

    See you soon,.
    KK

    Murielle,

    This shud be easy...
    -Create a direct database... with the Update statement
    for example: Update table set col = "Approved" where col = 'pending '.
    -Create an ibot using the RFI above and plan on a daily basis.

    This will update the complete table with the new value on a daily basis based on the State

  • Using numbers to create a table where the value of the line increases automatically

    Hello

    I created a table (pictured below) to help calculate my self-employed income:

    INDEX

    DATE

    HAVING RETURNED TO THE SELF-EMPLOYED

    £

    A1

    I want to create an index / of reference for each line so that I can connect to receipts.

    I like the index / reference to automatically increase i.e. A2, A3 etc when I create a new line by using the shortcut 'alt - cursor down' but to note has managed to find out what formula to use.

    Any help would be great!

    Thank you very much

    Stophen.

    You can try something like this:

    = 'A' & rangee()

    SG

  • From a Wi - FI to Ethernet connection to a Wi - Fi connection - automatically...

    BACKGROUND:

    1. did you just replaced my cable modem

    2. have you implemented Airport utility again for my router (Airport Extreme 6gen c. 7.7.7) with its intact previous settings

    2. have made no changes to the configurations of system/network preferences

    QUESTION:

    Now unable to move automatically from the WiFi to Ethernet and the WiFi - like I did before !


    More precisely...

    If I'm wireless online and then connect LAN port of my router (gen6 Airport Extreme) to my MacBookPro (OSX 10.11.5) with ethernet cable - I stay online when I click on the different links.

    However, when I unplug the ethernet cable - instead of automatically - return back to the Wi - Fi - I woke up completely offline.

    And I am unable to re-establish a connection constantly computer completely - and then turning it back on.

    In other words - I'm able to get the WiFi to Ethernet without problem - but don't back switch back to WiFi after having disconnected the ethernet cable

    By clicking on the WiFi, WiFi off icon in the menu bar of the computer does not resolve the problem

    On my computer, system preferences > network is configured as follows:

    Location: automatic

    Left column has WiFi at the top, followed by Ethernet, Firewire, iPhoneUSB, Bluetooth PAN

    SOLUTION?

    Bottom line - exactly should I be doing to move seamlessly from wireless to wired and wireless - without having to close and restart the computer then again?

    The item up in the list will be internet primary when something is available.

    So as you want Ethernet to resume when it is connected, it should be on top in the list.

    However, I'm not sure why you see the problem you do.

  • Incoming ring Lenovo P780 volume maximize automatically,

    I have a problem with my lenovo P780. The Ring volume is maximize automatically. I put low volume, but it automatically increases. Is their any option where we can set

    I had the same problem too.
    To fix it, you must disable the mode of pocket.
    Definition of > character defining (2nd tab) > Pocket mode (1st option in the setting of character tab)

  • Automatically create checkboxes and adjust to the window

    Is there a way to automatically increase the number of checkboxes that appear in a dialog box for user input?

    That's what I'm trying to accomplish:

    • Read in an array of strings
    • Create check boxes depending on the size of the table and adapt to the window (similar to express vi)

    ThanksNAdvance

    FredFred

    You can make a custom context menu of vi, I would like to convert the string array an array of clucters where the cluster includes a checkbox and a string to double.  Then display the number of rows in the table = number of items.  Then, you can programmatically resize the window with nodes of property.

  • Why the form I created automatically t complete line down?

    I created a form with columns. People filling out the form in one of the columns, enter an x to indicate the status of the project (to come, on the target, behind, not known.) All fields are working well except one. In this special column "not known", it automatically fills all columns with a 'x '. No idea why and how can I fix it?

    In this case, make sure that your fields have a unique name. The fields with the same name will automatically have the same value.

  • How to arrange the result of the query and adding column outomatic translate


    Hello

    my need to find number of devices activated per day in the city, my data as below

    1City_2Samsung
    5City_2IPhone
    4City_2IPhone
    2City_2IPhone
    1City_2IPhone
    1Ville1Samsung
    3Ville1Samsung
    17Ville1IPhone
    12Ville1IPhone
    5Ville1IPhone
    3Ville1IPhone
    3Ville1IPhone
    6Ville1IPhone
    7Ville1IPhone
    1Ville1IPhone
    3City_3IPhone

    I need the result to be as below but not only (IPhone and Samsung) device name could be any new device like HTC or compressed, then is it possible to add a new type of device automatically in a column, once a new device type show up in devices activated daily,

    CityTotal enabled accountsIPhoneSamsung
    Ville158544
    City_213121
    City_3330

    my table as below,

    Create table test values (number count1, city varchar2 (10), device)
    VARCHAR2 (10));

    Insert into test values (COUNT1, CITY, DEVICE)
    (17, 'Ville1', 'IPhone');

    Insert into test values (COUNT1, CITY, DEVICE)
    (1, "Ville1", "IPhone");

    Insert into test values (COUNT1, CITY, DEVICE)
    (7, "Ville1", "IPhone");

    Insert into test values (COUNT1, CITY, DEVICE)
    (6, 'Ville1', 'Phone');

    Insert into test values (COUNT1, CITY, DEVICE)
    (3, 'Ville1', 'IPhone');

    Insert into test values (COUNT1, CITY, DEVICE)
    (3, 'Ville1', 'IPhone');

    Insert into test (COUNT1, CITY, DEVICE) values (1, 'city' 1, 'Samsung');

    Insert into test values (COUNT1, CITY, DEVICE)
    (3, 'Ville1', 'Samsung');

    Insert into test values (COUNT1, CITY, DEVICE)
    (12, "Ville1", "IPhone");

    Insert into test values (COUNT1, CITY, DEVICE)
    (5, "Ville1", "IPhone");

    Insert into test values (COUNT1, CITY, DEVICE)
    (1, "City_2", "IPhone");

    Insert into test values (COUNT1, CITY, DEVICE)
    (2, 'City_2', 'IPhone');

    Insert into test values (COUNT1, CITY, DEVICE)
    (4, 'Ville_2', 'IPhone');

    Insert into test values (COUNT1, CITY, DEVICE)
    (5, "Ville_2", "IPhone");

    Insert into test values (COUNT1, CITY, DEVICE)
    (1, "City_2", "Samsung");

    Insert into test values (COUNT1, CITY, DEVICE)
    (3, 'City_3', 'IPhone');

    Thank you



    Hello

    Here's a way to use the solution to askTom ( ask Tom & quot; PivotChart & quot; )  in your case:

    CREATE OR REPLACE PROCEDURE dynamic_device_pivot
    (p_cursor ON SYS_REFCURSOR
    )
    AS
    l_query VARCHAR2 (30000): = "CHOOSE the city, SUM (count1) AS total_accounts;
    BEGIN
    FOR (IN) r
    SEPARATE device select
    OF the test
    ORDER BY device
    )
    LOOP
    l_query: = l_query | REPLACE (", SUM (DECODE (device," $X$ ", count1, 0)) as $X$")
    , '$X$'
    dbms_assert.simple_sql_name (r.device)
    );
    END LOOP;

    l_query: = l_query | 'FROM test GROUP BY city ORDER BY city';
    dbms_output.put_line (l_query |) "= l_query in dynamic_device_pivot");   -For debugging only

    P_cursor OPEN FOR l_query;
    END dynamic_device_pivot;
    /
    DISPLAY ERRORS

    RC VARIABLE REFCURSOR
    EXEC dynamic_device_pivot (: rc);

    PRINTING: rc

    The output is not quite what you have posted, due to a typing error, probably:

    CITY TOTAL_ACCOUNTS IPHONE SAMSUNG PHONE

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

    City1                  58         48          6          4

    City_2                 13         12          0          1

    City_3                  3          3          0          0

  • Mapping of columns with different data type of sql teradata source target

    Hello

    I get a problem after upgrading our version of the Golden Gate to Version 11.2.1.0.13 17435036.

    Source DB: Sql Server

    Target the DB: Teradata

    We have generated the definition file and put it in the target server.

    The table structure for one of the target server table differs from the source server. Average datatype of some columns in a table is different than it is in the source.

    During replication, it throws an error that incompatibility of data type.

    Is there a keyword in Oracle Golden Gate, that we can use in parameter files to eliminate this error where Golden Gate will automatically match the columns.

    Before this upgrade version of Golden Gate in the source and target, everything worked well.

    Any help in this direction will be really appreciated.

    Bipul Singh

    Hi, ok, I knew this could be the case, but wanted to check your DDL first, but a change in the way BIT data types are stored in the path took place between versions 11.1 and 11.2.  The ILO data are coming in the target as 0x00 and 0x01, which SQL Server manages without conversion, but other targets will have to use the @NUMBIN function in your COLMAP clause to convert the BIT smallint.  And I don't actually know that the SMALLINT will map correctly, but I believe that is should.

    Here is an example:

    card dbo.XXX, target "SCHEMA". "" XXX_T0 ", colmap (usedefaults Roving_Bit=@NUMBIN (Roving_Bit)...

    You will have to do for all types of data BIT also.

  • Dynamically adjust images if FPS is increased/decreased?

    If bumping the FPS (or reduce), can it also automatically increase the amount of frames (all layers) and the length remains the same?

    Have not really increased the FPS but supposed it wouldn't. Thought that he cannot and would post prior to all the explanations/methods etc.

    The individual motion tweens can be stretched and keyframes would be distributed proportionately. So, if you had a frame 240, animation of 24 fps as a set of motion tweens, in several layers, you can select all layers and drag the end of the Tween span to reach 600 setting, set the frame rate of 60 fps, and everything would be fine.

    There are currently ways to change the size of the stage and have all the elements in the scene resize width and height, in the right places, but I don't see an automatic means to have the scale of keyframe timeline of one FPS to another.

  • How to modify the data with dynamic TableView with dynamic columns in JAVAFX

    Today, it is the demo to display the data from the CSV to the custom class without doing DAT file on tableView in JavaFX 2.0. I call this TableView as dynamic TableView because the tableview automatically manages the columns and rows.
    My research on the editable on tableView, we have a custom of the class and apply it to tableView to show that this demo is > http://docs.oracle.com/javafx/2/ui_controls/table-view.htm

    But in this case I can't do that because we don't know how many example of column with the csv file or .dat file... I want to make editable on this tableView in this case add TextField in the TableCell. How do custom class (because you don't have how column...) and so to do custom class then what thedesign of a custom for this case class?

    Could you please help me?

    It's the demo of code to display your csv or dat file in TableView

    private void getDataDetailWithDynamic() {
      tblView
    .getItems().clear();
      tblView
    .getColumns().clear();
      tblView
    .setPlaceholder(new Label("Loading..."));
      
    // @Override



      
    try {
           
    File aFile = new File(txtFilePath.getText());
           
    InputStream is = new BufferedInputStream(new FileInputStream(aFile));
           
    Reader reader = new InputStreamReader(is, "UTF-8");

           
    BufferedReader in = new BufferedReader(reader);

           
    final String headerLine = in.readLine();
           
    final String[] headerValues = headerLine.split("\t");
           
    for (int column = 0; column < headerValues.length; column++) {
                 tblView
    .getColumns().add(
                 createColumn
    (column, headerValues[column]));
           
    }

           
    // Data:

           
    String dataLine;
           
    while ((dataLine = in.readLine()) != null) {
                
    final String[] dataValues = dataLine.split("\t");
                
    // Add additional columns if necessary:
                
    for (int columnIndex = tblView.getColumns().size(); columnIndex < dataValues.length; columnIndex++) {
                      tblView
    .getColumns().add(createColumn(columnIndex, ""));
                
    }
                
    // Add data to table:
                
    ObservableList<StringProperty> data = FXCollections.observableArrayList();
                
    for (String value : dataValues) {
                     data
    .add(new SimpleStringProperty(value));
                
    }
                 tblView
    .getItems().add(data);
           
    }
      
    } catch (Exception ex) {
           
    System.out.println("ex: " + ex.toString());
      
    }


      
    for(int i=0; i<tblView.getColumns().size(); i++) {
           
    TableColumn col = (TableColumn)tblView.getColumns().get(i);
           col
    .setPrefWidth(70);
      
    }
    }

    private TableColumn createColumn(
      
    final int columnIndex, String columnTitle) {
           
    TableColumn column = new TableColumn(DefaultVars.BLANK_CHARACTER);
           
    String title;
           
    if (columnTitle == null || columnTitle.trim().length() == 0) {
                title
    = "Column " + (columnIndex + 1);
           
    } else {
                title
    = columnTitle;
           
    }


           
    Callback<TableColumn, TableCell> cellFactory = new Callback<TableColumn, TableCell>() {
           
    @Override
           
    public TableCell call(TableColumn p) {

                
    System.out.println("event cell");
                
    EditingCellData cellExtend = new EditingCellData();
                
    return cellExtend;
           
    }
      
    };

      column
    .setText(title);
      column
    .setCellValueFactory(cellFactory);
      
    return column;
    }


    Thanks for your reading.

    See this thread: Re: dynamically create columns

    This example is not editable, but to do so, simply add something like

        column.setCellFactory(TextFieldTableCell.>forTableColumn());
    

    the createTableColumn (...) method.

    Either said by the way, where did you code that you pasted in your post? It looks like in my previous post.

    Post edited by: James_D

Maybe you are looking for