Select the row of the table using radiobutton

Dear all,

I want to have a column that will a radiobutton and button in the page. When the user clicks the button, so I want a task by taking the data from the selected row. I kept the rows in the table to a single selection. When the user selects the row (without selecting the radiobutton control), then I can also get the current line and get the data from that. But when the user presses the button (in its actionlistener) then how can I know if the user has selected the radiobutton control or not in the current line.
Can someone give me guidance in this problem...

Kind regards
David

JDeveloper 11.1.1.4.0

Santosh,
where is the property of the value of the bound radio button for? It is an attribute of the line? If so you can access the value via the current line.

Timo

Tags: Java

Similar Questions

  • Select the table using script

    Hello

    The threshold of all selected tables in the document. I need to select a first table, then on next table etc...

    myTable var = app.activeDocument.tables.everyItem () .getElements ();

    Someone help me?

    I am again for the script. What should I do for this type of orders InDesign as I write scripts?

    Kind regards

    Vincent

    Try this,

    var myTable = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    alert(myTable.length)//no. of tables in a document
    for(var i=0; i
    

    Vandy

  • Trying to create the table using Clause any Union with Select multiple stmts

    The motion seeks to get the substring of the value to for example.
    If the value is * ASA 2 * then so do ASA
    where as if the value is * 1.5 TST * it sholud come as TST as wise for others too.
    I am trying to execute stmt SQL written but in error as below:

    * ' ORA-00998 must appoint this expression with the alias column 00998.00000 - must appoint this expression with the column alias. "

    CREATE TABLE TEST_CARE AS
    (
    SELECT row_id, old_care_lvl, SUBSTR(old_care_lvl,3), len test_care_lvl FROM
    WHERE LENGTH (old_care_lvl) = 5
    UNION ALL
    SELECT row_id, old_care_lvl, SUBSTR(old_care_lvl,3), len test_care_lvl FROM
    WHERE LENGTH (old_care_lvl) = 7
    UNION ALL
    SELECT row_id, old_care_lvl, SUBSTR(old_care_lvl,3), len test_care_lvl FROM
    WHERE LENGTH (old_care_lvl) = 14
    UNION ALL
    Row_id SELECT, old_care_lvl, SUBSTR (old_care_lvl, 3), LEN test_care_lvl
    WHERE LENGTH = 7 AND old_care_lvl (old_care_lvl) = "Regular."
    );

    I want to create the table using the above given the multiple selection by using the Union ALL clause, but trying to create run query error like "ORA-00998 must appoint this expression with the alias column 00998.00000 - must appoint this expression with the column alias.

    Please guide me how to approach to solve this problem.
    Thanks in advance.

    Try this->

    CREATE TABLE TEST_CARE
    AS
      select *
      from (
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =5
              UNION ALL
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =7
              UNION ALL
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =14
              UNION ALL
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3),LEN FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =7 AND old_care_lvl ='Regular'
          );
    

    N.B.: Not tested...

    Kind regards.

    LOULOU.

  • How to insert image from mysql into the table using php and create the checkbox in the table?

    How can I insert image from mysql into the table using php and create the checkbox for each data as a vote? Here is my code...

    WELCOME

    connect_error) {die ("connection failed:".)} $conn-> connect_error); } $sql = "SELECT no, Calon, ID, of course, the Image OF THE candidates." $result = $conn-> Query; If ($resultat-> num_rows > 0) {echo ' '; export data of each line while ($row = $result-> fetch_assoc()) {"echo"}}
    NO Candidate INFO Vote
    " . $row ["no"]. "-" . $row ["Calon"]. "
    -" . $row ['ID']. "
    -" . $row ['class']. "
    "; } ECHO ' ' ;} else {echo '0 results' ;} $conn-> close();?} >

    hope someone can help me because I am a newbie in this program... need to finish this project... Thank you.

    If you have saved the file name in the database, it's pretty simple.

    echo '' . $row['description'] . '';
    

    Is the same for the box:

    echo '';
    

    If you have saved the image file in the database, it is much more complicated. I recommend you store only the file name in the database.

  • How to know the tables used in packages of a schema.

    How to know the tables used in packages of a pattern that I have connected.

    SELECT DISTINCT referenced_owner, referenced_name

    Of all_dependencies

    Owner WHERE = "MY_USER_NAME".

    AND type ('PACKAGE', 'BODY of PACKAGE')

    AND referenced_type = 'TABLE '.

  • Select the tables to Jdeveloper (master / detail)

    Hi, I need to add tables in Jdeveloper, the conecction to the database is allowed. But my problem is that I Don t know to select the tables and details of how master-.

    Thank you, the Colombia.

    you use what version of JDeveloper. ? If 11g, check this blog:

    http://andrejusb.blogspot.com/2009/03/ADF-faces-rich-client-popup-and-master.html

    concerning

  • CS6, "Select unused shades" is to select the samples used.

    In Illustrator CS6, "Select unused shades" is to select the samples used. I'm doing something wrong or is this a bug?

    I can't reproduce this in CS6 (Cloud, 16.2.1). version

    Maybe someone can check in 16.0.4 (?) so the problem can be reproduced.

    You can check if you updated to the latest version available.

  • The table used to run very quickly

    I read about 22000 records of weak financial data in a graph of candel stick. The table used to run very quickly, but now it works slow Koala after some small changes. Ideas of probable causes?

    I figured out that the disabledDays was originally the slow almost 10 times slower

    disabledDays = "{offDays}.

  • 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

  • How can I get the number of rows in the table using Sunopsis API target in ODI 10 g?

    Hi guys,.

    In fact, I want to send an alert message as soon as the interface is run from a package. I've included alert OdiSendMail that sends an email once the interface is running.

    Could someone please tell how to get the number of rows inserted into the table the Sunopsis API target.

    I tried to use < % = odiRef.getNbRows () % >, but this has not worked for me. Since I am a beginner, could you please help out me

    This is my mail to send ODI format

    "The population of data managed to < % = odiRef.getSysDate () % >

    Total of lines in the target table is: < - need an API code-> "


    Kind regards

    Clinton

    Published by: LawrenceClinton on February 25, 2013 20:53

    Hello

    Create the project with details below variable

    Nom_de_variable: Total_Row_Count

    Type of variable: Variable discount

    Definition tab:
    Data type: digital
    Action: No persistent

    Refresh the tab:
    Schema: provide the schema of your repository to work and be

    SELECT log.nb_row
    THE journal of snp_step_log, snp_scen_step step
    WHERE log.nno = step.nno
    AND step.scen_no = (SELECT scen_no FROM snp_scen_step WHERE step_name='<%=odiRef.getPrevStepLog ('STEP_NAME") % > ')
    AND log.sess_no = '< % = odiRef.getSession ("SESS_NO") % >' code at low
    AND step.step_name = ' < % = odiRef.getPrevStepLog ("STEP_NAME") % > '

    Note: add this variable after the stage of interface in your package (after the interface anywhere you can place), you can add this variable before ODISendEmailNotification in your package

    call this varciable * #Total_Row_Count * in the Notification of ODISendEmail

    for example :

    Data has been fulfilled successfully in < % = odiRef.getSysDate () % >
    Total no of lines filled are: * #Total_Row_Count *

    it will work

    cordially,
    Phanikanth

    edited by: Phanikanth on February 28, 2013 01:13

    edited by: Phanikanth on February 28, 2013 01:14

  • Problem updating multiple rows in the table using subquery

    Hi everyone, I can't update multiple lines with a subquery. Here is the configuration:
    create table mytable (
    col_a number primary key,
    col_b number,
    col_c number,
    col_d number);
    
    insert into mytable values (1 ,1,1,15);
    insert into mytable values (2 ,1,2,7 );
    insert into mytable values (3 ,1,3,11);
    insert into mytable values (4 ,1,4,23);
    insert into mytable values (5 ,1,5,14);
    insert into mytable values (6 ,2,1,50);
    insert into mytable values (7 ,2,2,41);
    insert into mytable values (8 ,2,3,13);
    insert into mytable values (9 ,2,4,12);
    insert into mytable values (10,2,5,19);
    insert into mytable values (11,3,1,10);
    insert into mytable values (12,3,2,92);
    insert into mytable values (13,3,3,81);
    insert into mytable values (14,3,4,17);
    insert into mytable values (15,3,5,66);
    insert into mytable values (16,4,1,54);
    insert into mytable values (17,4,2,41);
    insert into mytable values (18,4,3,22);
    insert into mytable values (19,4,4,24);
    insert into mytable values (20,4,5,17);
    For this example, by using an update statement (or merge if this is better), I mean set values for col_d where col_b = 3 equal to that of the col_d where col_b = 1 and col_c equal between them. Results should resemble the following after the update:
    col_a col_b col_c col_d
    1     1     1     15
    2     1     2     7
    3     1     3     11
    4     1     4     23
    5     1     5     14
    6     2     1     50
    7     2     2     41
    8     2     3     13
    9     2     4     12
    10    2     5     19
    11    3     1     15
    12    3     2     7
    13    3     3     11
    14    3     4     23
    15    3     5     14
    16    4     1     54
    17    4     2     41
    18    4     3     22
    19    4     4     24
    20    4     5     17
    I see her there within my reach using this query, where I want to put b_col_d = a_col_d, but miss me something, this query returns too many rows when it is used in the update statement.
    select * from (
      select col_a as a_col_a, col_b as a_col_b, col_c as a_col_c, col_d as a_col_d
      from mytable
      where col_b = 1
      ) a, (
      select col_a as b_col_a, col_b as b_col_b, col_c as b_col_c, col_d as b_col_d
      from mytable
      where col_b = 3
      ) b
    where a.a_col_c = b.b_col_c
    Update column_d set mytable = (select? where?)

    Can someone help me get there? I use 10 gr 2.

    Thank you!
    Mark

    I hope that's what you're looking for:

    SQL > UPDATE mytable myt1
      2  SET    col_d = ( SELECT myt2.col_d
      3                   FROM   mytable myt2
      4                   WHERE  myt2.col_b = 1
      5                   AND    myt1.col_c = myt2.col_c
      6                 )
      7  WHERE  col_b = 3
      8  AND    EXISTS
      9         ( SELECT NULL
     10           FROM   mytable myt2
     11           WHERE  myt2.col_c = myt1.col_c
     12         )
     13  ;
    
    5 rows updated.
    
    SQL > SELECT * FROM mytable ORDER BY col_a;
    
                   COL_A                COL_B                COL_C                COL_D
    -------------------- -------------------- -------------------- --------------------
                       1                    1                    1                   15
                       2                    1                    2                    7
                       3                    1                    3                   11
                       4                    1                    4                   23
                       5                    1                    5                   14
                       6                    2                    1                   50
                       7                    2                    2                   41
                       8                    2                    3                   13
                       9                    2                    4                   12
                      10                    2                    5                   19
                      11                    3                    1                   15
                      12                    3                    2                    7
                      13                    3                    3                   11
                      14                    3                    4                   23
                      15                    3                    5                   14
                      16                    4                    1                   54
                      17                    4                    2                   41
                      18                    4                    3                   22
                      19                    4                    4                   24
                      20                    4                    5                   17
    
    20 rows selected.
    

    Thank you very much for providing the sample data in a format that is easy to consume form, as well as the expected results.

  • SQL with the Table using nested

    Hello

    Please help how to do that thing

    I have a nested table of object type

    create or replace type a1 as an object

    (

    a number,

    b varchar2 (30),

    VARCHAR2 (30) region

    );

    create table a1 type a1_array s;

    declare

    v_a1 a1;

    v_a1_array a1_array:=a1_array();

    Start

    v_a1 = a1 (1, '1', 'AUS');

    v_a1_array. EXTEND;

    v_a1_array (1): = v_a1;

    v_a1 = a1 (2, '2', 'AUS');

    v_a1_array. EXTEND;

    v_a1_array (2): = v_a1;

    v_a1 = a1 (3, '3', 'NAM');

    v_a1_array. EXTEND;

    v_a1_array (3): = v_a1;

    end;

    Now, I v_a1_array have 3 row 2 with region AUS and the other with NAM region.

    SQL help can I get lines only "AUS" and look in the TABLE OF TYPE v_a1_array (using Where clause and functions (Table))

    Any help will be much appreciated. Please help. I have Oracle 11g

    Thank you

    I hope that you are looking for this.

    pretend like your excel temp (with clause)

    v_a2 - is a type of a1_array

    SQL > select * from v version $;

    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE Production 11.2.0.2.0
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    SQL > DROP TYPE a1_array;

    Type fell.

    SQL > DROP TYPE a1;

    Type fell.

    SQL > CREATE or REPLACE TYPE a1 AS OBJECT
    2 (a NUMBER, b VARCHAR2 (30), region VARCHAR2 (30));
    3.

    Type of creation.

    SQL > CREATE TYPE a1_array IS TABLE of a1;
    2.

    Type of creation.

    SQL > DECLARE
    v_a1 2 a1_array;
    3 v_a2 a1_array;
    4 BEGIN
    5 WITH temp
    6 AS (SELECT 1 a, 1 b, "AUS" AS region FROM DUAL
    7 UNION ALL
    8. SELECT 2 AS a, 2 b, "AUS" AS region FROM DUAL
    9 UNION ALL
    10. SELECT 3 a, b '3', 'NAM' AS region OF DOUBLE)
    11. SELECT a1 (x.a, x.b, x.region)
    In BULK 12 COLLECT IN v_a1
    Temp 13 x;
    14
    15 SELECT a1 (x.a, x.b, x.region)
    In BULK 16 COLLECT IN v_a2
    TABLE (v_a1) 17 x
    18 WHERE x.region = 'NAM ';
    19
    20
    21 FOR I IN 1... v_a2. COUNTY
    22 LOOP
    (23) DBMS_OUTPUT.put_line
    24 v_a2 (i) .a | '-' || v_a2 (i) .b | '-' || v_a2 (i) .region);
    25 END OF LOOP;
    26 END;
    27.
    3-3-NAM

    PL/SQL procedure successfully completed.

    SQL > spool off;

  • Build the value of 100 mb of data in the table using the loop

    DB version: 11.2

    How can I create about 100 MB of test data in a table using minum number of records.
    If I use the below for loop. It takes 100,000 records to fill only 2 MB.
    SQL> create table a2 (mynum1 number, mynum2 number);
    
    Table created.
    
    begin
    for i in 1..100000 loop
        insert into a2 values(i,i*2);
    end loop;
    end;
    
    
    select segment_name, bytes/1024/1024 MB from dba_segments where segment_name = 'A2' AND owner='SCOTT'
    
    
    SEGMENT  BYTES/1024/1024
    -------- ---------------
    A2                     2

    Hello

    Is that what you are looking for?

    SQL> CREATE TABLE tbl1(c1 CHAR(1024));  -- ~1KB per row
    
    Table created.
    
    Elapsed: 00:00:00.00
    SQL> INSERT /*+ APPEND */ INTO tbl1 SELECT 'X' FROM dual CONNECT BY LEVEL < 100000; -- 100K rows * 1KB = 100MB + some additional overhead
    
    99999 rows created.
    
    Elapsed: 00:00:13.02
    SQL> SELECT bytes/1024/1024 MB FROM user_segments WHERE segment_name = 'TBL1';
    
            MB
    ----------
        113.75
    

    Lukasz

  • Problem with the creation of the table using the parallel Council DEC

    Hello

    We have a database table (CARDS_TAB) with the 1,083,565,232 lines and has created a replica table called T_CARDS_NEW_201111. But the count in the new array is 1,083,566,976 the difference is row of 1744. I have no idea how the new table can contain more lines compared to the original table.
    Oracle version is 11.2.0.2.0.

    The two head of table were taken after creating the table. Script that was used to create the replica table is:
    CREATE TABLE T_CARDS_NEW_201111
    TABLESPACE T_DATA_XLARGE07
    PARTITION BY RANGE (CPS01_DATE_GENERATED)
    SUBPARTITION BY LIST (CPS01_CURRENT_STATUS)
    SUBPARTITION TEMPLATE
      (SUBPARTITION T_NULL VALUES (NULL),
       SUBPARTITION T_0 VALUES (0),
       SUBPARTITION T_1 VALUES (1),
       SUBPARTITION T_3 VALUES (3),
       SUBPARTITION T_OTHERS VALUES (DEFAULT)
      )
    (
      PARTITION T_200612 VALUES LESS THAN (TO_DATE(' 2007-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        TABLESPACE T_DATA_XLARGE07
      ( SUBPARTITION T_200612_T_NULL VALUES (NULL)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_200612_T_0 VALUES (0)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_200612_T_1 VALUES (1)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_200612_T_3 VALUES (3)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_200612_T_OTHERS VALUES (DEFAULT)    TABLESPACE T_DATA_XLARGE07 ),
      PARTITION T_200701 VALUES LESS THAN (TO_DATE(' 2007-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        TABLESPACE T_DATA_XLARGE07
      ( SUBPARTITION T_200701_T_NULL VALUES (NULL)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_200701_T_0 VALUES (0)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_200701_T_1 VALUES (1)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_200701_T_3 VALUES (3)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_200701_T_OTHERS VALUES (DEFAULT)    TABLESPACE T_DATA_XLARGE07 )
    .
    .
    .
    .
    .
      PARTITION T_201211 VALUES LESS THAN (TO_DATE(' 2012-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        TABLESPACE T_DATA_XLARGE07
      ( SUBPARTITION T_201211_T_NULL VALUES (NULL)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_201211_T_0 VALUES (0)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_201211_T_1 VALUES (1)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_201211_T_3 VALUES (3)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_201211_T_OTHERS VALUES (DEFAULT)    TABLESPACE T_DATA_XLARGE07 ),
      PARTITION T_201212 VALUES LESS THAN (TO_DATE(' 2013-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        TABLESPACE T_DATA_XLARGE07
      ( SUBPARTITION T_201212_T_NULL VALUES (NULL)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_201212_T_0 VALUES (0)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_201212_T_1 VALUES (1)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_201212_T_3 VALUES (3)    TABLESPACE T_DATA_XLARGE07,
        SUBPARTITION T_201212_T_OTHERS VALUES (DEFAULT)    TABLESPACE T_DATA_XLARGE07 )
    )
    NOCACHE
    NOPARALLEL
    MONITORING
    ENABLE ROW MOVEMENT
    AS
    SELECT /*+ PARALLEL (T,40) */ SERIAL_NUMBER     ,
      PIN_NUMBER        ,
      CARD_TYPE         ,
      DENOMINATION      ,
      DATE_GENERATED    ,
      LOG_PHY_IND       ,
      CARD_ID           ,
      OUTLET_CODE       ,
      MSISDN            ,
      BATCH_NUMBER      ,
      DATE_SOLD         ,
      DIST_CHANNEL      ,
      DATE_CEASED       ,
      DATE_PRINTED      ,
      DATE_RECHARGE     ,
      LOGICAL_ORDER_NR  ,
      DATE_AVAILABLE    ,
      CURRENT_STATUS    ,
      ACCESS_CODE        from CARDS_TAB T
    /
    Database CARDS_TAB table also has a primary key on the column Serial_number. When you try to create a primary key on the new table he throws Exception:
    ALTER TABLE T_CARDS_NEW_201111 ADD
      CONSTRAINT T_PK2_1
     PRIMARY KEY  (SERIAL_NUMBER) USING INDEX
     TABLESPACE T_INDEX_XLARGE07
     PARALLEL 10 NOLOGGING;
    
      CONSTRAINT TP_PK2_1
                 *
    ERROR at line 2:
    ORA-02437: cannot validate (T_PK2_1) - primary key violated
    Thanks in advance.

    With respect,
    Adeline Faure

    For parallel processing the documentation suggests the use automatic degree of parallelism (determined by the system running) or by choosing a power of 2 value
    Look at the post by Florian in your currently neighbor post How to remove duplicate rows from a Table to locate the violations (apparently due to parallel processing)

    Concerning

    Etbin

  • Update of the data in the table using LAG/LEAD

    Hello!

    I have a table that looks like:

    CREATE TABLE CUSTOMER_INFO_TEST
    (
    ACCOUNT_NUM VARCHAR2 (40 BYTE),
    PHONE VARCHAR2 (100 BYTE),
    E-MAIL VARCHAR2 (300 BYTE),
    DATE OF START_DT,
    DATE OF CHANGE_DT,
    END_DT DATE
    );

    The example data:

    INSERT INTO CUSTOMER_INFO_TEST VALUES ('BOB', 555-1234', ", TO_DATE ('2011-01-01', 'YYYY-MM-DD'), TO_DATE ('2011-01-06', 'YYYY-MM-DD'), TO_DATE ('2011-01-10', 'YYYY-MM-DD'));
    INSERT INTO CUSTOMER_INFO_TEST VALUES ('BOB', 555-1234', ' BOB@GMAIL.) COM', TO_DATE ('2011-01-01', 'YYYY-MM-DD'), TO_DATE ('2011-01-11', 'YYYY-MM-DD'), NULL);
    INSERT INTO CUSTOMER_INFO_TEST VALUES ('BOB', 555-1234', ' BOB@GMAIL.) COM', TO_DATE ('2011-01-01', 'YYYY-MM-DD'), TO_DATE ('2011-01-15', 'YYYY-MM-DD'), NULL);
    INSERT INTO CUSTOMER_INFO_TEST VALUES ('JACK', 555-4321', ", TO_DATE ('01-03-2011', 'YYYY-MM-DD'), TO_DATE ('2011-03-06', 'DD-MM-YYYY'), NULL);
    INSERT INTO CUSTOMER_INFO_TEST VALUES ('JACK', 555-4321', ' JACK@GMAIL.) COM', TO_DATE ('01-03-2011', 'YYYY-MM-DD'), TO_DATE ('2011-03-11', 'YYYY-MM-DD'), NULL);

    My question:
    How can I configure end_dt (if null), to the next change_dt minus one

    It shows what I want to do:

    Select the rowid, account_num, phone, e-mail, start_dt, change_dt, end_dt, nvl (end_dt, lead (change_dt-1, 1) over (partition by account_num of start_dt order)) enddt CUSTOMER_INFO_TEST where end_dt is null;

    So, I want to update the table itself with the date in enddt. But how do I do this?

    This must be done in a single statement...

    Thanks in advance

    Richard

    Published by: user6702107 on 05-Jan-2011 09:11

    Edited by: Rydman on April 17, 2012 15:01

    Please post sample data!
    If your query returns the desired results, you can use the MERGE:

    SQL> select *
      2  from   customer_info_test;
    
    ACCOUNT_NU PHONE      EMAIL                     START_DT CHANGE_D END_DT
    ---------- ---------- ------------------------- -------- -------- --------
    BOB        555-1234                             01-01-11 06-01-11 10-01-11
    BOB        555-1234   [email protected]             01-01-11 11-01-11
    BOB        555-1234   [email protected]             01-01-11 15-01-11
    JACK       555-4321                             01-03-11 06-03-11
    JACK       555-4321   [email protected]            01-03-11 11-03-11
    
    5 rows selected.
    
    SQL> --
    SQL> merge into customer_info_test a
      2  using ( select rowid rid
      3          ,      nvl(end_dt, lead(change_dt-1, 1) over (partition by account_num order by start_dt)) new_end_dt
      4          from   customer_info_test
      5          where  end_dt is null
      6        ) b
      7  on (a.rowid = b.rid )
      8  when matched then update set a.end_dt = b.new_end_dt;
    
    4 rows merged.
    
    SQL> --
    SQL> select *
      2  from   customer_info_test;
    
    ACCOUNT_NU PHONE      EMAIL                     START_DT CHANGE_D END_DT
    ---------- ---------- ------------------------- -------- -------- --------
    BOB        555-1234                             01-01-11 06-01-11 10-01-11
    BOB        555-1234   [email protected]             01-01-11 11-01-11 14-01-11
    BOB        555-1234   [email protected]             01-01-11 15-01-11
    JACK       555-4321                             01-03-11 06-03-11 10-03-11
    JACK       555-4321   [email protected]            01-03-11 11-03-11
    
    5 rows selected.
    

Maybe you are looking for