C# Update single row in [my]sql

Hi
We found after our Bugzilla upgrade that many comment records where not upgraded correctly due to special characters.
I have found all the old == good and matching new == bad records
Some of the comments can be up to 64k so I don't want to try to do this as a textual update, rather update the row directly
I am after hints how to do this ?
Thanks
try
adaptor = new OdbcDataAdapter(_query, _mySQL);
resultsTable = new DataTable("Results");
adaptor.Fill(resultsTable);
adaptorNew = new OdbcDataAdapter(_query, _mySQLNew);
resultsTableNew = new DataTable("Results");
adaptorNew.Fill(resultsTableNew);
//Console.WriteLine("Bug {0} has {1} comments", i, resultsTable.Rows.Count);
int rowCount = 0;
foreach (DataRow row in resultsTable.Rows)
DataRow newrow = resultsTableNew.Rows[rowCount];
// This checks the comments ids are the same if (row.ItemArray[1].ToString().Equals(newrow.ItemArray[1].ToString()))
// This checks the comments lengths
if (!row.ItemArray[2].ToString().Equals(newrow.ItemArray[2].ToString()))
Console.WriteLine("At id {0}, length differs {1} != {2}", i, row.ItemArray[2].ToString(), newrow.ItemArray[2].ToString());
// To DO - update new record with old record data
// xxxx.update (newrow"comment.text") with row"comment.text"
else
Console.WriteLine("At id {0}, comment ids do not match", i);
rowCount++;
catch
NB: I tried something like below it did not work
Over is [MY]SQL it works, e.g.
update longdescs set thetext='Test by GBR'  where comment_id=625;
HOWEVER for huge text strings, not sure how to handle ' inside the text
// this does not work though NO error is reported object[] rowdata = new object[4];
rowdata[0] = row.ItemArray[0];
rowdata[1] = row.ItemArray[1];
rowdata[2] = row.ItemArray[2];
rowdata[3] = (object)"Test of write"; // row.ItemArray[3];
resultsTableNew.Rows[rowCount].BeginEdit();
resultsTableNew.Rows[rowCount].ItemArray = rowdata;
resultsTableNew.Rows[rowCount].EndEdit();
resultsTableNew.Rows[rowCount].AcceptChanges();
resultsTableNew.AcceptChanges();
And another ps ; No ,matter what ways I use variables @oldtext :oldtext I cant get the var substitution to work  below.
Outcomes : No row updated, row updated showing nothing or "@oldtext"
Something like
"UPDATE longdescs SET thetext = 'my test' WHERE comment_id=123"
will work
string updateText = @"UPDATE longdescs SET thetext = @oldtext WHERE comment_id={0}";
_query2 = string.Format(updateText, row.ItemArray[1]);
// Set @newtext
Console.WriteLine("At id {0}={1}, comment id {2}, length differs {3} != {4}", i, row.ItemArray[0].ToString(), row.ItemArray[1].ToString(), row.ItemArray[2].ToString(), newrow.ItemArray[2].ToString());
if (i == 624)
OdbcCommand sqlComm = new OdbcCommand(_query2, _mySQLNew);
sqlComm.Parameters.AddWithValue("@oldtext", "Test by GBR");
int rowsaffected = sqlComm.ExecuteNonQuery();

Thanks for the reply. It is not possible to do a sample to show the issue because you need the bugzilla DB. Rather hope this issue rings a bell with someone.
Row state goes from "Modified" to "Unchanged" after the resultsTableNew.Rows[rowCount].AcceptChanges(); line. No errors.
Nb: I added "
Allow User Variables=True;" to the connection string.
I suspect the issue is related to MySQL quirk perhaps ?
I am using a 3.51 ODBC connector.
The direct SQL update "update longdescs set thetext='Test by GBR'  where comment_id=625;"
works. Trying to use a var on the right hand side does not.
I expanded the sqlComm object and can see the added parameter in it.
"UPDATE longdescs SET thetext = @oldtext WHERE comment_id=625";
Does not work, i.e. I can't get the var to be used. Text size is usually 1k but can get to 60k in a comment.
>> A manual alternative if someone can suggest how would be fine, as this is a one of fix to 6000 records.  i.e.
- clear comment field
- manually add 8K of info (whatever is the OK size) handling any " or ' in the data streams
- repeat addition of data until comment filled up
(context bugzilla)
               _mySQL =
