Ensure one row only is set as default

We have a Customers table. The default customer is 'CASH SALE'. Our business rules require one and one only customer be the default customer, but the default customer can be changed from CASH SALE to any other customer. Our business rules do not allow the
CASH SALE customer to be modified beyond setting the IsDefault attribute to true or false
There is a column IsDefault bit and a unique filtered index on IsDefault.
CREATE UNIQUE INDEX IX_Customers_IsDefault
ON Customers(IsDefault)
WHERE IsDefault = 1
This works to the extent that it does not allow more than 1 row to be marked IsDefault, but it does not ensure that there is one row marked IsDefault = 1, ie it is possible for IsDefault = 0 for all rows.
We also have constraints that prevent updating or deleting CASH SALE
-- the CASH SALE customer cannot be deleted
CREATE TRIGGER Customers_No_Delete ON Customers
INSTEAD OF DELETE
AS
IF ( SELECT CustomerId
FROM deleted
) = 0
BEGIN
RAISERROR ('The CASH SALE customer cannot be changed nor deleted.', 16, 1)
END
ELSE
BEGIN
DELETE FROM Customers
WHERE CustomerId = ( SELECT CustomerId
FROM deleted
END
GO
-- the CASH SALE customer cannot be changed
CREATE TRIGGER Customers_No_Update ON Customers
INSTEAD OF UPDATE
AS
IF ( SELECT CustomerId
FROM inserted
) = 0
BEGIN
RAISERROR ('The CASH SALE customer cannot be changed nor deleted.', 16, 1)
END
ELSE
BEGIN
DELETE FROM Customers
WHERE CustomerId = ( SELECT CustomerId
FROM deleted
END
GO
However the trigger Customers_No_Update also prevents updating the IsDefault column. I know this is a common business scenario:CASH SALE cannot be edited but another customer can be marked as the default customer, so I assume there is a standard solution
... if someone could please point me the way.

Thank you Erland. By using both of the triggers you suggested the problem is solved. I changed the trigger dont_touch_CASH_SALE so that rather than check if each column is updated, it checks that IsDefault is not the column being updated, ie IF NOT UPDATE(IsDefault)
Thanks again to everyone for your assistance.
Refering to your comment below
I may be mistaken but it appears the solution proposed by  Visakh16 does not allow IsDefault = 1 for a customer other than CASH SALE
I dont think thats true
See this illustration
--Sample table for illustration
CREATE TABLE Customers
ID int IDENTITY(1,1),
CustName varchar(100),
IsDefault bit
--Some sample data inserted
INSERT Customers (CustName,IsDefault)
VALUES
('Cust1',0),
('Cust2',0),
('Cust3',0),
('CASH SALE',1)
--The suggested trigger
CREATE TRIGGER Customers_No_Update ON Customers
INSTEAD OF UPDATE
AS
IF EXISTS( SELECT 1
FROM inserted i
INNER JOIN Deleted d
ON d.ID = i.ID
AND d.CustName <> COALESCE(i.CustName,'')
WHERE d.CustName = 'CASH SALE'
BEGIN
RAISERROR ('The CASH SALE customer cannot be changed nor deleted.', 16, 1)
END
ELSE
BEGIN
UPDATE c
SET CustName = i.CustName,
IsDefault = i.IsDefault
FROM Customers c
INNER JOIN Inserted i
ON i.ID = c.ID
END
GO
--The updates
-- Modifying CASH SALE IsDefault. This will succeed
UPDATE Customers
SET IsDefault = 0
WHERE CustName = 'CASH SALE'
-- Modifying Cust1 IsDefault. This will succeed
UPDATE Customers
SET IsDefault = 1
WHERE CustName = 'Cust1'
-- Modifying Cust2 Name. This will succeed
UPDATE Customers
SET CustName = 'Cust2 Test'
WHERE CustName = 'Cust2'
-- Modifying CASH SALE Name. This will fail
UPDATE Customers
SET CustName = 'CASH SALE Test'
WHERE CustName = 'CASH SALE'
Only thing I've have not covered is the scenario which ensures you've only single default cust value at any point of time. If you want that to be enforced just extend trigger as below
CREATE TRIGGER Customers_No_Update ON Customers
    INSTEAD OF UPDATE
AS
    IF EXISTS( SELECT 1         
         FROM   inserted i
         INNER JOIN Deleted d
         ON d.ID = i.ID
         AND d.CustName <> COALESCE(i.CustName,'')
         WHERE d.CustName = 'CASH SALE'
        BEGIN
            RAISERROR ('The CASH SALE customer cannot be changed nor deleted.', 16, 1)    
        END
     ELSE IF EXISTS( SELECT 1         
         FROM   Customers i
         WHERE IsDefault = 1
         AND NOT EXISTS (SELECT 1 FROM deleted WHERE CustName = i.CustName)
       BEGIN
            RAISERROR ('There cant be more than 1 default customers.', 16, 1)    
        END  
    ELSE
        BEGIN
            UPDATE c
            SET CustName = i.CustName,
            IsDefault = i.IsDefault
            FROM Customers c
            INNER JOIN Inserted i
            ON i.ID = c.ID
        END
GO
and do updates
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Need a report column to hold data for one row only

    Hey Guys,
    I have a report which has a column that links to another page in my APEX application.
    There is a requirement where only one of the rows in this report needs to have a link so I need the column to show the page link for one row and one row only.
    The report will have about 5 rows at a time so is there a way to just make this link appear for the one row(it will be the top row) in the column attirbute in APEX? or can this be done in the SQL for the report?
    Any help is much appreciated
    Thanks
    -Mark

    Hi
    The only way (I believe) to do this is within the SQL. Then you just wrap the column in a CASE statement and if it meets your criteria then build up the link and if not then display normally.
    Something like this...
    SELECT ename,
           CASE WHEN empno = 7839
           THEN '<a href="f?p='||:APP_ID||':4:'||:APP_SESSION||'::NO::P4_TARGET_ITEM:'||empno||'" >'||empno||'</a>'
           ELSE TO_CHAR(empno)
           END empno
    FROM empCheers
    Ben

  • Write to spreadsheet file.vi is storing data in one row only.

    The 8 points of data is going into one column in the spreadsheet. In the "Write to spreadsheet file string.vi" how do I write the 8 points to one row for each cycle?
    I got this VI from NI's web a couple of years ago and forgot how to modify this part. I usume it is within the write file.vi.
    Thank you in advance
    Skip

    I just reread your original post and the way the "Write to Spreadsheet File.vi" that ships with LV works by default is to put 1D arrays into rows. I read your post backwards and told you how to put the data in a column. Sorry.
    In any case, perhaps you need to make sure the Transpose input ISN'T true, and that the delimiter IS a tab.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Display one row only

    This query
    SELECT
    SCRATTR_ATTR_CODE
    from scrattr_TEST,scbcrse_TEST
    where
    SUBSTR(scbcrse_subj_code,1,3)  = SUBSTR(scrattr_subj_code,1,3)
    and SUBSTR(scbcrse_crse_numb,1,4)  = SUBSTR(scrattr_crse_numb,1,4)Returns this
    SCRATTR_ATTR_CODE
    A
    INS
    MCSR How I can make to return someting like A INS MCSR in one row there is a row for every code
    hERE is some code to create the tables and insert the data
    CREATE TABLE SCRATTR_test
      SCRATTR_SUBJ_CODE      VARCHAR2(4 CHAR)       NOT NULL,
      SCRATTR_CRSE_NUMB      VARCHAR2(5 CHAR)       NOT NULL,
      SCRATTR_EFF_TERM       VARCHAR2(6 CHAR)       NOT NULL,
      SCRATTR_ATTR_CODE      VARCHAR2(4 CHAR)
      CREATE TABLE SCBCRSE_test
      SCBCRSE_SUBJ_CODE              VARCHAR2(4 CHAR) NOT NULL,
      SCBCRSE_CRSE_NUMB              VARCHAR2(5 CHAR) NOT NULL,
      SCBCRSE_EFF_TERM               VARCHAR2(6 CHAR)
    insert into SCRATTR_test (SCRATTR_SUBJ_CODE,SCRATTR_CRSE_NUMB,SCRATTR_EFF_TERM,SCRATTR_ATTR_CODE) select 'BIO','2210','201320',' A' from dual;
    insert into SCRATTR_test (SCRATTR_SUBJ_CODE,SCRATTR_CRSE_NUMB,SCRATTR_EFF_TERM,SCRATTR_ATTR_CODE) select 'BIO','2210','201320','INS' from dual;
    insert into SCRATTR_test (SCRATTR_SUBJ_CODE,SCRATTR_CRSE_NUMB,SCRATTR_EFF_TERM,SCRATTR_ATTR_CODE) select 'BIO','2210','201320','MCSR' from dual;
    COMMIT;
    INSERT INTO  SCBCRSE_test(SCBCRSE_SUBJ_CODE,SCBCRSE_CRSE_NUMB,SCBCRSE_EFF_TERM) SELECT  'BIOL','2210','201320' FROM DUAL
    COMMIT; Thank you

    Based on your testcase, on 11.2 you could just:
    SQL> select listagg(a.SCRATTR_ATTR_CODE, ' ') within group (order by rownum)
      2  from   scrattr_TEST a
      3  ,      scbcrse_TEST b
      4  where  SUBSTR(b.scbcrse_subj_code,1,3)  = SUBSTR(a.scrattr_subj_code,1,3)
      5  and    SUBSTR(b.scbcrse_crse_numb,1,4)  = SUBSTR(a.scrattr_crse_numb,1,4);
    LISTAGG(A.SCRATTR_ATTR_CODE,'')WITHINGROUP(ORDERBYROWNUM)
    A INS MCSR

  • Select single vs select upto one rows only by experts

    Hello Experts,
    I am sorry to post this thread again , it is million times answered.
    There is a lot of confusion in the answers, so we want a very clear and justifiable answer.
    please dont post rubish answers by simply copying and pasting from other threads .
    now i will give an example of 2 threads which i seen in the forum.
    1) first thread is like this....
    According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields.
    Select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index.
    2)second post is like this....
    When it comes to performance..select ..up to 1 rows is faster than select single....
    why?
    B'coz, during a select single, the query always hits the database and reads the entire table into memory and fetches the matching single record for you in the memory,
    where as in the case of select up to 1 rows, the query goes to the memory first if found it retrieves the record from there, otherwise the query hits the database.
    3)i seen an simple example in se30 in tips and tricks it shown select single is having better performance than select upto...rows,
    We all really value the best answers..

    hi this is the standard one from the sdn..which will clear the answer..
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/difference%2bbetween%2bselect%2bsingle%2band%2bselect%2bupto
    regards,
    venkat

  • How to 'build' one row only in a 2d array

    Hi
    I'd like to have a 2D array with eg 4 rows, and each time the loop iterates, it should append new data at the end of a specified row (row 0 in example) while the data in the other rows remain unchanged.
    I tried all combinations of build array, replace array subset etc but for some reason I cannot get the rows to extend in length..
    I want the output array in the example to be like:
    2 2 2 2 2 2 2 2 2
    x x x x x x x x x
    x x x x x x x x x
    x x x x x x x x x
    Thus append the data array [2 2 2] 3 times to the first row, and leave the rest unchanged, but all I get is an empty array..
    I've been struggling with this for a few hours now, but I can't find it.. Although I think it's very simple!
    Or should I go fo
    r an entirely different technique like clusters or so?
    Can someone help me out?
    Attachments:
    build_1_row_in_2D_array.vi ‏24 KB

    Khalid,
    thanks for your diagram; it didn't help me because it doesn't really do what I want, but I think the transpose 2D function is pretty interesting anyway!
    I found the solution myself, but I don't know if it's clean programming considering memory etc; I first initialize an array that is big enough to conatain all data and an array containing #row elements for storing the total amount of new data written in a row.
    Then I can build a specified row and by shifting the size of the data already written in that row everything gets in place..
    The loop takes quite a lot of blocks and wires, comments on how to get it smaller are welcome!!
    Attachments:
    build_1_row_in_2D_array_working.vi ‏37 KB
    1_row_in_2d_array.jpg ‏179 KB

  • Return more than one row to display as text?

    I don't know if this is possible or not. I'd rather not create a report for one item.
    is there a way to allow a display as text filed show more than one item from a query? I've tryed several things none work. I have one field that I'd like to show multiple data as just text. but everything I try displays one row only in the field. is there a way around this?

    Nazdev,
    If you're trying to display multiple records as separate parts (not just concatenated together), the easiest solution would be a report. If you just want to append values together and present them in a single item, you should be able to create a query to build your string pretty easily, though you might need to write an Oracle function to do the concatenation for you.
    I wrote a function to do that a while back, obvious you should check it thoroughly before you use it.
    CREATE OR REPLACE FUNCTION cursor_to_list(cur_in IN aeo_misc_tools.string_ref_cur,
                                              delimiter_in IN VARCHAR2 := ', ',
                                              max_len_in IN PLS_INTEGER := 32000,
                                              more_string_in IN VARCHAR2 := 'More...') RETURN VARCHAR2 IS
            Description:    Given single-column ref cursor, return values separated
                            by delimiter parameter value.
                            Trim last trailing delimiter.
            Parameters:     cur_in - opened cursor w/ single string column
                            delimiter_in - separate values w/ this, defaults to comma-space
                            max_len_in - maximum returned length
                            more_string_in - Append if length would be longer than max_len_in
            Returns:        String of separated values
            Author:         Stew Stryker
            Usage:          children_list := cursor_to_list(cur_in => child_cur, delimiter_in => ' | ');
            Note: Can also pass a cursor to this directly, using the CURSOR clause, as follows:
            children_list := cursor_to_list(CURSOR(SELECT pref_mail_name FROM children
                                                WHERE parent_id = '0000055555' ORDER BY dob),
                                delimiter_in => ' | ');
        TYPE single_string_rec_t IS RECORD(
            string_val VARCHAR2(256));
        TYPE string_ref_cur IS REF CURSOR;
        row_value single_string_rec_t;
        ret_list VARCHAR2(32000);
        more_string VARCHAR2(256) := NVL(more_string_in, ' ');
        delim_len CONSTANT PLS_INTEGER := LENGTH(delimiter_in);
        more_len CONSTANT PLS_INTEGER := LENGTH(more_string_in);
        max_len PLS_INTEGER := max_len_in - more_len - delim_len;
    BEGIN
        IF max_len > 0
        THEN
            IF cur_in%ISOPEN
            THEN
                FETCH cur_in
                    INTO row_value;
                WHILE cur_in%FOUND
                LOOP
                    IF NVL(LENGTH(ret_list), 0) + NVL(LENGTH(row_value.string_val), 0) + delim_len <=
                       max_len
                    THEN
                        ret_list := ret_list || row_value.string_val || delimiter_in;
                    ELSIF INSTR(NVL(ret_list, ' '), more_string) = 0
                          AND NVL(LENGTH(row_value.string_val), 0) > 0
                    THEN
                        ret_list := ret_list || more_string;
                    END IF;
                    FETCH cur_in
                        INTO row_value;
                END LOOP;
                -- Strip last delimiter
                ret_list := RTRIM(ret_list, delimiter_in);
                CLOSE cur_in;
            END IF;
        END IF;
        RETURN ret_list;
    EXCEPTION
        WHEN no_data_found THEN
            RETURN ret_list;
        WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE('EXCEPTION IN aeo_misc_tools.cursor_to_list - ' || TO_CHAR(SQLCODE) || ': ' ||
                                 SQLERRM);
            RAISE;
            RETURN ret_list;
    END cursor_to_list;Good luck,
    Stew

  • Result Set only returning one row...

    When I run the following query in my program, I only get one row.
    SELECT * FROM (SELECT * FROM ul_common_log_event WHERE application_name = 'Configuration' ORDER BY cle_id DESC) WHERE ROWNUM <= 500;
    However when I run it in TOAD, I get all the rows I am looking for.
    Here's my java
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(query);
    My record set only contain one row. I am using Oracle 9 OCI driver BTW.
    Any ideas? Thanks!

    Good thinking. That was the first thing I tried. That was not the problem. It turns out that I was stomping my rs object in another method. Problem resolved!
    Thanks for the reply!

  • Oracle database link to MySQL select only one row

    Hello,
    I have created a connection from the Oracle batabase 11.2 to a MySQL database via database link. The following statement shows, that 35 rows 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" from "main_pages"@MOREWEB;
    subject
    Übersicht: Referenzen
    I am using the mysql-connector-odbc-3.51.30-winx64 driver. A newer version cann't be installed because on Windows Server 2008 R2 I get an error with an missing dll-file. The DataDirect-ODBC-driver is not possible, because we like to use the free MySQL-database an DataDirect only support the enterprise edition.
    I also have tried to limit the HS_OPEN_CURSORS or dont limit the HS_FDS_FETCH_ROWS, but there is no difference in the result. I always get only one row.
    HS Init.ora
    # This is a sample agent init file that contains the HS parameters that are
    # needed for the Database Gateway for ODBC
    # HS init parameters
    HS_FDS_CONNECT_INFO = moreweb
    HS_FDS_TRACE_LEVEL = ON
    HS_FDS_FETCH_ROWS=1
    # Environment variables required for the non-Oracle system
    #set <envvar>=<value>
    HS tracefile
    Oracle Corporation --- MITTWOCH   NOV 05 2014 13:56:22.066
    Heterogeneous Agent Release
    11.2.0.1.0
    Oracle Corporation --- MITTWOCH   NOV 05 2014 13:56:22.066
        Version 11.2.0.1.0
    HOSGIP for "HS_FDS_TRACE_LEVEL" returned "ON"
    HOSGIP for "HS_OPEN_CURSORS" returned "50"
    HOSGIP for "HS_FDS_FETCH_ROWS" returned "1"
    HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
    HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
    HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
    HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
    HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
    HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
    HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
    HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
    HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
    HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
    HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
    HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
    HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
    HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
    HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
    using mpgw as default value for "HS_FDS_DEFAULT_OWNER"
    HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
    SQL text from hgopars, id=1, len=36 ...
         00: 53454C45 43542043 4F554E54 282A2920  [SELECT COUNT(*) ]
         10: 46524F4D 20606D61 696E5F70 61676573  [FROM `main_pages]
         20: 60204131                             [` A1]
    Deferred open until first fetch.
    Performing delayed open.
    SQL text from hgopars, id=1, len=40 ...
         00: 53454C45 43542041 312E6073 75626A65  [SELECT A1.`subje]
         10: 63746020 46524F4D 20606D61 696E5F70  [ct` FROM `main_p]
         20: 61676573 60204131                    [ages` A1]
    Deferred open until first fetch.
    Performing delayed open.
    Please can help me someone.
    Thanks.
    Bianca

    mxallen wrote:
    Bianca,
    If you log directly into MySQL and issue the same query (select "subject" from "main_pages";) what data is returned?
    I looks to me that you count is the number of rows in the entire table "main_pages"
    while you select is for the data in the "subject" column only.
    This seems to indicate that you have just one row in that subject column.
    Regards,
    Matt
    WHAATT?
    What do you mean by "just one row in that subject column"?
    That makes no sense at all.  A row is a row.  A column is a part of a row.  All rows have all columns, though not all columns of all rows will necessarily have an assigned value.  Lacking a WHERE clause to filter rows, any SELECT should return all rows.

  • Tabular Form - Setting a default value just on first row.

    Hi all,
    how to set a tabular form default value only in the first row?
    When I click on "add row" I want the new row have a blank value.
    Thanks in advance.

    Hi,
    When you add a new row to the tabular form, any existing rows should be saved to the database. You can, therefore, check for the existence of such records and set the value of a hidden page item accordingly. The default value for a tabular form item can then be based on this hidden item.
    This can be done by setting the Source Used to "Always, ..." on the hidden item called, say, P1_DEPTNO_DEFAULT, and the Source to something like:
    DECLARE
    X NUMBER;
    BEGIN
    SELECT COUNT(*) INTO X FROM EMP WHERE DEPTNO = :P1_DEPTNO;
    IF X > 0 THEN
      RETURN '';
    ELSE
      RETURN :P1_DEPTNO;
    END IF;
    END;This is a "PL/SQL Function Body" Source Type.
    In this example, we are checking if there are any EMP records with a DEPTNO value that matches P1_DEPTNO. If there are, then the tabular form must contain at least one row already, so we return an empty string. If there are no records, the tabular form must be empty, so we return the P1_DEPTNO value.
    The Default settings on the DEPTNO column in the tabular form would then be:
    Default Type: Item (application or page item name)
    Default: P1_DEPTNO_DEFAULT
    Andy

  • How to make only one row detail disclosed in uix:TableDetail

    I display row details to user with <uix:TableDetail>. I'd like to have only one detail displayed in the same time. When the page first loads, all details should be hidden, but whe user shows one another detail and one is already disclosed, only the new one should be displayed.
    I use <bc4juix:Table> and JDev 9.0.3.2
    Thanks in advance

    Viliam,
    The <table> element has the detailDisclosure complex attribute that you should use to control whether the details for table rows are disclosed. You should databind the detailDisclosure attribute to some DataObjectList that has the "disclosed" key set for each DataObject in the list. Then, when you disclose a new row, you should modify the DataObject for the corresponding row in the DataObjectLlist, and ensure that all other DataObjects set the "disclosed" key to false.
    Hope this helps,
    Ryan

  • SRM 4.0- How to set the default values for product type (01) only for SC

    The radio button “Service” should not be visible.
    Also for search help (e.g. search for internal products) where a search should only be possible for product type 01 (goods). The system should not display the product type and internally always search for goods only.
    How to set the default values for product type (01) only for SC
    We needs to use Search help BBPH_PRODUCT which having parameter PRODUCT_TYPE
    Here we can set defalut value 01 but it is not correct one since same search help is using several places.
    We need to limit the search help results only for SC.
    Kindly help out me ASAP.

    The easiest way to set defautl values is to edit the batch class.
    Goto the characteiristic and go to update values.
    In here you probably have something like 0 - 100 as a spec range.
    On the next line enter the default value within this range.  At the end of the line, click in the box in the column labelled "D".  This indicates the defautl value for the characteristic.
    If you need to you can do this in the material classification view as well.
    Just to be clear, these values will only show up in the batch record.  You can not have defautl values in resutls recording screens.
    FF

  • Selecting only one row at a time

    Hi experts,
    i have following doubt regarding selecting rows from a db:
    Is there any way of selecting only one row AT A TIME from a dabase just to collect the data in rows instead of in a unique document containing all the rows?
    I would like you to ellaborate on this as i need to send only one row to the IE, and then other row, and so on... without throwing any error!
    I have seen that there are SELECT SINGLE and SELECT UP TO 1 ROW, but these two methods are only useful when retrieving only one row, and that does not match my requirements. I need to process all the rows but one by one..
    I know that we can use the receiver jdbc adapter as if it was a sender by means of its specific datatype, but how to do it row by row??
    Hope i had explained well..
    Thanks in advance and best regards,
    David

    Hi kiran,
    Yes, my table has 5 not null fields but i am selecting and updating fixes values so i think that I will definetely go for the next solution:
    SELECT * FROM t1 WHERE status='0' and ROWNUM<2;
    UPDATE t1 SET status='1' WHERE status='0' and ROWNUM<2;
    My only concern is if the update will take the same row that the select.... BTW, I think it will
    ..What do you guys think?
    I ve been trying to operate with your proposed queries but i received some errors. Your queries are very interesting but i think that with the above ones i meet my requirements as the status field will be 0 for not processed rows and 1 for precessed ones (and the update will look for the row that meets the same 'where' clause than the select, and then, and only then, it will set status='1').
    The only thing i have to care about is what i questioned before.
    Thanks a lot and best regards,
    David

  • Way to rollback only one row of a view object

    Is there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.
    Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?
    Thanks

    Is there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.In jdev903, a new method is being added to Row interface to reset the row state to the transaction-original state i.e., rollback the row to it's original values.
    Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?No. You may however override before/afterRollback methods on the ViewObjectImpl subclasses to cache the current row key in beforeRollback and restore currency on the default iterator to that rowkey in afterRollback
    Thanks

  • Edit Appraisals:  Notes only shows one row at a time

    Under the Employee Review tab of MSS-->Edit Appraisals, when I click to create an appraisal, the appraisal form in our system has areas to add notes.  However, in the portal, the area to add notes is only 1 row.  It is scrollable, but you can only see one row of text at a time.  How can I expand the notes area/editor to show multiple lines of text?

    Turns out the configuration is on the R/3 side when setting up the Appraisal.  There is an option for number of lines for notes.

Maybe you are looking for

  • Several forecast models

    Hi, I need to see the result of several forecast models. how to do it ? Do I need to create n number of forecast profie to see the result of n number of forecast models or in one profile I can see the result of n number of forecast models. Thanks a l

  • Software Update simply not updating after erase and install.

    Help. I have an intel imac that was recently reinstalled of the OSX after I decided to custom install. Previously, it was running on 10.5.5. I did the erase and install with the option of of selecting the MAC OS Extended (Journaled). As for the custo

  • Completely change language on mountain lion

    Hi, I'm quite new to mac and being French and not knowing what I needed to do to configure it (windows is quite difficult)... so someone dit it for me... (I was watching and it was actually very easy indeed but my problem is, the person configured it

  • Safari 4.0.3 - Snow Leopard 10.6.1 - Top Sites visualization issue

    Well guys, that's my first post here. I made a clean installation of Snow Leopard onto my iMac. The problem is the following : When in Top Sites and I choose a site with many images, the "fading effect" result in a complete corruption of the image un

  • Help! Adding Simple Search to Seeded OA Framework Sreen

    I need to add a simple search screen to seeded OA Framework screen for Supplier Products and Services. Please guide me best approach to hit this. I am also facing following problems: 1. I have no idea about attaching bc4j components. 2. The view obje