How to reset the value of line number for each header

Hi all

I need to reset the line number for each header values.

create table header_table (header_value varchar2 (100));

create table line_table (header_value varchar2 (100), number line_number);

insert into header_table values ('ALAOF');

insert into header_table values ('ALAOO');

insert into line_table values('ALAOF',1);

insert into line_table values('ALAOF',2);

insert into line_table values('ALAOF',3);

insert into line_table values('ALAOF',4);

insert into line_table values('ALAOF',5);

insert into line_table values('ALAOO,6);

insert into line_table values('ALAOFO,7);

insert into line_table values('ALAOO',8);

insert into line_table values('ALAOO',9);

insert into line_table values('ALAOO',10);

insert into line_table values('ALAOO',11);

insert into line_table values('ALAOO',12);

Commit;

TABLE HEADER_:

header value

ALAOF

TRECYBEL

LINE TABLE:

header value line_number

ALAOF 1

ALAOF 2

ALAOF 3

ALAOF 4

ALAOF 5

TRECYBEL 6

TRECYBEL 7

TRECYBEL 8

TRECYBEL 9

TRECYBEL 10

TRECYBEL 11

TRECYBEL 12

But looks like I got out of line below table

LINE TABLE:

header value line_number

ALAOF 1

ALAOF 2

ALAOF 3

ALAOF 4

ALAOF 5

TRECYBEL 1 <-reset the beginning of line number with 1 with different header value

TRECYBEL 2

TRECYBEL 3

TRECYBEL 4

TRECYBEL 5

TRECYBEL 6

TRECYBEL 7

Please help me on this.

Thanks in advance.

Hello

It makes no sense to do it in PL/SQL when you can do it with SQL.

SQL is generally more efficient than PLSQL.

And can you explain why you don't want to use analytical functions?

This will update your table using a MERGE statement and an analytic function:

MERGE INTO line_table lt
USING
(
   SELECT ROWID rid, header_value, row_number() OVER(PARTITION BY header_value ORDER BY ROWNUM) rn
     FROM line_table
) src
ON (src.rid=lt.ROWID)
WHEN MATCHED THEN
   UPDATE SET lt.line_number = src.rn;

The result is less to:

HEADER_VAL LINE_NUMBER

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

ALAOF 1

ALAOF 2

ALAOF 3

ALAOF 4

ALAOF 5

TRECYBEL 1

TRECYBEL 2

TRECYBEL 3

TRECYBEL 4

TRECYBEL 5

TRECYBEL 6

TRECYBEL 7

Kind regards.

Al

Tags: Database

Similar Questions

  • How to find the value max and min for each column in a table 2d?

    How to find the value max and min for each column in a table 2d?

    For example, in the table max/min for the first three columns would be 45/23, 14/10, 80/67.

    Thank you

    Chuck,

    With color on your bars, you should have enough experience to understand this.

    You're a loop in the table already.  Now you just need a function like table Max and min. loop.  And you may need to transpose the table 2D.

  • How to reset the value of a list of entry of null values

    Hello

    Jdev 12.1.3.0

    How to reset the value of a list of entry of null values

    Thank you

    AR

    Place this code in your ViewRowImpl (base) class and use it when you need to reset _all attributes applied by LOV

    @Cvele: in fact, this will happen "by design" when you set the attribute which has attached lov to null, so there is no need of additional code.

    See also this blog: binary: prevent the execution of query unwanted in British Colombia ADF when used in Non - UI applications

    My previous answer is more related to this approach:

    DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding iterator = bindings.findIteratorBinding("IteratorName");
    Row r = iterator.getCurrentRow();
    r.setAttribute("SomeAttrib", null);
    

    Dario

  • OfficeJet 8620: How to reset the touchscreen scanning identification number

    Each email address on the option of scanning to e-mail has a security of the PIN number.  At least one of the users has entered his PIN code incorrectly and that you don't remember.  How to reset the PIN code or remove the users e-mail address?

    Hello @Harbourne,

    Welcome to the HP support forums.

    I understand that you want to reset a pin code or delete an e-mail address of the analysis to the function of e-mail on your Officejet 8620.  I would like to help.

    There are two different versions of scanning to e-mail.

    The first is a related software. You want to reach scan then scanning to email to access this version.

    You need to reset this version from a connected computer that the software is installed or printers EWS (embedded Web server).

    The other version is accessible by the touching Apps can Scan to e-mail.

    This version may be invited for a reset of the front PIN.

    This version will allow no allows you to delete emails on both.

    It's all or nothing.

  • How to reset the value of selectOneChoice when it is af:table

    12.1.3 Jdev

    I need to reset the selectOneChoice of the first empty value when you click a Refresh"" button.  The selectOneChoice is located in one of the columns of af: table.  I tried to reset by getting the selectOneChoice component and set the value to «»   Please see the snipplet of code for more details. However if the selectOneChoice is not within the af: table, then using the same way to reset works!

    in jspx

    "< af:commandToolbarButton id ="ctb15"icon="/images/refresh_qualifier.png "shortDesc ="Refresh"action =" #{viewScope.backing_requestOverview.onRefresh} "partialSubmit ="false"> < / af:commandToolbarButton >"

    < af:table value = "#{bindings." ItasTaskAssigneesListVO1.collectionModel}.

    var = "row".

    lines = ' #{bindings. " ItasTaskAssigneesListVO1.rangeSize}.

    emptyText = "#{bindings." ItasTaskAssigneesListVO1.viewable? "{'No data to display.': 'Access Denied.'}".

    fetchSize = "#{bindings." ItasTaskAssigneesListVO1.rangeSize}.

    rowBandingInterval = '1' id = 't4 '.

    styleClass = "AFStretchWidth."

    columnStretching = "column: c1.

    rowSelection = 'single '.

    selectionListener = "#{bindings." ItasTaskAssigneesListVO1.collectionModel.makeCurrent}.

    selectedRowKeys = ' #{bindings. " ItasTaskAssigneesListVO1.collectionModel.selectedRow} ">"

    < af:column id = "c6" headerText = "Action".

    rendering = "#{bindings." EventLevelTypeCode.inputValue! ' = ' 10 G ' & amp; & amp;! viewScope.backing_requestOverview.isReadOnly} ">"

    < af:selectOneChoice id = "soc2".

    autoSubmit = 'true '.

    valueChangeListener = "#{viewScope.backing_requestOverview.onChangeMyPendingAction} '"

    Disabled = "#{!}" line. TaskActionEnabled} ">"

    < f: selectItems value = "#{backing_requestOverview.actionsMap [row." StatusUid]} ".

    ID = "si3" / >

    < / af:selectOneChoice >

    < / af:column >

    < / af:table >

    < af:selectOneChoice id = "soc222" >

    < af:selectItem label = "Complete"

    value = "COMPLETE"

    ID = "si4" / >

    < af:selectItem label = "Assign".

    value = "ASSIGN".

    ID = "si555" / >

    < / af:selectOneChoice >

    Java bean:

    public String onRefresh() {}

    RichSelectOneChoice actionDropdown = (RichSelectOneChoice) JSFUtils.findComponentInRoot ("soc2");

    actionDropdown.setValue("");

    RichSelectOneChoice actionDropdown2 = (RichSelectOneChoice) JSFUtils.findComponentInRoot ("soc222");

    actionDropdown.setValue("");

    If (actionDropdown! = null) {}

    AdfFacesContext.getCurrentInstance () .addPartialTarget (actionDropdown);

    }

    If (actionDropdown2! = null) {}

    AdfFacesContext.getCurrentInstance () .addPartialTarget (actionDropdown2);

    }

    }

    Please notify.

    Thank you

    -Mina

    The root of the problem remains the same. As long as you don't set a value for each of SPC property that you use, you cannot reset them without running into trouble.

    An soc within a table must be stored too, you must provide the form of attribute value each of them. If you only use a soc, to distinguish the action to take, it belongs in the table.

    Timo

  • ListView MAF 2.1 how to get the value of line selection

    Hi all

    I'm trying to get the select line of a page with a listview amx

    to pass values of line as a parameter to the detail page

    which to get data from web service, but with links

    I always get the first value in the line of my list view.

    How can I refresh the values?

    Is - this java is better than the binding for this case?

    Can you help me please?

    Thanks for your help

    You can set the value of the selected line in a variable pageFlowScope and pass it to the method on the next page.

    Something similar to this:

    https://blogs.Oracle.com/Shay/entry/adf_mobile_update_through_web

  • How to retrieve the values of a number of column by column in pl sql

    I wanted to know how can I retrieve the values of a column just in number and not the name of the column.

    user10989720 wrote:
    I need exactly this kind of thing.

    I am retrieving the name of the column from all_tab_columns and under this column name can I retrieve values using any kind of query sub.

    Select column_name
    from all_tab_columns
    where table_name = 'QUOTE_HEADERS_EXT' and
    column_id = 58

    You're still not understanding. You need to do if you want to get the values of the table dynamically.

    Either like this:

    SQL> create or replace type t_colval is table of varchar2(4000);
      2  /
    
    Type created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE OR REPLACE FUNCTION get_column(p_sql IN VARCHAR2, p_column_no NUMBER) RETURN t_colval PIPELINED IS
      2    v_finaltxt  VARCHAR2(4000);
      3    v_v_val     VARCHAR2(4000);
      4    v_n_val     NUMBER;
      5    v_d_val     DATE;
      6    v_ret       NUMBER;
      7    c           NUMBER;
      8    d           NUMBER;
      9    col_cnt     INTEGER;
     10    f           BOOLEAN;
     11    rec_tab     DBMS_SQL.DESC_TAB;
     12    col_num     NUMBER;
     13  BEGIN
     14    c := DBMS_SQL.OPEN_CURSOR;
     15    DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
     16    d := DBMS_SQL.EXECUTE(c);
     17    DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
     18    FOR j in 1..col_cnt
     19    LOOP
     20      CASE rec_tab(j).col_type
     21        WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
     22        WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
     23        WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
     24      ELSE
     25        DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
     26      END CASE;
     27    END LOOP;
     28    LOOP
     29      v_ret := DBMS_SQL.FETCH_ROWS(c);
     30      EXIT WHEN v_ret = 0;
     31      v_finaltxt := NULL;
     32      CASE rec_tab(p_column_no).col_type
     33        WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,p_column_no,v_v_val);
     34        WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,p_column_no,v_n_val);
     35                    v_v_val := to_char(v_n_val);
     36        WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,p_column_no,v_d_val);
     37                    v_v_val := to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS');
     38      ELSE
     39        DBMS_SQL.COLUMN_VALUE(c,p_column_no,v_v_val);
     40      END CASE;
     41      PIPE ROW (v_v_val);
     42    END LOOP;
     43    DBMS_SQL.CLOSE_CURSOR(c);
     44* END;
    SQL> /
    
    Function created.
    
    SQL> select * from table(get_column('select * from emp',1));
    
    COLUMN_VALUE
    ---------------------------------------------------------------------------------------------------------------
    7369
    7499
    7521
    7566
    7654
    7698
    7782
    7788
    7839
    7844
    7876
    7900
    7902
    7934
    
    14 rows selected.
    
    SQL> select * from table(get_column('select * from emp',2));
    
    COLUMN_VALUE
    ---------------------------------------------------------------------------------------------------------------
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    
    14 rows selected.
    
    SQL>
    

    Or like this:

    SQL> create or replace type t_colval is table of varchar2(4000);
      2  /
    
    Type created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE OR REPLACE FUNCTION get_column(p_table IN VARCHAR2, p_column_no NUMBER) RETURN t_colval PIPELINED IS
      2    v_column_name VARCHAR2(30);
      3    v_rc          SYS_REFCURSOR;
      4    v_val         VARCHAR2(4000);
      5  BEGIN
      6    SELECT column_name
      7    INTO   v_column_name
      8    FROM   user_tab_columns
      9    WHERE  column_id = p_column_no
     10    AND    table_name = UPPER(p_table);
     11    OPEN v_rc FOR ('SELECT '||v_column_name||' FROM '||p_table);
     12    LOOP
     13      FETCH v_rc INTO v_val;
     14      EXIT WHEN v_rc%NOTFOUND;
     15      PIPE ROW(v_val);
     16    END LOOP;
     17    CLOSE v_rc;
     18* END;
    SQL> /
    
    Function created.
    
    SQL> select * from table(get_column('EMP',2));
    
    COLUMN_VALUE
    ----------------------------------------------------------------------------------------------------------------
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    
    14 rows selected.
    
    SQL>
    
  • How to upgrade the value of line in a report by using the line selector (check box)

    Hello

    I have a requirement where I need to make PLSQL update process on a specific line in my report.
    Based on the line selector (marked) the plsql process update on the values of the selected line.

    I have to update status of the employee selected as 3.
    But regardless of the choice of line selector, juice processing SRM application in a sequence that is., this is row selected, application takes the first line and updates the status.

    My update process from looks like this:

    BEGIN

    BECAUSE me in 1... apex_application.g_f01. COUNTY - checkbox
    LOOP
    If apex_application.g_f01 (i) only IS NOT NULL then - box marked
    insert into values TEMP_T (apex_application.g_f03 (i), V ('APP_USER')); -f03:Deptno
    update status set Table_x = 3 where deptno in (select deptno from TEMP_T where rtrim (lower (apex_user)) = rtrim (lower (V ('APP_USER')));
    delete from TEMP_T where rtrim (lower (apex_user)) = rtrim (lower (V ('APP_USER')));
    end if;
    END LOOP;
    END;

    Once the user selects the line selector, application needs to update the status of this particular emp 3 in Table_X.
    Currently, if I select a line, using the line selection box, my update process changes the status of the first record line. If I select three rows, then my first three rows updated.
    So I have to update the particular line or selected using the selector (checkbox) row lines

    If you could help me solve this question would be really appreciated.

    Thank you
    Vijay

    This example shows how to use checkboxes in tabular form:

    http://HTMLDB.Oracle.com/pls/OTN/f?p=31517:95

    Denes Kubicek
    ------------------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    ------------------------------------------------------------------------------

  • How to reset the State of line

    Hi all
    Attribute in my current line made some changes, I don't want to not that changes update the database sometimes, but I have to commit the transication because there's a few other vo should be updated to the database. How do I do with this case?

    Bese cordially,

    Peter

    Peter,

    Create 02:00. Fix the table of the VO in the first AM & rest in the second. Engage only the second AM. So, that will commit all changes made on the first AM.

    Kind regards
    GYAN

  • In Acrobat Reader MS how to stop the 'tools' pane to open for each document that I discover?

    It is such a pain in the *! Everytime I open a PDF document (even just to download a bill or a technical guide) I have to close this ridiculous Tools pane! How to you turn off the ToolPane permanently for all documents? There must be a setting in preferences (although I can't find it)? If it isn't please add one, Adobe!

    Hi DexterG,

    I'm sorry for the inconvenience caused.  Many of our customers have reported the same problem in Acrobat Reader ms and it's supposed to be fixed in the next update.

    As a work around you can use the read (Ctrl + H) mode option that displays only documents.

    Kind regards

    Nicos

  • How to access the settings from inside, one for each group?

    Hi all
    BI Publisher, Windows 10.1.3.21
    BI Oublisher 10.1.3.21 Office
    MS Word 2007
    <?xml version="1.0" encoding="UTF-8"?>
    <DOCUMENT>
        <DATE>19-MAR-09</DATE>
        <USER_NAME>DEV</USER_NAME>
        <APP_ID>122</APP_ID>
        <APP_NAME>APEX - Application Builder</APP_NAME>
        <TITLE>FORECAST</TITLE>
        <P23_DATE>08-02-2009</P23_DATE>
        <P23_PROPERTY>ACME</P23_PROPERTY>
        <P23_DATE1>09-02-2009</P23_DATE1>
        <P23_DATE2>10-02-2009</P23_DATE2>
        <P23_DATE3>11-02-2009</P23_DATE3>
        <P23_DATE4>12-02-2009</P23_DATE4>
        <P23_DATE5>13-02-2009</P23_DATE5>
        <P23_DATE6>14-02-2009</P23_DATE6>
        <P23_DATE7>15-02-2009</P23_DATE7>
        <REGION ID="0">
            <ROWSET>
                <ROW>
                    <OUTLET>SHOP_1</OUTLET>
                    <TOTAL_ROOMS>12</TOTAL_ROOMS>
                    <RM_TYPE>SPA</RM_TYPE>
                    <D1>0</D1>
                    <D2>0</D2>
                    <D3>0</D3>
                    <D4>0</D4>
                    <D5>0</D5>
                    <D6>0</D6>
                    <D7>0</D7>
                </ROW>
    
        </REGION>
    </DOCUMENT>
    I'm trying to replace the D1, D2,... with P23_DATE1, P23_DATE2... without success.
    Had a consolidation on hold.
    Can access the settings, if it is outside the grouping. Looks like one out of the problem of the scope.
    Not found similar conditions in the model BI demo and samples.
    Appreciate any help.

    Thanks in advance
    Zack

    Hello

    use inside your loop to reference your settings.

    concerning
    Rainer

  • How to reset the param value

    Hello

    In MY search page, I'll put a value of param (FormValue) when create button is pressed and based on that value I wrote code in my application to process home page.


    In my main page, I have the update button when I press this button Iam trying to reset the value of param (FormValue) to null...

    I wrote the code so that when below Update button and Iam trying to SOP the value, but it's not methoeds.



    in my searchpageCO

    HashMap params = new HashMap();
    params.put ("FormValue", "Y");

    In my CreatePageCO:

    HashMap params = new HashMap();
    params.put ("FormValue", null);

    When I tried to SOP even after the null. his rest, printing the form "Y".


    can someone plz help me im trying the approach is correct or not?

    Thank you
    Mahesh

    Try like this

    if("Y".equals(fromval1))
    {
    }
    

    Thank you
    AJ

  • How to reset the null to a type value?

    Hello

    Do I need advice to reset the value of a type or if I have to reset the null value for a type?

    I use the same variable for a query of SUPPRESSION of difference. If it is OK?

    Please advice-

    Thank you in advance.
    PROCEDURE pr_type_example
       IS
    
          TYPE my_type_1 IS TABLE OF table1.col_1%TYPE;
    
          v_type_one                 my_type_1;
    
    begin
    
    SELECT table1_id
          BULK COLLECT INTO v_type_one
            FROM table1
           WHERE dt_name = 'ABC';
    
          FORALL i IN my_type_1.FIRST .. my_type_1.LAST
             DELETE FROM table2
                   WHERE table2_id = my_type_1 (i);
    
    
    SELECT table1_id
          BULK COLLECT INTO v_type_one
            FROM table1
           WHERE dt_name = 'XYZ';
    
          FORALL i IN my_type_1.FIRST .. my_type_1.LAST
             DELETE FROM table3
                   WHERE table3_id = my_type_1 (i);
    
    ...
    ..
    
    end pr_type_example;

    COLLECTION in BULK automatically deletes data collection before you retrieve the data in the variable.

  • Conditional display based on the value of line

    I have a report table with several lines on it.  I need to post a link to another page of user action if a value in the line corresponds to an attribute of the user's role, so they can act on the item.  Other display or update the document would not be able to run the link.

    The logic of nickname would go something like this:

    If user_role = role_this_line_item then

    display approval_link

    on the other

    Hide approval_link

    end if

    I know how to write pl/sql to return to the display of the correct state of true/false, but I can't find out how to reference the value on the display line.  I tried: role_this_line_item, role_this_line_item, #role_this_line_item # and none of them return one value other than false.  How to refer to an attribute on the current line of the decision to hide/show correct?

    Al

    Al Wondra says:

    I use V4.2.6 Apex in local installation of Oracle 11 g XE.  I tried with IE, Firefox and Chrome.  None has the conditional display.

    The report is a standard report created using the Apex report wizard.  I'm one of the columns (the ID of the line) changing to conditionally a link to a page to data entry.  I only need one line at a time to be the active link.  No line should have a link, if the user is not the role is required to perform this action.

    You have described my question exactly, it seems, that the conditional rendering is applied to the entire column.  I need that it is applied to specific lines.  Some lines (1) will be the active link.  All other lines does not display the link.  Is this possible?

    If you want the value of the ID to display for each row returned by the report, but only rendered as a link, if the condition is true? The values used in the State come "role_this_line_item" seems to be a value of a column in the report. "User_role" is also a column value?

    The simplest option is to modify the column attribute display as for the Standard report columnID column and conditionally generate the link in the report query:

    select
        ...
      , case
          when user_role = role_this_line_item
          then
            'where DATA_ENTRY is the 'data entry page' target number or alias of the page.

  • LOV in richeTableau resets the value after the deletion of rows from the table

    Hello. I'm on 11g R2

    I have a table with columns in the box and a button in the toolbar that removes the lines checked

    I have build it based on the following article in her string code

    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/index-101235.html


    When I run the "delete" button I execute the following code (taken as is article)


    public void deleteSelectedRows() {}

    create a second line, the value do not affect all lines

    used in ADF

    Set of rows duplicateRowSet = this.createRowSet ("duplicateRowSet");

    first row to avoid "the attempt to access the value of lines."

    exception line was dead.

    duplicateRowSet.first ();

    retrieve the current row of the table for after

    re-running the VO

    Line currentRow = this.getCurrentRow ();

    Boolean currentRowDeleted = false;

    get all rows that have the transoent attribute

    "MarkForDelete' set to true

    Row [] rowsToDelete =

    duplicateRowSet.getFilteredRows ("MarkedForDelete", true);

    If (rowsToDelete.length > 0) {}

    run only throizgh this code, if there is something to

    delete

    for (line rw: rowsToDelete) {}

    If the row is marked as the current in VO, ts value

    Boolean flag

    If (rw.getKey () .equals (currentRow.getKey ())) {}

    currentRowDeleted = true;

    }

    remove the line - do not yet commit

    RW. Remove();

    }

    rerun VO

    this.executeQuery ();

    reset the current line if it has not been removed

    If (! currentRowDeleted) {}

    this.setCurrentRow (currentRow);

    }

    duplicateRowSet.closeRowSet ();

    }

    }

    "MarkedForDelete" is a transient attribute used to mark the line delete

    The lines are removed very well.

    The problem is with lines that I do not delete.

    For example I LOV column. I chose the value LOV in a few lines, and after that choose to delete several lines (not the same lines where I modified the LOV) but some other lines.

    After I click "delete", the lines that I marked to remove deleted indeed, but the value of the LOV in other rows (I have not scored for delete) are disabled.

    How to preserve value LOV so it will remain also after I deleted some lines?

    P.S. I've tried autosubmit = "true" - it did not help

    It is expected because I see that you rerun the query.

    Once you re - run, it retrieves from the database again. Thus, your values are lost because they are not posted.

    I don't think that run query is necessary, try to have a programmatic part trigger on the table after you remove all of the lines.

    Thank you

    Alisson.

Maybe you are looking for