newOdbcConnection(@"DRIVER={MySQL
ODBC 3.51 Driver}; SERVER=xxxxx; PORT=3306;
                DATABASE=bugs; USER=xxx; PASSWORD=xxx; Allow User Variables=True;
OPTION=0"
                _mySQL.Open();

Similar Messages

  • Updating single row by multiple users at the same time

    Hi,
    I have been asked to develop an application where a single row from a table will be accessed by multiple users. Even multiple users can try to update the same row at the same time. So, to provide a solution of this problem should it be the best way to lock that particular row when user requesting to update it and after completion of commit the lock will be released. In the same time if some other user request to update the same row then it will be in the wait condition.
    Please provide suggestion that is it the best way to handle the situation or not. If it is then can you also please provide an example (with sample code) of it.
    Regards,
    Koushik

    It depends entirely on how the system was built.
    You could relatively easily build an application that does something like
    - Select a row with as last_updated_date column
    - Update the row specifying the last_updated_date you had selected in your WHERE clause
    - If the update updates 1 row, it was successful, otherwise inform the user that the row was already updated.
    In this case, the second user would get an error indicating that the seat had already been purchased.
    You could also relatively easily do a SELECT FOR UPDATE to prevent users from ever getting an error between the time they select a seat and the time they finish their transaction. Of course, if the user wanders away from the computer, or inadvertently ends up locking dozens of rows, this tends to rather problematic in practice. You may find that when the train pulls out of the station, someone that never ended up buying a ticket has locked a dozen rows so you lost a dozen sales. If you have a call center where operators are reserving seats for people on the phone, you may decide that explicit locking is more appropriate because you're confident that the operators aren't going to leave tickets locked for long periods of time and the cost of having the customer walked through the seat selection process multiple times would be higher than the cost of having rows locked longer than they need to be.
    Justin

  • How to update single row of ms access database

    Hi All,
    can somebody tell me how can i edit/update a single row of ms access database?
    let say i want to edit the first row of the figure in the left. What i want is when i click in the row, it will pop up a window where i can edit the fields content. or may be is it possible to add a column with "edit" text which link to the appropriate row. so when i click the "edit" it will open the edit window.
    Thank you

    If you use a multi-column listbox indicator there is a "double-click" event that you can capture with an event structure. The event, when fired, returns the row that the user double-clicked. Use that parameter to fetch/modify the data as needed. Remember that to update the data in the database the table containing the data must have a primary key - or at lease something you can use to uniquely identify the rows.
    Remember that in a database, there is no such thing as "the first row"; you have to explicitly identify which row you wish to modify.
    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

  • How to merge three columns values to single row values in sql server 2008

    Hi Frds.....
    I have three quantity in my table.
    Quantity1,quantity2,quantity3
    this three quantity have different values
    ex:
    quantity1 = 1000,quantity2=2000,quantity3=3000
    the three column combine 2 display in single row values. this values display in one by one.
    ex: quantity
         1000
         2000
         3000

    You will need to use the UNPIVOT operator:
    DECLARE @example TABLE
    Id int NOT NULL IDENTITY(1,1),
    Quantity1 int,
    Quantity2 int,
    Quantity3 int
    INSERT INTO @example VALUES (1000, 2000, 3000), (4000, 5000, 6000);
    SELECT * FROM @example;
    SELECT Id, Quantity, QuantityType
    FROM @example
    UNPIVOT
    Quantity FOR QuantityType IN (Quantity1, Quantity2, Quantity3)
    ) AS u;
    Output:
    (2 row(s) affected)
    Id Quantity1 Quantity2 Quantity3
    1 1000 2000 3000
    2 4000 5000 6000
    (2 row(s) affected)
    Id Quantity QuantityType
    1 1000 Quantity1
    1 2000 Quantity2
    1 3000 Quantity3
    2 4000 Quantity1
    2 5000 Quantity2
    2 6000 Quantity3
    (6 row(s) affected)

  • UPDATE single ROW from DATAGRID without refreshing the entire ItemsSource

    Hello there,
       I have a simple datagrid that has an ItemsSource of ObjectQuery<DbDataRecord>.
       Let's say I want to refresh a single row from the datagrid, (Because a specific item i know has been changed) without refreshing the entire ItemsSource because the source query is quite big.
    Any ideas?
    Thanks.
    -- Jorge_M_P

    Whilst you could raise property changed on every field in an item, that would of course mean implementing inotifypropertychanged on a wrapper object, then iterating all of those properties.
    An observablecollection implements the INotifyCollectionChanged interface.
    Amongst the possibilities for changes which that notifies are this one:
    https://msdn.microsoft.com/en-us/library/ms653207(v=vs.110).aspx
    Which notifies of a single item change.
    I usually wrap my entity framework objects.
    Sometimes I wrap all the properties so I can do change tracking in the viewmodel.
    This is a technique similar to the one I use in this sample:
    https://gallery.technet.microsoft.com/WPF-Highlight-Changed-a77976d4
    Which wraps plain classes - but the principle is the same.
    And
    I wrap the object and expose that, as I do in this:
    http://social.technet.microsoft.com/wiki/contents/articles/28209.wpf-entity-framework-mvvm-walk-through-1.aspx
    Note that because I wrap the same objects returned from EF, there is very little overhead in using an observable collection there.
    Hope that helps.
    Recent Technet articles:
    Property List Editing ;  
    Dynamic XAML

  • Connecting JDBC Single Row Query to SQL Server 2008

    Hello,
    I am new to workbench and am having a very dificult time accessing a database and running a query on it. I have searched a lot on the internet for suggestion on how to accomplish this but nothing has worked. The LiveCycle was intaled on the same server that the SQL Server is sintalled, and was installed by an administrator who is no longer at our company. So I am trying to have the user input an account number into the form I have created, then take that account number and use an xpath expression to query the database and extract the information for that account. Could anyone please help me set this up.
    I Changed my my-db2-ds.xml to the following:
    <local-tx-datasource>
      <jndi-name>SQLDB_IMACS</jndi-name>
      <connection-url>jdbc:sqlserver://CBS-SQL-001;databaseName=DB_IMACS;integratedSecurity=tru e;</connection-url>
      <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
    </local-tx-datasource>
    and I get the following error message:
    Exception: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.microsoft.sqlserver.jdbc.SQLServerDriver; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: com.microsoft.sqlserver.jdbc.SQLServerDriver)); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.microsoft.sqlserver.jdbc.SQLServerDriver; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: com.microsoft.sqlserver.jdbc.SQLServerDriver)))
    I have the following file sqljdbc.jar in my Adobe LiveCycle ES2\jboss\server\lc_turnkey\lib\ folder.
    If you could please let me know what I can do to connect that would be very useful.
    Thanks,
    sgarciacode19

    You will need to use the UNPIVOT operator:
    DECLARE @example TABLE
    Id int NOT NULL IDENTITY(1,1),
    Quantity1 int,
    Quantity2 int,
    Quantity3 int
    INSERT INTO @example VALUES (1000, 2000, 3000), (4000, 5000, 6000);
    SELECT * FROM @example;
    SELECT Id, Quantity, QuantityType
    FROM @example
    UNPIVOT
    Quantity FOR QuantityType IN (Quantity1, Quantity2, Quantity3)
    ) AS u;
    Output:
    (2 row(s) affected)
    Id Quantity1 Quantity2 Quantity3
    1 1000 2000 3000
    2 4000 5000 6000
    (2 row(s) affected)
    Id Quantity QuantityType
    1 1000 Quantity1
    1 2000 Quantity2
    1 3000 Quantity3
    2 4000 Quantity1
    2 5000 Quantity2
    2 6000 Quantity3
    (6 row(s) affected)

  • Updating multiples rows in a trigger

    Hello All,
    I need to update multiple rows in a table based on some condition, do you have any ideas doing it?
    I know we can update single row using :NEW, but this time we need to update like 10 rows in a table.
    Thanks in advance for your reply.
    With Regards,
    SK
    CREATE OR REPLACE TRIGGER stsc.dfutoskuallocfactor_trig
    BEFORE UPDATE
    ON stsc.dfutosku
    FOR EACH ROW
    DECLARE
    v_dmdunit CHAR (30);
    v_dmdgroup CHAR (30);
    v_loc CHAR (30);
    BEGIN
    --dfutosku
    INSERT INTO igpmgr.dfutosku_upd_rec
    VALUES (:OLD.dmdunit, :OLD.dmdgroup, :OLD.dfuloc);
    --FOR rec IN (SELECT DISTINCT dmdunit, dmdgroup, dfuloc, eff, disc
    -- FROM stsc.dfutosku_upd_rec)
    --LOOP
    -- IF (rec.eff <> '01-Jan-1970' OR rec.eff >= SYSDATE)
    -- THEN
    -- DBMS_OUTPUT.put_line ('STAGE3 ' || ' ' || rec.eff);
    v_dmdunit := 'PLY 4-000';
    v_dmdgroup := 'TRD';
    v_loc := '48441';
    IF (v_dmdunit = 'PLY 4-000' AND v_dmdgroup = 'TRD' AND v_loc = '48441')
    THEN
    :NEW.udc_error := 1;
    END IF;
    --igpmgr.
    pkg_updateAllocfactor.allocfactor_update(o_return_code OUT NOCOPY PLS_INTEGER);
    --END IF;
    -- END LOOP;
    END;
    /

    also posted in
    {thread:id=1773210}
    Updating multiple rows of the same table in a trigger

  • SQL Update a Single Row Multiple Times Using 2 Data Sets

    I'm working in tsql and have an issue where I need to do multiple updates to a single row based on multiple conditions. 
    By Rank_
    If the column is NULL I need it to update no matter what the Rank is.
    If the Ranks are the same I need it to update in order of T2_ID.
    And I need it to use the last updated output.
    I've tried using the update statement below but it only does the first update and the rest are ignored. Here is an example of the data sets i'm working w/ and the Desired results. Thanks in advance!
    update a
    set Middle = case when a.Rank_> b.Rank_ OR a.Middle IS NULL then ISNULL(b.Middle,a.Middle) end,
    LName = case when a.Rank_> b.Rank_ OR a.Lname IS NULL then ISNULL(b.LName,a.LName) end,
    Rank_ = case when a.Rank_> b.Rank_ then b.Rank_ end
    from #temp1 a
    inner join #temp2 b on a.fname = b.fname
    where b.T2_ID in (select top 100% T2_ID from #temp2 order by T2_ID asc)

    The Merge clause actually errors because it attempt to update the same record.  I think this CTE statement is the closest I've come but I'm still working through it as I'm not too familiar w/ them.  It returns multiple rows which I will have to
    insert into a temp table to update since the resulting row I need is the last in the table.
    ;WITH cteRowNumber
    AS(
    Select DISTINCT
    Row_Number() OVER(PARTITION BY a.LName ORDER BY a.LName ASC, a.Rank_ DESC,b.T2ID ASC) AS RowNumber
    ,a.FName
    ,a.LName
    ,b.LName as xLname
    ,a.MName
    ,b.MName AS xMName
    ,a.Rank_
    ,b.Rank_ AS xRank
    ,b.T2ID
    FROM #temp1 a
    inner join #temp2 b
    ON a.fname = b.fname
    ), cteCursor
    AS(
    Select a.RowNumber,
    a.Fname
    ,a.LName
    ,a.xLname
    ,a.MName
    ,a.xMName
    ,a.xRank
    ,a.T2ID
    ,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xRank,a.Rank_) else ISNULL(a.Rank_,a.xRank) end AS Alt_Rank_
    ,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xMName,a.MName) else ISNULL(a.MName,a.xMName) end AS Alt_MName
    ,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xLName,a.lname) else ISNULL(a.LName,a.xlname) end as Alt_Lname
    FROM cteRowNumber a
    where a.RowNumber = 1
    UNION ALL
    Select crt.RowNumber
    ,crt.FName
    ,crt.LName
    ,crt.xLname
    ,crt.MName
    ,crt.xMName
    ,crt.xRank
    ,crt.T2ID
    ,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xRank,Prev.Alt_Rank_) else ISNULL(Prev.Alt_Rank_,crt.xRank) end AS Alt_Rank
    ,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xMName,Prev.Alt_MName) else ISNULL(Prev.Alt_MName,crt.xMName) end AS Alt_MName
    ,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xLName,Prev.Alt_Lname) else ISNULL(Prev.Alt_Lname,crt.xLName) end as Alt_Lname
    FROM cteCursor prev
    inner join cteRowNumber crt
    on prev.fname = crt.fname and prev.RowNumber + 1 = crt.RowNumber
    SELECT cte.*
    FROM cteCursor cte

  • Single-row subquery returns more than one row - help with update

    Hello,
    I know this a probably a well documented question but when I checked the search I couldn't find anything relevant to my needs.
    I am getting the single-row error when I run this query, i have tried a where exists clause and where column_name in to no avail. Can anyone put me right with this?
    My code is:
    UPDATE test_sales
    SET total =
                (SELECT
                        p.list_price * t.quantity
                  FROM 
                        test_sales t,
                        price p
                  WHERE
                        t.product_code IN p.product_id
                  AND
                        TO_DATE(TO_CHAR(t.order_date,'DD-MON-RR')) >= TO_DATE(TO_CHAR(p.start_date,'DD-MON-RR'))
                  AND
                        TO_DATE(TO_CHAR(t.order_date,'DD-MON-RR')) <= TO_DATE(TO_CHAR(p.end_date,'DD-MON-RR'))
                  AND    
                        t.ship_date IS NOT NULL)the query runs fine on its own and returne 4638 rows which is the number I need to update but it wont work as part of and update. I have also tried this:
    UPDATE test_sales
    SET total =
                (SELECT
                        p.list_price * t.quantity
                  FROM 
                        test_sales t,
                        price p
                  WHERE
                        t.product_code IN p.product_id
                  AND
                        TO_DATE(TO_CHAR(t.order_date,'DD-MON-RR')) >= TO_DATE(TO_CHAR(p.start_date,'DD-MON-RR'))
                  AND
                        TO_DATE(TO_CHAR(t.order_date,'DD-MON-RR')) <= TO_DATE(TO_CHAR(p.end_date,'DD-MON-RR'))
                  AND    
                        t.ship_date IS NOT NULL)
    WHERE product_code IN 
                (SELECT
                        product_code
                  FROM 
                        test_sales t,
                        price p
                  WHERE
                        t.product_code = p.product_id
                  AND
                        TO_DATE(TO_CHAR(t.order_date,'DD-MON-RR')) >= TO_DATE(TO_CHAR(p.start_date,'DD-MON-RR'))
                  AND
                        TO_DATE(TO_CHAR(t.order_date,'DD-MON-RR')) <= TO_DATE(TO_CHAR(p.end_date,'DD-MON-RR'))
                  AND    
                        t.ship_date IS NOT NULL)but that wont work either. by uising WHERE and AND clauses that select a match first on product code and then place the order_date in between the start and finish times of a distinct pricing period for each item I figured this would work but it won't. Any ideas what to try?
    Mike

    or:
    SQL> create table test_sales
      2  as
      3  select 2 quantity, 1 product_code, trunc(sysdate) order_date, trunc(sysdate) ship_date, 0 total from dual
      4  /
    Tabel is aangemaakt.
    SQL> create table price
      2  as
      3  select 10 list_price, 1 product_id, trunc(sysdate) start_date, trunc(sysdate) end_date from dual
      4  /
    Tabel is aangemaakt.
    SQL> alter table price add constraint price_pk primary key (product_id)
      2  /
    Tabel is gewijzigd.
    SQL> update ( select p.list_price * t.quantity a
      2                , t.total
      3             from test_sales t
      4                , price p
      5            where t.product_code = p.product_id
      6              and t.order_date between p.start_date and p.end_date
      7              and t.ship_date is not null
      8         )
      9     set total = a
    10  /
    1 rij is bijgewerkt.Regards,
    Rob.

  • Need help in SQL Query: Update a row in a table & insert the same row into another table

    I want to update a row in a table say Table A and the updated row should be inserted into another table say Table B. I need to do it in a single SQL query and i don't want to do it in PL/SQL with triggers. And i tried with MERGE statement but its working with this scenario. (Note: I'm using Oracle Database 10g Enterprise Edition Release 10.2.0.1.0).
    Thanks in Advance.

    Using Sven's code as an example, you could save the updated row in a sql plus variable. (also untested):
    SQL> var v_id number
    update tableA  
    set colB='ABC' 
    where colC='XYZ' 
    returning id into :v_id;
    insert into table A_History (ID, colA, colB, ColC)  
    select id, ColA, ColB, ColC  
    from tableA  
    where id = :v_id;   

  • After Update Trigger executes twice when single row is uptd thro proc

    We have the below trigger in our db. When a single record is updated using a procedure the trigger is executed twice and it inserts two records in other table.
    But when i issue an update statement using any sql client tool it is executing only once and inserts only one record in other table.
    Can any one please help me to find the reason?
    Trigger:*
    create or replace TRIGGER CX_HEADER_ESCL_T1 AFTER UPDATE OF STATUS ON CX_HEADER
    FOR EACH ROW
    DECLARE
    "b1-CTRIYJ" boolean := FALSE;
    BEGIN
    IF UPDATING('STATUS') AND(:NEW.status = 'SUCCESS') THEN
    "b1-CTRIYJ" := TRUE;
    END IF;
    IF "b1-CTRIYJ" = TRUE THEN
    INSERT
    INTO siebel.s_escl_req(req_id, created, bt_row_id, rule_id, tbl_name, created_by, group_id)
    VALUES('11111111', CURRENT_DATE, :NEW.row_id, '1-CTRIYJ', 'CX_HEADER', :NEW.last_upd_by, '1-2CU3');
    "b1-CTRIYJ" := FALSE;
    END IF;
    END;
    Procedure:
    CREATE OR REPLACE
    PROCEDURE CLOSE_BATCH
    (ChildRecordCount IN NUMBER, HeaderId IN VARCHAR2, CompletionStatus OUT VARCHAR2) AS
    CafeChildCount NUMBER;
    BEGIN
    select count(*) into CafeChildCount from SIEBEL.CX_CHILD where HEADER_ID=HeaderId;
    IF ChildRecordCount = CafeChildCount THEN
    update SIEBEL.CX_HEADER set STATUS ='SUCCESS', MODIFICATION_NUM = MODIFICATION_NUM+1 where HEADER_ID=HeaderId;
    CompletionStatus := 'SUCCESS';
    ELSE
    update SIEBEL.CX_CHILD set STATUS='FAILED' where HEADER_ID=HeaderId;
    update SIEBEL.CX_HEADER set STATUS='FAILED' where HEADER_ID=HeaderId;
    CompletionStatus := 'FAILED';
    END IF;
    commit;
    /*CompletionStatus := 'SUCCESS';*/
    EXCEPTION
    WHEN OTHERS THEN
    CompletionStatus := SQLCODE;
    rollback;
    END;

    Your problem seems not be related to the trigger restart issue I have already mentioned because you are using a AFTER UPDATE trigger and not a BEFORE UPDATE trigger:
    >
    BEFORE Triggers Fired Multiple Times
    If an UPDATE or DELETE statement detects a conflict with a concurrent UPDATE, then Oracle Database performs a transparent ROLLBACK to SAVEPOINT and restarts the update. This can occur many times before the statement completes successfully. Each time the statement is restarted, the BEFORE statement trigger is fired again. The rollback to savepoint does not undo changes to any package variables referenced in the trigger. Your package should include a counter variable to detect this situation.
    >
    If you are sure that you update a single row and that your trigger fires twice and if you can easiily reproduce the issue, I recommend that you contact Oracle Support and create a Service Request for your issue that could be an Oracle bug.

  • Bold a single row in a Report based on SQL Query

    Should be easy? So, how do I bold a single row in a report based on SQL query without creating a new template or writing Java for the page? What is the Tabular Form Element "Element Attributes" field for? Or what am I supposed to put in there to make it do anything?

    One way to do this is to add a hidden column to your report which contains the formatting value, for example:
    select empno
    , ename
    , sal
    , decode(empno,1,'font-weight:bold','font-weight:normal') style
    from emp
    Hide the STYLE column.
    Then you can use this column for each column in Column Formatting > HTML expression in this way:
    <span style="#STYLE#">#SAL#</span>
    Unfortunately you have to do this for each colum you want to appear bold.
    good luck,
    Dirk Dral

  • How to update a single row of data table

    How we can update a single row of the data table by clicking the button in the same row.
    Thanks in Advance.

    Hi!
    What do You mean 'update'? Get fresh data from DB or change data and commit it in DB?
    If commit, try to read here:
    http://developers.sun.com/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    Thanks,
    Roman.

  • Please help with an sql to show more than one records into single row for each student

    From the following data I would like to create an sql to get the information  as the following layout
    studentid,  firstTerm,  EnglishMark1,ScienceMark1,MathsMark1, Secondterm,EnglishMark2,ScienceMark2,MathsMark2,
    ThirdTerm,EnglishMark3,ScienceMark3,MathsMark3 // As single rows for each student
    Example
    1 First, 30,40,20,Sec,30,40,20,  simillarly next row for next row for another sudent. Please help to generate the sql for the same.
    Please help it would be very appreciate.
    With Thanks
    Pol
    polachan

    create table yourdata (studentid int, term varchar(10), section varchar(50), Mark int)
    insert into yourdata values
    (1,'First','Math',20),(1,'First','English',30),(1,'First','Science',40),
    (2,'First','Math',20),(2,'First','English',30),(2,'First','Science',40),
    (3,'First','Math',20),(3,'First','English',30),(3,'First','Science',40),
    (1,'Sec','Math',20),(1,'Sec','English',30),(1,'Sec','Science',40),
    (2,'Sec','Math',20),(2,'Sec','English',30),(2,'Sec','Science',40),
    (3,'Sec','Math',20),(3,'Sec','English',30),(3,'Sec','Science',40)
    Select studentid
    ,max(case when term='First' and section='English' Then Mark End) as EnglishMark1
    ,max(case when term='First' and section='Science' Then Mark End) as ScienceMark1
    ,max(case when term='First' and section='Math' Then Mark End) as MathMark1
    ,max(case when term='Sec' and section='English' Then Mark End) as EnglishMark2
    ,max(case when term='Sec' and section='Science' Then Mark End) as ScienceMark2
    ,max(case when term='Sec' and section='Math' Then Mark End) as MathMark2
    ,max(case when term='Third' and section='English' Then Mark End) as EnglishMark3
    ,max(case when term='Third' and section='Science' Then Mark End) as ScienceMark3
    ,max(case when term='Third' and section='Math' Then Mark End) as MathMark3
    From yourdata
    Group by studentid
    drop table yourdata

  • Deadlock when updating different rows on a single table with one clustered index

    Deadlock when updating different rows on a single table with one clustered index. Can anyone explain why?
    <event name="xml_deadlock_report" package="sqlserver" timestamp="2014-07-30T06:12:17.839Z">
      <data name="xml_report">
        <value>
          <deadlock>
            <victim-list>
              <victimProcess id="process1209f498" />
            </victim-list>
            <process-list>
              <process id="process1209f498" taskpriority="0" logused="1260" waitresource="KEY: 8:72057654588604416 (8ceb12026762)" waittime="1396" ownerId="1145783115" transactionname="implicit_transaction"
    lasttranstarted="2014-07-30T02:12:16.430" XDES="0x3a2daa538" lockMode="X" schedulerid="46" kpid="7868" status="suspended" spid="262" sbid="0" ecid="0" priority="0"
    trancount="2" lastbatchstarted="2014-07-30T02:12:16.440" lastbatchcompleted="2014-07-30T02:12:16.437" lastattention="1900-01-01T00:00:00.437" clientapp="Internet Information Services" hostname="CHTWEB-CH2-11P"
    hostpid="12776" loginname="chatuser" isolationlevel="read uncommitted (1)" xactid="1145783115" currentdb="8" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128058">
               <inputbuf>
    UPDATE analyst_monitor SET cam_status = N'4', cam_event_data = N'sales1', cam_event_time = current_timestamp , cam_modified_time = current_timestamp , cam_room = '' WHERE cam_analyst_name=N'ABCD' AND cam_window= 2   </inputbuf>
              </process>
              <process id="process9cba188" taskpriority="0" logused="2084" waitresource="KEY: 8:72057654588604416 (2280b457674a)" waittime="1397" ownerId="1145783104" transactionname="implicit_transaction"
    lasttranstarted="2014-07-30T02:12:16.427" XDES="0x909616d28" lockMode="X" schedulerid="23" kpid="8704" status="suspended" spid="155" sbid="0" ecid="0" priority="0"
    trancount="2" lastbatchstarted="2014-07-30T02:12:16.440" lastbatchcompleted="2014-07-30T02:12:16.437" lastattention="1900-01-01T00:00:00.437" clientapp="Internet Information Services" hostname="CHTWEB-CH2-11P"
    hostpid="12776" loginname="chatuser" isolationlevel="read uncommitted (1)" xactid="1145783104" currentdb="8" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128058">
                <inputbuf>
    UPDATE analyst_monitor SET cam_status = N'4', cam_event_data = N'sales2', cam_event_time = current_timestamp , cam_modified_time = current_timestamp , cam_room = '' WHERE cam_analyst_name=N'12345' AND cam_window= 1   </inputbuf>
              </process>
            </process-list>
            <resource-list>
              <keylock hobtid="72057654588604416" dbid="8" objectname="CHAT.dbo.analyst_monitor" indexname="IX_Clust_scam_an_name_window" id="lock4befe1100" mode="X" associatedObjectId="72057654588604416">
                <owner-list>
                  <owner id="process9cba188" mode="X" />
                </owner-list>
                <waiter-list>
                  <waiter id="process1209f498" mode="X" requestType="wait" />
                </waiter-list>
              </keylock>
              <keylock hobtid="72057654588604416" dbid="8" objectname="CHAT.dbo.analyst_monitor" indexname="IX_Clust_scam_an_name_window" id="lock18ee1ab00" mode="X" associatedObjectId="72057654588604416">
                <owner-list>
                  <owner id="process1209f498" mode="X" />
                </owner-list>
                <waiter-list>
                  <waiter id="process9cba188" mode="X" requestType="wait" />
                </waiter-list>
              </keylock>
            </resource-list>
          </deadlock>
        </value>
      </data>
    </event>

    To be honest, I don't think the transaction is necessary, but the developers put it there anyway. The select statement will put the result cam_status
    into a variable, and then depends on its value, it will decide whether to execute the second update statement or not. I still can't upload the screen-shot, because it says it needs to verify my account at first. No clue at all. But it is very simple, just
    like:
    Clustered Index Update
    [analyst_monitor].[IX_Clust_scam_an_name_window]
    cost: 100%
    By the way, for some reason, I can't find the object based on the associatedObjectId listed in the XML
    <keylock hobtid="72057654588604416" dbid="8" objectname="CHAT.dbo.analyst_monitor"
    indexname="IX_Clust_scam_an_name_window" id="lock4befe1100" mode="X" associatedObjectId="72057654588604416">
    For example: 
    SELECT * FROM sys.partition WHERE hobt_id = 72057654588604416
    This return nothing. Not sure why.

