table is expected to insert only one line

Hi all

my need is to create the table that allows to insert only one line.

How can I make it?

Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

PL/SQL Release 11.2.0.1.0 - Production

"CORE 11.2.0.1.0 Production."

AMT for Linux: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

Hello

2621671 wrote:

Hi all

my need is to create the table that allows to insert only one line.

How can I make it?

Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

PL/SQL Release 11.2.0.1.0 - Production

"CORE 11.2.0.1.0 Production."

AMT for Linux: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

You can create a unique Index based on a function, like this:

CREATE UNIQUE INDEX table_x_u ON table_x (NVL2 (col_1, 1, 1));

You can use any column of any data type.  In other words, the function may return a NUMBER, if the column referenced in the function is a NUMBER.

Regardless of whether the column is NULL or not; not more than 1 rank is authorized.

Tags: Database

Similar Questions

  • need to get only one line when you use between (date columns)

    Hi all

    create the table SAMPLE_ITEMS

    (ITEM_NO, varchar2 (10))

    Date DELIVERY_DATE,

    Number of QTY_SUM1

    Number of QTY_SUM2

    Number ITEM_QTY,

    Number ORDER_QTY,

    Number ITEM_AMOUNT,

    Number of SALES_AMOUNT

    );

    insert into SAMPLE_ITEMS values ('AAA', ' 28 / 04/2014 ',-88, 0,475,262,-123.45,-1188);

    insert into SAMPLE_ITEMS values ('AAA', ' 28 / 05/2014 ', 0, - 122, 475, 262, - 10.234,-1647);

    insert into SAMPLE_ITEMS values ('AAA', ' 16 / 06/2014. ', 0, 0,475,262,-80.59,-135);

    insert into SAMPLE_ITEMS values ('AAA', 19 December 2014 ', 0, 0,475,262,-42.29,-67.5);

    Setting out with my own query,

    ITEM_NOTRUNC (DELIVERY_DATE)QTY_SUM1QTY_SUM2ITEM_QTYORDER_QTYITEM_AMOUNTSALES_AMOUNT
    AAA28/04/2014-880475262-123.45-1188
    AAA28/05/20140-122475262-10.234-1647
    AAA16/06/201400475262-80.59-135
    AAA19/12/201400475262-42.29-67.5

    Every time I question as code

    Select * from SAMPLE_ITEMS

    where DELIVERY_DATE between April 28, 2014 ' and 19 December 2014 '-> they must pass as a parameter

    I need to get only one line

    AAA-88-122475262-256.564-3037.5

    Database 11.2.0.1.0

    Note; Please do not use MAX for Date and do not want to display Date columns in the result

    Note 1: I want to choose DELIVERY_DATE in select it also and only get a line like above the expected result

    SELECT item_no

    SUM (qty_sum1),

    SUM (qty_sum2),

    SUM (DISTINCT item_qty),

    SUM (DISTINCT order_qty),

    SUM (item_amount),

    SUM (sales_amount)

    OF SAMPLE_ITEMS

    WHERE the DELIVERY_DATE BETWEEN TO_DATE (28 April 2014 ', "dd/mm/yyyy")

    AND TO_DATE (19 December 2014 ', "dd/mm/yyyy")

    GROUP BY item_no;

    I will get

    ITEM_NO Trunc (DELIVERY_DATE) QTY_SUM1 QTY_SUM2 ITEM_QTY    ORDER_QTY TTEM_AMOUNT SALES_AMOUNT        

    AAA             12/19/2014                         -88                 -122                475                262                       -256.564              -3037.5

    OK fine, I want to choose DELIVERY_DATE as if so I'll have all the lines, but I want to only show one as shown above

    Because I do report discoverer in Oracle Apps, without taking the DELIVERY_DATE of the select query, it is not possible to move the date as a parameter

    Can you please help me how to do this?

    Thank you

    Post edited by: Rajesh123 NOTE added in the body of the Message

    Post edited by: added test Rajesh123 messages

    Maybe you want a single line in all cases

    Select si.item_no,

    start_date min (d.start_date),

    min (d.end_date) end_date,

    min (si.qty_sum1) qty_sum1,

    min (si.qty_sum2) qty_sum2,

    min (si.item_qty) item_qty,

    min (si.order_qty) order_qty,

    Sum (si.item_amount) item_amount,

    Sum (if. Sales_Amount) sales_amount

    of (start_date select to_date(:date_from,'dd-MON-yyyy'))

    to_date(:date_to,'dd-mon-yyyy') end_date

    of the double

    ) d

    left outer join

    TR sample_items

    on the si.delivery_date between d.start_date and d.end_date

    Group of item_no

    ITEM_NO START_DATE END_DATE QTY_SUM1 QTY_SUM2 ITEM_QTY ORDER_QTY ITEM_AMOUNT SALES_AMOUNT
    - 01/01/1900 31/12/2000 - - - - - -

    Concerning

    Etbin

  • Merge only one line on several lines

    I need prepare a merge statement that merge only one line in a table. Here is the table definition, data instruction and fusion sample, I used.
          CREATE TABLE Mob_Attr (NAME VARCHAR2(20), ATTR_1 VARCHAR2(20), ATTR_2 VARCHAR2(20), ATTR_3 VARCHAR2(20));
          CREATE TABLE Mob_Desc (NAME VARCHAR2(50), ATTR_1 VARCHAR2(20), ID NUMBER(20));      
          CREATE TABLE Mob_Main (NAME VARCHAR2(20), ATTR VARCHAR2(20), ID VARCHAR2(10));     
          
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n1','aa',null,null);
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n2','bb',null,null);
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n3','cc',null,null);
          insert into Mob_Attr(name, attr_1, attr_2,attr_3) values ('n4','dd',null,null);
          
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',10);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',15);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',123);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n1','aa',1455);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n2','bb',455);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n2','bb',135);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n3','cc',15);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n3','cc',52);
          insert into Mob_Desc (NAME,ATTR_1,ID) values ('n4','dd',1455);
          
          merge into Mob_Main ma using
          (select d.name, d.attr_1,d.id from Mob_Attr a, Mob_Desc d
          where a.name = d.name and a.attr_1 = d.attr_1
          ) q on (ma.name=q.name and ma.attr=q.attr_1)
          when not matched then
          insert (NAME,ATTR,ID)
          values (q.name,q.attr_1,q.ID);
          
    Merge statement above will actually merge complete data. But I want that the first line will only get inserted to the base table (Mob_Main). If we take the "n1" name first row in the table with the ID Mob_Desc '10' should get only inserted. I go for a cursor to do what I have given huge volume, I prefer the merger instead.
    MERGE INTO Mob_Main ma
         USING (
                  SELECT distinct d.name, d.attr_1, first_value(d.id) over (partition by d.name, d.attr_1 order by d.rowid) id
                  FROM Mob_Attr a, Mob_Desc d
                  WHERE a.name = d.name AND a.attr_1 = d.attr_1
                 ) q
            ON (ma.name = q.name AND ma.attr = q.attr_1)
    WHEN NOT MATCHED
    THEN
       INSERT     (NAME, ATTR, ID)
           VALUES (q.name, q.attr_1, q.ID);
    COMMIT;
    
    select *
    from Mob_Main
    order by name, id;
    
    NAME                 ATTR                 ID
    -------------------- -------------------- ----------
    n1                   aa                   10
    n2                   bb                   455
    n3                   cc                   15
    n4                   dd                   1455      
    
    4 rows selected.
    
  • Link from Oracle to MySQL database select only one line

    Hello

    I created a connection to the batabase Oracle 11.2 to a MySQL database via a database link. The following statement shows that 35 lines are in the mySQL table:

    SQL > select count (*) from 'main_pages"@MOREWEB;

    COUNT (*)

    ----------

    35

    But a normal select statement only return 1 row.

    SQL > select 'subject' of 'main_pages"@MOREWEB;

    Object

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

    Übersicht: references

    I use the mysql-connector-odbc driver - 3.51.30 - winx64. One is the newer version be installed because on Windows Server 2008 R2, I get an error with a missing dll file. The DataDirect ODBC driver is not possible, because we like to use the MySQL-database free one only support for DataDirect enterprise edition.

    I have also tried to limit the HS_OPEN_CURSORS or do not limit the HS_FDS_FETCH_ROWS, but there is no difference in the result. I always get only one line.

    HS Init.ora

    # This is an example of initialization file of the agent that contains the HS settings

    # necessary for the database to ODBC gateway

    #

    # HS init parameters

    #

    HS_FDS_CONNECT_INFO = moreweb

    HS_FDS_TRACE_LEVEL = WE

    HS_FDS_FETCH_ROWS = 1

    #

    # Required for the non-Oracle system environment variables

    #

    #set < varenv > = < value >

    HS trace file

    Oracle Corporation - MITTWOCH 5 November 2014 13:56:22.066

    Heterogeneous Agent release

    11.2.0.1.0

    Oracle Corporation - MITTWOCH 5 November 2014 13:56:22.066

    Version 11.2.0.1.0

    HOSGIP to 'HS_FDS_TRACE_LEVEL' returned 'ON '.

    HOSGIP to 'HS_OPEN_CURSORS' returned '50 '.

    HOSGIP to 'HS_FDS_FETCH_ROWS' returned '1 '.

    HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536".

    HOSGIP to 'HS_NLS_NUMERIC_CHARACTER' returned '. "

    HOSGIP to 'HS_KEEP_REMOTE_COLUMN_SIZE' returned 'OFF '.

    HOSGIP for "HS_FDS_DELAYED_OPEN" returns 'TRUE '.

    HOSGIP to 'HS_FDS_WORKAROUNDS' returned '0 '.

    HOSGIP to 'HS_FDS_MBCS_TO_GRAPHIC' returned 'FALSE '.

    HOSGIP to 'HS_FDS_GRAPHIC_TO_MBCS' returned 'FALSE '.

    HOSGIP to 'HS_FDS_RECOVERY_ACCOUNT' returned 'RECOVER '.

    HOSGIP for "HS_FDS_TRANSACTION_LOG" returns "HS_TRANSACTION_LOG".

    HOSGIP to 'HS_FDS_TIMESTAMP_MAPPING' returned 'DATE '.

    HOSGIP to 'HS_FDS_DATE_MAPPING' returned 'DATE '.

    HOSGIP to 'HS_FDS_CHARACTER_SEMANTICS' returned 'FALSE '.

    HOSGIP for "HS_FDS_MAP_NCHAR" returns 'TRUE '.

    HOSGIP to 'HS_FDS_RESULTSET_SUPPORT' returned 'FALSE '.

    HOSGIP to 'HS_FDS_RSET_RETURN_ROWCOUNT' returned 'FALSE '.

    HOSGIP to 'HS_FDS_PROC_IS_FUNC' returned 'FALSE '.

    HOSGIP to 'HS_FDS_REPORT_REAL_AS_DOUBLE' returned 'FALSE '.

    using mpgw as the default value to "HS_FDS_DEFAULT_OWNER".

    HOSGIP to 'HS_SQL_HANDLE_STMT_REUSE' returned 'FALSE '.

    SQL text of hgopars, id = 1, len = 36...

    45 00: 53454 C 43542043 4F554E54 282 HAS 2920 [COUNT (*) SELECT]

    10: 46524F4D 20606D 61 696E5F70 61676573 [FROM ' main_pages]

    20: 60204131 [' A1]

    Delayed open until the first fetch.

    Deferred execution open.

    SQL text of hgopars, id = 1, len = 40...

    45 00: 53454 C 43542041 312E6073 75626 has 65 [SELECT A1.' subje(1)]

    10: 63746020 46524F4D 20606D 61 696E5F70 [ct' FROM ' main_p]

    20: 61676573 60204131 [ages A1]

    Delayed open until the first fetch.

    Deferred execution open.

    Please can someone help me.

    Thank you.

    Bianca

    Bianca,

    Everything I've read on this point to a need to install/reinstall the Microsoft Visual C++ Redistributable Package for windows OS 2008.

    You will need to download the appropriate version for your microsoft form system.  There is a lot of information on this topic.  Just

    search on the web, and it should help you in the right direction.

    Thank you!
    Matt

  • Subtotals - delete if there is only one line?

    I'm sure I know the answer to that, but is there a way of subtotals to remove if there is only one line? It doesn't seem to be any documented to do this, but I wonder if anyone has found a kind of workaround...? ... Registry entry?

    I am using Desktop, verision 10.1.2.2

    Thank you!

    Hello
    There is no global setting, but you can remove them on a basis of total per total.

    You change the total and check the box that says do not appear in total for a single line, but like I said you need to do this on a basis of total per total.

    Best wishes
    Michael

  • Get only one line for each type of a column

    Hello!
    I have a little problem.

    I have a table with 10 columns. One of them has repeated values. My goal is to get all the lines with this column only once for each values he holds.

    Ex:

    Col1 Col2 Col3
    A A A A
    B B B
    C A C
    D C D


    Column 2 has repeated values. My goal is to get:

    A A A A
    B B B
    D C D

    Only once each value in column 2.

    Thank you guys! ;)
    SQL>  CREATE TABLE Tbl (col1 VARCHAR2(1),col2 VARCHAR2(1),col3 VARCHAR2(1));
    
    Table created.
    
    SQL> INSERT INTO Tbl VALUES ('A','A','A');
    
    1 row created.
    
    SQL>              INSERT INTO Tbl VALUES ('B','B','B');
    
    1 row created.
    
    SQL>              INSERT INTO Tbl VALUES ('C','A','C');
    
    1 row created.
    
    SQL>              INSERT INTO Tbl VALUES ('D','C','D');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> SELECT * FROM tbl t1
      2  WHERE
      3  rowid=(SELECT min(rowid)
      4         FROM tbl t2
      5         WHERE t1.col2=t2.col2);
    
    C C C
    - - -
    A A A
    B B B
    D C D
    
    SQL> SELECT * FROM tbl t1
      2  WHERE
      3  rowid=(SELECT max(rowid)
      4         FROM tbl t2
      5         WHERE t1.col2=t2.col2);
    
    C C C
    - - -
    B B B
    C A C
    D C D
    

    Published by: Johan August 3, 2010 01:31

  • How select only one line

    Hello
    I have a select query that returns a couple of lines.
    now, I would like for the query to return only one row (the first match it can find).
    How do I do that?
    Thank you!

    my sample of my data as below, the registration of the first and the second is equal and I want the column of the first row and ignore the second row.


    9410 20110812 84A8E46E8C97
    9420 20110813 84A8E46E8C97
    84A8E46E8C6E 20110816 9410
    9400 20110819 84A8E46E8AFA

    You can try

      SELECT msid, bsid, starttime
        FROM (SELECT msid, bsid, starttime, ROW_NUMBER () OVER (PARTITION BY msid ORDER BY msid, starttime) rn FROM aaa_bill)
       WHERE rn = 1
    ORDER BY 1, 3
    
  • So that to joining 3 tables make me 2 ranks, real, I need only one line

    Hi all

    While joining 3 tables make me 2 rows, I need 1 row.

    Please find my request and the actual output and the expected results.

    Help me handle this.

    Select

    -MFU_D_C_INVESTOR_ID_DET,

    mfu_remove_junk (Q.CAN) CAN_ST,

    mfu_remove_junk (Q.INSTALLMENT_AMOUNT) AMOUNT_ST,

    mfu_remove_junk (x.Can) can be,

    mfu_remove_junk (x.Amc_Code) Amc_Code,

    mfu_remove_junk (x.Folio_No) Folio_No,

    mfu_remove_junk (x.Order_Status) Order_Status,

    mfu_remove_junk (x.User_Code) User_Code,

    mfu_remove_junk (x.User_Txrn_No) User_Txrn_No,

    mfu_remove_junk (x.Group_Ord_No) Group_Ord_No,

    mfu_remove_junk (x.Ind_Txn_Ref_No) Ind_Txn_Ref_No,

    mfu_remove_junk (x.Pending_Txn_Ref_No) Pending_Txn_Ref_No,

    mfu_remove_junk (x.Appl_No) Appl_No,

    mfu_remove_junk (x.Ts_Machine_Id) Ts_Machine_Id,

    mfu_remove_junk (x.Trxn_Date) Trxn_Date,

    mfu_remove_junk (x.Trxn_Time) Trxn_Time,

    mfu_remove_junk (x.Timestamp_No) Timestamp_No,

    mfu_remove_junk (x.Sch_Code) Sch_Code,

    mfu_remove_junk (x.Reinv_Tag) Reinv_Tag,

    mfu_remove_junk (x.Txn_Mode) Txn_Mode,

    mfu_remove_junk (x.Trxn_Type) Trxn_Type,

    mfu_remove_junk (x.Sub_Trxn_Type) Sub_Trxn_Type,

    mfu_remove_junk (x.Units) units,

    mfu_remove_junk (x.Amount) amount.

    mfu_remove_junk (x.All_Units_Flag) All_Units_Flag,

    Entity_Id, mfu_remove_junk (x.Entity_Id),

    mfu_remove_junk (x.ENTITY_BRANCH_ID) ENTITY_BRANCH_ID,

    mfu_remove_junk (x.Location) location,

    (TO_CHAR(sysdate,'DD-MON-RRRR'))        CREATED_DATE

    Of MFU_FTP_XML_FILES T

    Left Join Xmltable ('/ COMM_TXN_STRUCT/FILE_ROWS/FILE_ROW ')

    By the way T.Filecontent

    Columns

    -MFU_D_C_INVESTOR_ID_DET

    Can Varchar2 (500) path ' INVESTOR_ID_DET / CAN'.

    Path of Varchar2 (500) Amc_Code "INVESTOR_ID_DET/AMC_CODE,"

    Path of Varchar2 (500) Folio_No "INVESTOR_ID_DET/FOLIO_NO,"

    Path of Varchar2 (500) Order_Status ' TRANSACTION_DET/ORDER_STATUS. "

    Path of Varchar2 (500) User_Code "TRANSACTION_DET/USER_CODE,"

    Path of Varchar2 (500) User_Txrn_No "TRANSACTION_DET/USER_TXRN_NO,"

    Path of Varchar2 (500) Group_Ord_No "TRANSACTION_DET/GROUP_ORD_NO,"

    Path of Varchar2 (500) Ind_Txn_Ref_No "TRANSACTION_DET/IND_TXN_REF_NO,"

    Path of Varchar2 (500) Pending_Txn_Ref_No "TRANSACTION_DET/PENDING_TXN_REF_NO,"

    Path of Varchar2 (500) Appl_No "TRANSACTION_DET/APPL_NO,"

    Path of Varchar2 (500) Ts_Machine_Id "TRANSACTION_DET/TS_MACHINE_ID,"

    Path of Varchar2 (500) Trxn_Date "TRANSACTION_DET/TRXN_DATE,"

    Path of Varchar2 (500) Trxn_Time "TRANSACTION_DET/TRXN_TIME,"

    Path of Varchar2 (500) Timestamp_No "TRANSACTION_DET/TIMESTAMP_NO,"

    Path of Varchar2 (500) Sch_Code "TRANSACTION_DET/SCH_CODE,"

    Path of Varchar2 (500) Reinv_Tag "TRANSACTION_DET/REINV_TAG,"

    Path of Varchar2 (500) Txn_Mode "TRANSACTION_DET/TXN_MODE,"

    Path of Varchar2 (500) Trxn_Type "TRANSACTION_DET/TRXN_TYPE,"

    Path of Varchar2 (500) Sub_Trxn_Type "TRANSACTION_DET/SUB_TRXN_TYPE,"

    Units Varchar2 (500) Path TRANSACTION_DET/UNITS"."

    Amount Varchar2 (500) path ' TRANSACTION_DET/AMOUNT. '

    Path of Varchar2 (500) All_Units_Flag "TRANSACTION_DET/ALL_UNITS_FLAG,"

    Path of Varchar2 (500) Entity_Id ' TRANSACTION_DET/ENTITY_ID. "

    Path of Varchar2 (500) ENTITY_BRANCH_ID "TRANSACTION_DET/ENTITY_BRANCH_ID,"

    Path of Varchar2 (500) "TRANSACTION_DET/RENTAL.

    ) X

    (1 = 1)

    the left join XMLTABLE ('/ CT_SYS_STRUCT/FILE_ROWS/FILE_ROW ')

    PASSAGE T.FILECONTENT

    columns

    CAN varchar2 (500) PATH ' INVESTOR_ID_DET / CAN'.

    INSTALLMENT_AMOUNT varchar2 (500) PATH "TRANSACTION_DET/INSTALLMENT_AMOUNT".

    ) Q

    (1 = 1)

    Where

    TRUNC ((TO_DATE (T.RETRIVED_DATE, 'DD-MON-RRRR HH PM'))) = TRUNC(SYSDATE-2)

    Order By X.Can Asc, Rownum;

    O/P: real

    15114LBA01 1000.00 (null) (null) (null) (null) (null) (null) (null)

    (null)      (null) 15114LBA01 SMF AC UGM 40715117000 15114010001 1511401000102

    O/P: expected

    amount can_st peut amc command user trxn_no group_ord ind_txn_no

    1000.00 15114LBA0115114LBA01 SMFCA40715117000 15114010001 1511401000102 UGM

    It would have been helpful if you had your more detailed condition described in brief.

    For as far as I understand nothing xmldata in every line of MFU_FTP_XML_FILES can you wheter structure COMM_TXN_STRUCT or CT_SYS_STRUCT.

    So what about something like below

    Select

    x.*

    , q.*

    sysdate

    de)

    Select

    x.cols

    MFU_FTP_XML_FILES t

    , Xmltable ('/ COMM_TXN_STRUCT/FILE_ROWS/FILE_ROW ')

    By the way T.Filecontent

    Columns

    the_x_cols

    ) x

    Where

    TRUNC ((TO_DATE (T.RETRIVED_DATE, 'DD-MON-RRRR HH PM'))) = TRUNC(SYSDATE-2)

    ) x

    Join

    -a full outer join if there are cans without match

    (

    Select

    q.cols

    MFU_FTP_XML_FILES t

    , XMLTABLE ('/ CT_SYS_STRUCT/FILE_ROWS/FILE_ROW ')

    PASSAGE T.FILECONTENT

    columns

    CAN varchar2 (500) PATH ' INVESTOR_ID_DET / CAN'.

    INSTALLMENT_AMOUNT varchar2 (500) PATH "TRANSACTION_DET/INSTALLMENT_AMOUNT".

    ) q

    Where

    TRUNC ((TO_DATE (T.RETRIVED_DATE, 'DD-MON-RRRR HH PM'))) = TRUNC(SYSDATE-2)

    ) Q

    on (x.can = q)

    Order By X.Can Asc, Rownum;

  • Insert only one cell in a table (not an extra set of the row or column)?

    I have problems by performing an easy Assembly. I need to insert a a 'CELL', but I am only considered the possibility to insert a set 'ROW' or 'COLUMN '. I would just insert a cell and the rest of the content below it moves accordingly. Help, please!

    There is no way to put it while you just insert a cell and everything moves along after that cell?

    Simple answer is 'no '. I'm sorry.

    InDesign tables are not good for juggling data. If you have a project that requires single-cell-integration on a regular basis, I suggest to make your table outside InDesign in an application with tools more easy table-cell-juggling (Excel comes to mind here) and then perfecting you use table and cell styles make it easy to update. Of course, it will always be a concern, but the hassle can be minimized.

  • How to add asterics to line when an item in the line splits into two and only one line display.

    
    
    

    Here, the title is a bit confusing, I completely realize that but here's what I'm trying to accomplish. I have a table with a column that repeats.

    the table looks like this.

    create table testCheck (check_num varchar2(20), amount number(17,2), invh_Code varchar2(20))
    
    

    and it contains data as follows

    INSERT INTO "TESTCHECK" (CHECK_NUM, AMOUNT, INVH_CODE) VALUES ('001', '50', '1123')
    INSERT INTO "TESTCHECK" (CHECK_NUM, AMOUNT, INVH_CODE) VALUES ('001', '50', '1123')
    INSERT INTO "TESTCHECK" (CHECK_NUM, AMOUNT, INVH_CODE) VALUES ('002', '100', '1234'
    
    

    I would like to write a query that would give me of the separate check_num, but put an asterisk on the elements that are in fact double.

    so in other words expected result in this case is as follows.

    "CHECK_NUM" "AMOUNT" "INVH_CODE"
    "001*" 50 "1123"
    "002" 100 "1234"
    

    I could go as far as getting unique values, but what I can't do, it is understand for the life of me how to put the asterisk in there.

    Here's my query.

    with Checkquery as (         
    SELECT  count(*) over (partition by CHECK_NUM order by CHECK_NUM ROWS UNBOUNDED PRECEDING ) thiscount, CHECK_NUM,  AMOUNT,  INVH_CODE
    FROM  TESTCHECK
    group by
    check_num,
    AMOUNT,
    INVH_CODE)
    select check_num, amount,invh_Code from Checkquery where thiscount ='1';
    
    

    can someone tell me please in the right direction. I just want to identify the dups put an asterisk on the record and then only select records.

    According to your last post, you keep what is displayed for the other columns, so why display them at all, so this will do the job.

    SELECT check_num.

    Decode (to_char (Count (*)), '1', NULL,'* ') dup_checks

    TO define by test

    GROUP BY check_num;

    If you want to view the other columns, you have two choices. You must either put some sort of aggregate function in the list of selection, such as min, max, or sum, or they need to be part of the group.

    Concerning

    André

  • Nested table of object type have only one record all the time

    Hi all

    I have a question regarding the storage of multiple records in a nested Table that is of type OBJECT.

    The program below that I wrote for the test and during the test, I was able to store only the last record in the nested Table.

    Please let me know what I did wrong here.

    Step 1:
    CREATE or REPLACE TYPE book_obj AS OBJECT (name varchar2 (25), author varchar2 (25), abstract varchar2 (4000));
    /

    Step 2:
    CREATE or REPLACE TYPE book_table IS TABLE OF THE book_obj;
    /

    Step 3: CREATE TABLE book (name, varchar2 (25), varchar2 (25) author, varchar2 (4000)) abstract;
    INSERT VALUES Accountants ('Harry Potter,' 'MK', 'It's magic');
    INSERT the book VALUES ("Ramayana', 'VK', 'It is mythiology'");
    COMMIT;

    Step 4:
    declare
    bookset book_table;
    ln_cnt pls_integer;
    Start
    bookset: = book_table (book_obj ('madhu', 'kongara', 'sudhan'));
    dbms_output.put_line (' the number is ' | bookset.) (Count); -> I see COUNT = 1
    bookset: = bookset_t(); -> Assignment to NULL.
    dbms_output.put_line (' the number is ' | bookset.) (Count); -> I see County 0
    for rec in (select * from book) loop-> now a loop twice.
    dbms_output.put_line (' name > ' |) Rec.Name);
    bookset: = bookset_t (book_t (rec.name, rec.author, rec.abstract));
    end loop;
    dbms_output.put_line (' the number is ' | bookset.) (Count); -> I can see COUNT = 1 (why?)
    END;

    I looped twice to fill two records in the TABLE IMBRIQUEE OF TYPE OBJECT. But when I see the Count I get only 1 and the data is also having the last record.

    Can you get it someone please let me know how to fill out the table nested with all records. Tell me where I am wrong.

    Very much appreciate your help here.

    Thank you and best regards,
    NKM

    Maldini says:
    dbms_output.put_line (' the number is ' | bookset.) (Count); -->, I can see COUNT = 1 (why?)

    Because instead of add to bookset collectionto set (ergo replacement) it a collection containing recovered book. Use:

    declare
        bookset book_table;
        ln_cnt pls_integer;
    begin
        bookset := book_table(book_obj('madhu','kongara','sudhan'));
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1
        bookset := book_table(); --> Assigning back to NULL.
        dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0
        for rec in (select * from book) loop --> Now Looping two times.
          dbms_output.put_line(' name > '||rec.name);
          bookset.extend;
          bookset(bookset.count) := book_obj(rec.name, rec.author, rec.abstract);
        end loop;
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why)
    end;
    /
    The count is 1
    The count is 0
    name > Harry Potter
    name > Ramayana
    The count is 2
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    Or better use bulk collect:

    declare
        bookset book_table;
        ln_cnt pls_integer;
    begin
        bookset := book_table(book_obj('madhu','kongara','sudhan'));
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1
        bookset := book_table(); --> Assigning back to NULL.
        dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0
        select  book_obj(name,author,abstract)
          bulk collect
          into  bookset
          from  book;
        for i in 1..bookset.count loop --> Now Looping two times.
          dbms_output.put_line(' name > '||bookset(i).name);
        end loop;
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why)
    end;
    /
    The count is 1
    The count is 0
    name > Harry Potter
    name > Ramayana
    The count is 2
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • [ADF, JDev12.1.3] A loop on af: table through "dcIteratorBindings.getAllRowsInRange" takes only 25 lines. Why?

    Hallo,

    I would like to export an af:table in Excel and I tried to apply the method described here http://www.techartifact.com/blogs/2013/08/generate-excel-file-in-oracle-adf-using-apache-poi.html#sthash.VSEYBrdd.UPOaYZ... by vinaykumar2.

    I noticed that the return Excel file contains max 25 rows.

    The VO behind af: table has the default configuration.

    The RangeSize of the iterator property is 25.

    oracle.jbo.Row[] rows = dcIteratorBindings.getAllRowsInRange();
    

    If I put it at 100, the return Excel file contains 100 rows max.

    I would always that all af:table are exported, so I guess I have to settle RangeSize on a very high value (e.g. 100000).

    Is RangeSize property to play with to solve the problem? Or there is a setting/alternative code to use? It affecting a high value will have an impact on performance?

    Thank you

    Federico

    Hi Federico,.

    The RangeSize - 1 value property. You will get all the lines.

  • Problem with PPR in a table advanced with the insertion of several lines in create the page using 'add a new button '.

    Hello experts,

    I created a page that contains an array of advanced, 6-7fields (including a poplist column)

    Whenever I have add a new using the line add new line button, I get a null pointer exception.

    Code in Scenario1.


    Public Sub handleCurrencyChangeEvent()

    {

    PVO OAViewObject = (OAViewObject) findViewObject ("xxCurrencyPVO1");

    Line OARow = (OARow) pvo.first ();

    OAViewObject dtlVO = (OAViewObject) findViewObject ("xxEcreditCardDtlVO1");

    OARow dtlRow = (OARow) dtlVO.getCurrentRow ();

    String currency = (String) dtlRow.getAttribute ("CurrencyCode");    / / NULL POINTER EXCEPTION

    If ((currency == null) |) ("AED".equals (currency)))

    {

    row.setAttribute ("ExchangeRateTypeRender", Boolean.FALSE);

    row.setAttribute ("ExchangeRateDateRender", Boolean.FALSE);

    row.setAttribute ("ExchangeRateRender", Boolean.FALSE);

    }

    on the other

    {

    row.setAttribute ("ExchangeRateTypeRender", Boolean.TRUE);

    row.setAttribute ("ExchangeRateDateRender", Boolean.TRUE);

    row.setAttribute ("ExchangeRateRender", Boolean.TRUE);

    }

    }

    Public Sub initPVO()

    {

    OAViewObject appPropsVO = (OAViewObject) findViewObject ("xxCurrencyPVO1");

    If (appPropsVO! = null)

    {

    If (appPropsVO.getFetchedRowCount () == 0)

    {

    appPropsVO.setMaxFetchSize (0);

    appPropsVO.executeQuery ();

    appPropsVO.insertRow (appPropsVO.createRow ());

    Line OARow = (OARow) appPropsVO.first ();

    row.setAttribute ("RowKey", new Number (1));

    }

    }

    handleCurrencyChangeEvent();    / / If I comment on this call, there will be no null pointer when I click on the button Add a new rank and PPR will not be the first line when I select the poplist.                 

    }

    Public Sub createDetailRow()

    {

    String hdrId;

    OAViewObject hdrvo1 = (OAViewObject) getxxEcreditCardHdrVO1 ();

    OAViewObject dtlvo = (OAViewObject) getxxEcreditCardDtlVO1 ();

    Initialize and create a line of VO

    If (! dtlvo.isPreparedForExecution ())

    {

    dtlvo.setMaxFetchSize (0);

    dtlvo.executeQuery ();

    }

    Line dtlrow = dtlvo.createRow ();

    dtlvo.executeQuery ();

    int count = dtlvo.getRowCount ();

    dtlvo.insertRowAtRangeIndex (count, dtlrow);

    Development of the sequence for the number of request *.

    Number of dtlseq = getOADBTransaction () .getSequenceValue ("xxdm. XXDMI_ECREDIT_CARD_DTL_SEQ");

    hdrId = hdrvo1.getCurrentRow ().getAttribute("CreditCardHdrId").toString (); mind vo

    dtlrow.setAttribute ("CreditCardHdrId", hdrId);

    dtlrow.setAttribute ("CreditCardLineId", dtlseq);

    dtlrow.setAttribute ("LineNumber", count + 1);

    End of sequence generation *.

    dtlrow.setAttribute ("CurrencyCode", "AED");

    String currency = (String) dtlrow.getAttribute ("CurrencyCode");

    System.out.println ("CurrencyCode:" + currency);

    dtlrow.setNewRowState (Row.STATUS_INITIALIZED);

    } / / end createDetailRow()

    ' Public Sub processFormRequest (pageContext OAPageContext, OAWebBean webBean)

    {

    super.processFormRequest (pageContext, webBean);

    OAApplicationModule am = pageContext.getApplicationModule (webBean);

    Event string = pageContext.getParameter (OAWebBeanConstants.EVENT_PARAM);

    * Treatment add line button *.

    If ((ADD_ROWS_EVENT. Equals (Event)) & & "AdvTblRN".equals (pageContext.getParameter ("source"))) ".

    {

    am.invokeMethod ("createDetailRow", null);

    am.invokeMethod ("initPVO");

    } //**End add row button *.

    otherwise if

    ("currCodeChangeEvent".equals (pageContext.getParameter (OAWebBeanConstants.EVENT_PARAM)))

    {

    am.invokeMethod ("handleCurrencyChangeEvent");

    }

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

    Could please help what is wrong in the code, I followed all the steps as stated in the guide, but the table advance, the problem starts whenever I click on the button Add a new row for the creation of new line.

    I couldn't understand what was wrong with the code.

    Thanks in advance,

    Suman

    Suman,

    A few points:

    1. Why do you call handleCurrencyChangeEvent in the event to add a line? Simply set the useful, likely of the values in the line it himself.

    ex:-instead of calling the handleCurrenyChange method, simply add the below lines inside the createDetailRow()

    dtlrow.setAttribute ("ExchangeRateTypeRender", Boolean.FALSE);

    dtlrow.setAttribute ("ExchangeRateDateRender", Boolean.FALSE);

    dtlrow.setAttribute ("ExchangeRateRender", Boolean.FALSE);

    2. it looks like you have on the field of the currency and that fireAction handleCurrencyChangeEvent action method is called, right?

    Instead of using dtlVo.getCurrentRow, use the code below:

    public void handleCurrencyChangeEvent(String eventRowSourceParam)
      {
      OAViewObject pvo = (OAViewObject)findViewObject("xxCurrencyPVO1");
      OARow row = (OARow)pvo.first();
    
      OAViewObject dtlVO = (OAViewObject)findViewObject("xxEcreditCardDtlVO1");
    
      //OARow dtlRow = (OARow)dtlVO.getCurrentRow();
      OARow dtlRow = (OARow)this.findRowByRef(eventRowSourceParam);
    
      String  currency = (String)dtlRow.getAttribute("CurrencyCode");    // NULL POINTER EXCEPTION
    
      if ((currency == null) || ("AED".equals(currency)))
      {
      row.setAttribute("ExchangeRateTypeRender", Boolean.FALSE);
      row.setAttribute("ExchangeRateDateRender", Boolean.FALSE);
      row.setAttribute("ExchangeRateRender", Boolean.FALSE);
      }
      else
      {
      row.setAttribute("ExchangeRateTypeRender", Boolean.TRUE);
      row.setAttribute("ExchangeRateDateRender", Boolean.TRUE);
      row.setAttribute("ExchangeRateRender", Boolean.TRUE);
      }
      }
    

    In the controller:

    if((ADD_ROWS_EVENT.equals(event)) && "AdvTblRN".equals(pageContext.getParameter("source")) )
    {
      am.invokeMethod("createDetailRow",null);
      am.invokeMethod("initPVO");
    } //**End Add Row Button**
    else if ("currCodeChangeEvent".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
    {
      String eventRowSourceParam = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
      Serializable[] params = {eventRowSourceParam};
        Class[] paramTypes    = {String.class};
      am.invokeMethod("handleCurrencyChangeEvent",params, paramTypes);
    }
    

    3. Why do you call initPVO when it is clicked on the Add line? Are you calling not just in the PR?

    You could call it once in the PR and let. When you call it PR, you may need to remove the handleCurrencyChangeEvent of this method call.

    See you soon

    AJ

  • DCBindingIterator refresh only one line

    Hi all!

    Is that what someone can say, is there a chance to refresh only a current record in the DCBindingIterator?

    Now I do it like that
    JUIteratorBinding it = ELExp.getIterator("TestIterator");
    String saveRowKey = it.getCurrentRowKeyString();
    it.executeQuery();
    it.setCurrentRowWithKey(saveRowKey);
    But I think that's not very optimal.

    Thank you!

    Hello

    oracle.jbo.Row has a refresh() method that allows you to refresh a single row of for example the database or simply for unspecified changes.

    Line rw = it.getCurrentRow ();
    RW. Refresh (Row.REFRESH_UNDO_CHANGES);

    http://download.Oracle.com/otn_hosted_doc/JDeveloper/1012/bc4jjavadoc/RT/Oracle/JBO/row.html

    Frank

    Published by: Frank Nimphius, March 6, 2012 20:42

  • Problem with headphone selection if the table has only one row

    Hi all

    I have developed a table in which I use selection listener to perform a task when a line is selected.
    It works fine when I have more than 1 row in the table, but when I did that one line in the table, the listener of selection do not call the corresponding method in the bean.
    I understand this selection event is raised only when the line is changed, but in the case of use when only one line is there, what do I do to make the listener of selection work?

    The selection listener I wrote the code to make the line selected as current line and perform the required task.

    Please suggest a way out of this situation.

    Thanks in advance.

    Hello

    try to remove this table attr

    selectedRowKeys="#{bindings.xxx_VO1.collectionModel.selectedRow}"
    

Maybe you are looking for