Maybe you are looking for

  • Cant login to my macbook pro

    Want to reset to factory setting but cant asks me for password i don't remember the password neither do i remember creating one. How do i reset to the older version cant even lo in to the older one anymore.

  • Problem pairing with bluetooth and Mi Band Device.

    Hi, I have problem pairing my Iphone 5 to a my Mi Band device. After turning on my Bluetooth in the setting page, my iPhone just keep on goes into searching mode and does not detach anything. Please help. thanks

  • No Such Provider Exception SunJSSE

    Hello, We are facing problem using SunJSSE with WebSphere4.0. We placed jsse jars in the jre/lib/ext directory and in our code we are trying to create SSLcontext as below context = SSLContext.getInstance("SSL","SunJSSE"); tmFact=TrustManagerFactory.g

  • I have Photoshop Elements 6 and am dealing with the GIF frame delay bug. Must I upgrade?

    I am dealing with the Photoshop Elements 6 GIF animation frame delay bug. I understand there has not been a fix for some time so I want to know if one has been developed. If not what do I have to do to address this. Can I get an upgrade? What steps d

  • Where does cache go when you clear it?

    Hello- I have cleared my cache (as directed on the Adobe support page) in hopes of opening a project that won't open. That was unsuccessful and I need to get to the cache file. Does anyone know how to retrieve this file? I don't see it in my recycle