Update multiple rows in a dynamic table Dreamweaver CS5.5

hello there
i want to update multiple rows which comes from a dynamic table in Dreamweaver CS5 (a loop in php) here is my Mysql table :
sql code
CREATE TABLE `register`.`s_lessons` (
`lid` int( 5 ) NOT NULL ,
`sid` int( 9 ) NOT NULL ,
`term` int( 5 ) NOT NULL ,
`tid` int( 5 ) NOT NULL ,
`point` double NOT NULL DEFAULT '0',
PRIMARY KEY ( `lid` , `sid` , `term` ) ,
KEY `tid` ( `tid` ) ,
KEY `point` ( `point` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_persian_ci;
and this is my page source code:
php file
<?php require_once('../Connections/register.php'); ?>
<?php
session_start();
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  return $theValue;
$colname1_rs1 = "-1";
if (isset($_GET['term'])) {
  $colname1_rs1 = $_GET['term'];
$colname_rs1 = "-1";
if (isset($_GET['lid'])) {
  $colname_rs1 = $_GET['lid'];
$colname2_rs1 = "-1";
if (isset($_SESSION['tid'])) {
  $colname2_rs1 = $_SESSION['tid'];
mysql_select_db($database_register, $register);
$query_rs1 = sprintf("SELECT s_lessons.sid, s_lessons.lid, s_lessons.term, s_lessons.tid, s_lessons.point FROM s_lessons WHERE s_lessons.lid = %s AND s_lessons.term = %s AND s_lessons.tid  = %s", GetSQLValueString($colname_rs1, "int"),GetSQLValueString($colname1_rs1, "int"),GetSQLValueString($colname2_rs1, "int"));
$rs1 = mysql_query($query_rs1, $register) or die(mysql_error());
$row_rs1 = mysql_fetch_assoc($rs1);
$totalRows_rs1 = mysql_num_rows($rs1);
$count=mysql_num_rows($rs1);
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
for ($j = 0, $len = count($_POST['lid']); $j < $len; $j++) {
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE s_lessons SET point=%s WHERE tid=%s, lid=%s, sid=%s, term=%s",
                       GetSQLValueString($_POST['point'] [$j], "double"),
                            GetSQLValueString($_SESSION['tid'], "int"),
                       GetSQLValueString($_POST['lid'] [$j], "int"),
                            GetSQLValueString($_POST['sid'] [$j], "int"),
                            GetSQLValueString($_POST['term'] [$j], "int"));
  mysql_select_db($database_register, $register);
  $Result1 = mysql_query($updateSQL, $register) or die(mysql_error());
  $updateGoTo = "student_lists.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  header(sprintf("Location: %s", $updateGoTo));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>r</title>
<link href="styles/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="styles/in_styles.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
     <div id="header-wrapper">
     </div>
     <!-- end #header -->
     <div id="page">
          <div id="page-bgtop">
               <div id="page-bgbtm">
                    <div id="content">
                         <div class="post">
                           <div style="clear: both;">
                        <form name="form1" id="form1" method="post" action="<?php echo $editFormAction; ?>">
                        <table border="1" align="center">
                          <tr>
                            <th>Student ID</th>
                            <th>Lesson ID</th>
                            <th>Semester</th>
                            <th>Point</th>
                          </tr>
                          <?php do { ?>
                            <tr>
                              <td class="data"><label for="sid[]"></label>
                              <input name="sid[]" type="text" id="sid[]" value="<?php echo $row_rs1['sid']; ?>" size="9" readonly="readonly" /></td>
                              <td class="data"><label for="lid[]"></label>
                              <input name="lid[]" type="text" id="lid[]" value="<?php echo $row_rs1['lid']; ?>" size="5" readonly="readonly" /></td>
                              <td class="data"><label for="term[]"></label>
                              <input name="term[]" type="text" id="term[]" value="<?php echo $row_rs1['term']; ?>" size="4" readonly="readonly" /></td>
                              <td><label for="point[]"></label>
                                <input name="point[]" type="text" id="point[]" value="<?php echo $row_rs1['point']; ?>" size="4" />                             
                          </tr>
                            <?php } while ($row_rs1 = mysql_fetch_assoc($rs1)); ?>
                        </table>
                        <p>
                          <input type="submit" name="Submit" id="Submit" value="Submit" />
                          <input type="hidden" name="MM_update" value="form1" />
                        </p>
                        </form>
                           </div>
                         </div>
                    <div style="clear: both;">
                </div>
                    </div>
                    <!-- end #content -->
                    <!-- end #sidebar -->
                    <div style="clear: both;"> </div>
               </div>
          </div>
     </div>
     <!-- end #page -->
</div>
<!-- end #footer -->
</body>
</html>
<?php
mysql_free_result($rs1);
?>
All i want is that when users click on SUBMIT button values of point column in s_lessons(database table) be updated by new entries from user.
i did my best and result with that code is :
You  have an error in your SQL syntax; check the manual that corresponds to  your MySQL server version for the right syntax to use near ' lid=888,  sid=860935422, term=902' at line 1
I would appreciate any idea.
with prior thanks

Go to the Row Properties, and in the Visibility tab, you have "Show or hide based on an expression". You can use this to write an expression that resolves to true if the row should be hidden, false otherwise.
Additionally, in the Matrix properties you should take a look at the filters section, perhaps you can achieve what you wish to achieve through there by removing the unnecessary rows instead of just hiding them.
It's only so much I can help you with the limited information. If you require further help, please provide us with more information such as what data are you displaying, what's the criteria to hiding rows, etc...
Regards
Andrew Borg Cardona

Similar Messages

  • Hide multiple rows in a dynamic table based on the row value.

    Hi,
    I need to hide multiple rows in a dynamic table based on the specific value of that row.
    I cant find the right expression to do that.
    please help

    Go to the Row Properties, and in the Visibility tab, you have "Show or hide based on an expression". You can use this to write an expression that resolves to true if the row should be hidden, false otherwise.
    Additionally, in the Matrix properties you should take a look at the filters section, perhaps you can achieve what you wish to achieve through there by removing the unnecessary rows instead of just hiding them.
    It's only so much I can help you with the limited information. If you require further help, please provide us with more information such as what data are you displaying, what's the criteria to hiding rows, etc...
    Regards
    Andrew Borg Cardona

  • How to update multiple row using procedure in table

    Hi,
    create or replace procedure TESTLEDGER1(var_date varchar2)
    as
    var_date1 date;
    CURSOR C1 IS
    select DISTINCT ta.accountid,day PROCESSDATE,
    (NVL(payment,0))PAYMENT,NVL(TOTALDUE,0)TOTALDUE,NVL(currentbillamount,0)CURBILL,NVL(srf,0)SRF,NVL(sbpnt,0)sbpnt,
    NVL(srv,0)SRV,NVL(sbf,0)SBF,NVL(SBV,0)SBV,NVL(EF,0)EF,NVL(EV,0)EV,NVL(TSRV,0)TSRV,
    NVL(tsub,0)TSUB,NVL(teqe,0)TEQE,NVL(DT,0)DT,
    NVL(A.dep,0)RDEP,NVL(B.DEP,0)PDEP,
    NVL(pnt,0)PNT,NVL(eqp,0)EQP,NVL(dtr,0)DTR,NVL(drf,0)DRF,NVL(unadj,0)UNADJ
    from
    (select DISTINCT day ,accountid
    from
    syntblmaccount, tblmtime where yyyy =2010)ta,
    (SELECT accountid,
    SUM(srfee)srf,
    SUM(srvat)srv,
    SUM(subfee)sbf,
    SUM(subvat)sbv,
    SUM(eqefee)ef,
    SUM(eqevat)ev,
    SUM(ttlsrv)tsrv,
    SUM(ttlsub)tsub,
    SUM(ttleqe)teqe,
    SUM(dep)dep,
    SUM(dt)dt,trunc(fromdate)fromdate
    FROM VWDT_v2
    GROUP BY accountid,trunc(fromdate)
    )a,
    (SELECT accountid,
    SUM(pnt)pnt,
    SUM(subpnt)sbpnt,
    SUM(eqpnt)eqp,
    SUM(dep)dep,
    SUM(DEPTRANSFER)dtr,
    SUM(DEPREFUNDED)drf,
    SUM(unadj)unadj,trunc(paymentdate)paymentdate
    FROM vwkt_v4
    GROUP BY accountid,trunc(paymentdate)
    )b,
    (SELECT ACCOUNTID,REFUND,trunc(createdate) createdate FROM vwrefund)F,
    ( SELECT ACCOUNTID,
    TRUNC(CREATEDATE)CREATEDATE,
    sum(TOTALDUE)/100 TOTALDUE,sum(currentbillamount)currentbillamount
    FROM SYNTBLTDEBITDOCUMENT
    group by ACCOUNTID, TRUNC(createdate))debit,
    (SELECT ACCOUNTID accountid,TRUNC(createdate)CREATEDATE, SUM(totalamount)PAYMENT
    from syntbltcreditdocument
    where CREDITDOCUMENTTYPEID IN ('CDT01','CDT04')
    -- AND ACCOUNTID='ACC000003014'
    group by accountid,TRUNC(createdate))credit
    where ta.accountid=a.accountid(+)
    and ta.accountid=b.accountid(+)
    --and ta.accountid=pay.accountid(+)
    and ta.accountid=debit.accountid(+)
    and ta.accountid=credit.accountid(+)
    and ta.accountid=f.accountid(+)
    and ta.day=a.fromdate(+)
    --and ta.day=pay.createdate(+)
    and ta.day=debit.createdate(+)
    and ta.day=credit.createdate(+)
    and ta.day=b.paymentdate(+)
    and ta.day=f.createdate(+)
    and trunc(ta.day)=to_date(var_date,'DD-MON-YY');
    begin
    select distinct processdate into var_date1 from ledgerdetail;
    FOR V1 IN C1 LOOP
    UPDATE LEDGERDETAILtest
    SET PAYMENT=v1.payment,
    TOTALDUE=v1.TOTALDUE,
    CURBILL=v1.curbill,
    SRF=v1.srf,
    SBPNT=v1.sbpnt,
    SRV=v1.srv,
    SBF=v1.sbf,
    SBV=v1.sbv,
    EF=v1.ef,
    EV=v1.ev,
    TSRV=v1.tsrv,
    TSUB=v1.tsub,
    TEQE=v1.teqe,
    DT=v1.dt,
    PDEP=v1.rdep,
    PNT=v1.pnt,
    EQP=v1.eqp,
    DTR=v1.dtr,
    DRF=v1.drf,
    UNADJ=v1.unadj
    where accountid=v1.accountid
    and processdate=v1.processdate;
    --DBMS_OUTPUT.PUT_LINE('INSERTED ROW');
    commit;
    end loop;
    end;
    I have created above procedure to update table column....but i am getting run time error....
    Error report:
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at "CRESTELVIEWSPRD501.TESTLEDGER1", line 70
    ORA-06512: at line 1
    01422. 00000 - "exact fetch returns more than requested number of rows"
    *Cause:    The number specified in exact fetch is less than the rows returned.
    *Action:   Rewrite the query or change number of rows requested
    how to resolve this error...
    Pl give me solution...
    thanks in advance.

    Hi:
    You have to make sure that join condition joins one record to one record not to a group of records.
    Saad,
    http://saadnayef.blogspot.com/

  • How can i update multiple row in a advance table

    Dear all,
    hope you are well enough.
    suppose i have a table in a OA page where there are several transactions.
    i would like to add a check box in front of every row.
    when i check the transactions(rows of OA pages) and submit then one column of a table will be updated in database.
    how can i implement that.
    Please explain
    Regards,
    Mofizur

    Hi,
    Refer below code for iteration:
    OAViewObject appVO = (OAViewObject)am.findViewObject("ApprovalsWVO1");
    OARow row = (OARow)appVO.first();
    for(int i=0;i<appVO.getRowCount();i++)
    String appStatus=appVO.getCurrentRow().getAttribute("ApprovalStatus").toString();
    if(appStatus.equalsIgnoreCase("NEW"))
    newRow.setAttribute("appTrans",Boolean.FALSE);
    else
    newRow.setAttribute("appTrans",Boolean.TRUE);
    System.out.println(appStatus);
    row = (OARow)appVO.next();
    Regards
    Meher Irk

  • 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

  • Updating multiple rows in a table in ADF

    Hi
    How do we update multiple rows in a table.
    Onclicking a update button the changed rows must be updated.

    Hi Prince,
    currently I am selecting one row from the table and rendering a region at the top of the table and capturing the user entered data with the following code:
    ViewObjectVOImpl vo = getViewObjectVO1();
    Row CurrentRow = vo.getCurrentRow();
    //After this I perform the checks like user entered value is not null or check input as per business logic.
    if(CurrentRow.getAttribute("attributeName") ==null){
    //Add what message you want to display
    //Add other business logic.
    After making all the checks, i commit it.
    getOADBTransaction().commit();
    Now in my new page I am capturing the user input in the table itself like an excel sheet. Suppose there are ten rows in my advanced table on my page, and each row has one editable field. I have one save button at the bottom of the table.
    Now on clicking the save button I have to capture the user input, check whether there is any null value and if all the entered data is correct then only I should commit it.
    Can you please let me know how we can accomplish that.
    Regards
    Hawker

  • Trouble updating multiple rows in table using subquery

    Hi everyone, I'm having trouble updating multiple rows with a subquery. Here's the setup:
    create table mytable (
    col_a number primary key,
    col_b number,
    col_c number,
    col_d number);
    insert into mytable values (1 ,1,1,15);
    insert into mytable values (2 ,1,2,7 );
    insert into mytable values (3 ,1,3,11);
    insert into mytable values (4 ,1,4,23);
    insert into mytable values (5 ,1,5,14);
    insert into mytable values (6 ,2,1,50);
    insert into mytable values (7 ,2,2,41);
    insert into mytable values (8 ,2,3,13);
    insert into mytable values (9 ,2,4,12);
    insert into mytable values (10,2,5,19);
    insert into mytable values (11,3,1,10);
    insert into mytable values (12,3,2,92);
    insert into mytable values (13,3,3,81);
    insert into mytable values (14,3,4,17);
    insert into mytable values (15,3,5,66);
    insert into mytable values (16,4,1,54);
    insert into mytable values (17,4,2,41);
    insert into mytable values (18,4,3,22);
    insert into mytable values (19,4,4,24);
    insert into mytable values (20,4,5,17);For this example, using an update statement (or merge if that's better), say I want to set the values for col_d where col_b = 3 equal to the values for col_d where col_b = 1 and col_c equal each other. Results should look like the following after the update:
    col_a col_b col_c col_d
    1     1     1     15
    2     1     2     7
    3     1     3     11
    4     1     4     23
    5     1     5     14
    6     2     1     50
    7     2     2     41
    8     2     3     13
    9     2     4     12
    10    2     5     19
    11    3     1     15
    12    3     2     7
    13    3     3     11
    14    3     4     23
    15    3     5     14
    16    4     1     54
    17    4     2     41
    18    4     3     22
    19    4     4     24
    20    4     5     17I can see it right there at my fingertips using this query, where I want to set b_col_d = a_col_d, but I'm missing something, as this query returns too many rows when used in the update statement.
    select * from (
      select col_a as a_col_a, col_b as a_col_b, col_c as a_col_c, col_d as a_col_d
      from mytable
      where col_b = 1
      ) a, (
      select col_a as b_col_a, col_b as b_col_b, col_c as b_col_c, col_d as b_col_d
      from mytable
      where col_b = 3
      ) b
    where a.a_col_c = b.b_col_cupdate mytable set column_d = (select ??? where exists ???)
    Can someone help me get there? I'm using 10GR2.
    Thanks!
    Mark

    Hopefully this is what you are looking for:
    SQL > UPDATE mytable myt1
      2  SET    col_d = ( SELECT myt2.col_d
      3                   FROM   mytable myt2
      4                   WHERE  myt2.col_b = 1
      5                   AND    myt1.col_c = myt2.col_c
      6                 )
      7  WHERE  col_b = 3
      8  AND    EXISTS
      9         ( SELECT NULL
    10           FROM   mytable myt2
    11           WHERE  myt2.col_c = myt1.col_c
    12         )
    13  ;
    5 rows updated.
    SQL > SELECT * FROM mytable ORDER BY col_a;
                   COL_A                COL_B                COL_C                COL_D
                       1                    1                    1                   15
                       2                    1                    2                    7
                       3                    1                    3                   11
                       4                    1                    4                   23
                       5                    1                    5                   14
                       6                    2                    1                   50
                       7                    2                    2                   41
                       8                    2                    3                   13
                       9                    2                    4                   12
                      10                    2                    5                   19
                      11                    3                    1                   15
                      12                    3                    2                    7
                      13                    3                    3                   11
                      14                    3                    4                   23
                      15                    3                    5                   14
                      16                    4                    1                   54
                      17                    4                    2                   41
                      18                    4                    3                   22
                      19                    4                    4                   24
                      20                    4                    5                   17
    20 rows selected.Thank you so much for providing the sample data in an easy to consume form, as well as the expected output.

  • How to update multiple rows in one query using php

    i am new to this can any one help me how to update multiple rows at a time i am doing an school attendance page

    Often the situation is such that you have multiple courses across a range of dates.So students may take more than one course, and you need to track attendance for each course date. The following graphic demonstrates this:
    In such a situation, you need four database tables as follows:
    students (student_id, student_name, etc.)
    courses (course_id, course_name, etc.)
    students_courses (student_id, course_id)
    attendance (student_id, course_id, dater)
    A fifth table may also be needed to define the dates of courses, but you may also be able to build this array programmatically by using PHP's robust date functions, which can give you, for instance, all the Tuesdays and Thursdays between a start date and end date.
    The students_courses table simply keeps track of which students are taking which courses, so it has just two columns for the primary keys of both of the main tables. The attendance table is similar, but it also includes a date field. The following view of the attendance table demonstrates this:
    So if David's solution does cover your needs, consider yourself lucky, because this could quickly grow from a beginner-appropriate project to a moderately advanced one.

  • Update multiple rows based on two columns in same row

    I have a 1000 rows in a table I would like to update with a unique value. This unique value is a cocatenation of two columns in teh same row.
    Each row has a (i) date and a (ii) time and a (iii) date_time column. I would like to update the date_time (iii) column with a cocatenation of the (i) date and (ii) time columns.
    I know how I would update a single row but how can I update multiple rows with a cocatenation of each of the two columns - i.e put a different value into the date_time column for each row?

    this?
    update table tab_name
    set date_time =date||time
    where your_condition

  • Update multiple row for different values

    hi,
    Please provide me the sql query to update multiple row in a table with different values.
    i need to change the old date to new date
    we have only 3 column id,name,old date.now i need to update the old date to new date
    ID name old date new date
    1 A 2012-12-20 12/7/2012
    2 B 2012-12-20 12/9/2012
    3 c 2012-12-20 12/5/2012
    thank you.

    Here are two ways to do this. Thanks to ranit for the table creation script, which I adapted.create table test_x
    as
    select 1 id, 'A' name, to_date('2012-12-20','yyyy-mm-dd') old_date
    from dual UNION ALL
    select 2 id, 'B' name, to_date('2012-12-20','yyyy-mm-dd') old_date
    from dual UNION ALL
    SELECT 3 ID, 'C' NAME, TO_DATE('2012-12-20','yyyy-mm-dd') OLD_DATE
    from dual;First method using MERGE:MERGE INTO TEST_X O
    USING (
      select 1 id, to_date('12/7/2012','mm/dd/yyyy') new_date
      from dual UNION ALL
      select 2 id, to_date('12/9/2012','mm/dd/yyyy') new_date
      from dual UNION ALL
      SELECT 3 ID, TO_DATE('12/5/2012','mm/dd/yyyy') NEW_DATE
      FROM DUAL
    ) n
    ON (O.ID = N.ID)
    WHEN MATCHED THEN UPDATE SET OLD_DATE = n.NEW_DATE;Second method using UPDATE:UPDATE TEST_X SET OLD_DATE =
      CASE WHEN ID = 1 THEN TO_DATE('12/7/2012','mm/dd/yyyy')
           WHEN ID = 2 THEN TO_DATE('12/9/2012','mm/dd/yyyy')
           WHEN ID = 3 THEN TO_DATE('12/5/2012','mm/dd/yyyy')
      END
    where id between 1 and 3;
    You probably don't want to use these methods.*
    You say the "user" will enter these values. Will he always enter exactly 3 values?
    The "user" will enter values into a screen I suppose. What language is the user interface programmed in?

  • Updating multiple rows with different values

    Hi!
    I have a problem. I need to update more then 1000 rows with different values. How can I do it?
    For exsample i have table:
    id; color, date,
    1 red
    2 green
    3 white
    I need to update date field.
    Update table
    set date='01.02.03'
    where id=1
    Update table
    set date='01.03.03'
    where id=2
    Maybe there is way how to update multiple rows at one query?
    Sorry for my bad english.
    Thanks!

    Hi,
    You can try this
    UPDATE TABLE SET DATE = CASE
                        WHEN ID = 1 THEN TO_DATE('01-02-03','DD-MM-RR')
                        WHEN ID = 2 THEN TO_DATE('01-03-03','DD-MM-RR')
                        ENDcheers
    VT

  • Update multiple rows involving spatial data

    Hi,
    i have 2 table, that are
    temp
    store_id
    store_state
    geom mdsys.sdo_geometry
    us_states
    state
    geom mdsys.sdo_geometry
    i have indexed both table with spatial index.
    If i wanna find state that temp.geom is inside us_states.geom using
    SQL> select state from us_states, temp
    where sdo_inside(temp.geom, us_states.geom) = 'TRUE';
    it's work
    but if i wanna update temp.store_state using
    SQL> update temp set store_state = (select state from us_states
    where sdo_inside(temp.geom, us_states.geom) = 'TRUE');
    it gives this error
    update temp set store_state = (select state from us_states where sdo_inside(temp.geom, us_states.geom) = 'TRUE')
    ERROR at line 1:
    ORA-13226: interface not supported without a spatial index
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 62
    ORA-06512: at "MDSYS.SDO_3GL", line 192
    any idea how can i update multiple rows that involving spatial data?
    Thanks
    Hadi

    Hadi,
    There are a number of things wrong with the second item. First up you most likely will return more than one row, which is not allowed as the = expects only one item.
    Here is what I would use, which will update everything that meets the requirements, and ignore the rest:
    UPDATE (
    SELECT /*+ bypass_ujvc */
    state, store_id, store_state
    FROM temp, us_states
    WHERE sdo_inside(temp.geom, us_states.geom) = 'TRUE')
    SET store_state = state;
    With the /*+ bypass_ujvc */ you're telling the db to not worry about requiring a "unique join view condition" -- which roughly mean "trust me, my rows are key preserved." This is important since there is really no "hard" key-based relationship to tie the two together.
    However, unless you really think there are stores that border on two states, this will run much quicker with an anyinteract comparison.
    Bryan

  • Want to update multiple rows of the report but getting a bug.

    hi,
    I am trying to update multiple rows of a report.For that I have created a teport with dynamic checkbox generated using ---HTMLDB_ITEM.CHECKBOX(1,utt.trouble_ticket_id) " "----.Checkboxes are rendered perfectly on the report.
    but when I tried to update the selected rows of the report as given in the documentation
    begin
    :P16_priority:=htmldb_application.G_F01.count;
    for i in 1..htmldb_application.G_F01.count
    loop
    update umanage_trouble_ticket set severity =:P16_priority where
    trouble_ticket_id = htmldb_application.G_F01(i);
    end loop;     
    end;
    I found that all the rows are updated.not only selected rows.
    and the count it gives =no of rows returned + no of rows selected.
    Please help me regarding this.
    thanx.
    BHARAT

    Hi Bernhard,
    I think that u didnt get y problem.
    When I take the value from "htmldb_application.g_f01(i)" then it should return id's of rows that are checked but when I do that it returns id's of all the rows.So I am not able to update only checked rows.
    from id's of rows i mean value provided when generating checkboxes through query.
    htmldb_item.checkbox(1,trouble_ticket_id) " "
    I am approching to the solution as specified in the documentation. "Adding check boxes to each row in a report".
    but still cant find any solution.
    thanx that u showed some intrest in my problem.
    If u can get the solution reply soon.
    Regards
    BHARAT

  • Extract Multiple Rows from a Single Table into a Single Row in a New Table

    I have a table in a database that contains contact data like name, address, phone number, etc.
    The folks who designed the database and wrote the application wrote it so that all contact records are placed in that table, regardless of contact type. In fact, the contacts table does not even have a column for "type" even though there are many
    different types of contacts present in that table.
    I am trying to write a mail merge style report in SRSS, that gets sent to a specific type of contact, based on criteria provided that must be obtained from another table, and that data is then used to get back to a specific set of contacts from the contacts
    table.
    The attached file directly below describes my problem and all related information in an extremely detailed way.
    SRSSMailMergeIssue.pdf
    Unless there is a way to make a SRSS Tablix point to two different data sets in SRSS, it looks like I have to combine multiple rows from the same table into a new table.
    If anyone can review the details in the attached pdf file and possibly point me in the direction I need to run to solve this probelm, I would greatly appreciate it.
    I also included a document (below) that shows the tables I reference in the probelm description.
    dbtables.pdf

    I found a solution.... and posted it below
    select
    dk.ucm_docketnumber [UCM DocketNumber],
    dk.ucm_docketid [UCM DocketID],
    vc.FirstName [Victim FirstName],
    vc.MiddleName [Victim MiddleName],
    vc.LastName [Victim LastName],
    vc.Suffix [Victim Suffix],
    vc.Address1_Line1 [Victim AddressLine1],
    vc.Address1_Line2 [Victim AddressLine2],
    vc.Address1_Line3 [Victim AddressLine3],
    vc.Address1_City [Victim City],
    vc.Address1_StateOrProvince [Victim StateProvince],
    vc.Address1_PostalCode [Victim Postalcode],
    oc.FirstName [Offender FirstName],
    oc.MiddleName [Offender MiddleName],
    oc.LastName [Offender LastName],
    oc.Suffix [Offender Suffix],
    oc.Address1_Line1 [Offender AddressLine1],
    oc.Address1_Line2 [Offender AddressLine2],
    oc.Address1_Line3 [Offender AddressLine3],
    oc.Address1_City [Offender City],
    oc.Address1_StateOrProvince [Offender StateProvince],
    oc.Address1_PostalCode [Offender Postalcode],
    pc.FirstName [Arresting Officer FirstName],
    pc.MiddleName [Arresting Officer MiddleName],
    pc.LastName [Arresting Officer LastName],
    pc.Address1_Line1 [Arresting Officer AddressLine1],
    pc.Address1_Line2 [Arresting Officer AddressLine2],
    pc.Address1_Line3 [Arresting Officer AddressLine3],
    pc.Address1_City [Arresting Officer City],
    pc.Address1_StateOrProvince [Arresting Officer StateProvince],
    pc.Address1_PostalCode [Arresting Officer Postalcode]
    FROM ucm_docket dk
    left outer join ucm_victim v on dk.ucm_docketid = v.ucm_docketnumber
    left outer join contact vc on vc.contactid = v.ucm_victimlookup
    left outer join ucm_offender o on o.ucm_offenderid = dk.ucm_offenderlookup
    left outer join contact oc on oc.contactid = o.ucm_individualid
    left outer join contact pc on pc.contactid = dk.ucm_ArrestingOfficerLookup
    WHERE (dk.ucm_docketnumber = @DocketNUM)

  • Trigger in mutation - Update another rows in the same table with a trigger

    Hi ,
    I try to do a before update trigger on a table , but the trigger is in mutation. I understand why it do that but my question is :
    How can I update other rows in the same table when a UPDATE is made on my table??????
    Here is my trigger :
    CREATE OR REPLACE TRIGGER GDE_COMPS_BRU_5 BEFORE
    UPDATE OF DEPARTEMENT--, DISCIPLINE, DEG_DEMANDE, CE_ETAB
    ON GDEM.COMPOSITION_SUBV
    FOR EACH ROW
    Organisme : FQRNT-FQRSC
    Date de création : 14-07-2011
    Date de modification :
    Modifié par :
    Auteur : Johanne Plamondon
    Description : Ce déclencheur s'executera lors de la modification
    du responsable dans la table COMPOSITION_SUBV
    DECLARE
    V_OSUSER V$SESSION.OSUSER%TYPE;
    V_PROGRAM V$SESSION.PROGRAM%TYPE;
    V_TERMINAL V$SESSION.TERMINAL%TYPE;
    V_MACHINE V$SESSION.MACHINE%TYPE;
    V_MODULE V$SESSION.MODULE%TYPE;
    V_LOGON_TIME V$SESSION.LOGON_TIME%TYPE;
    V_AUDIT_ID NUMBER;
    vSEQ NUMBER;
    i NUMBER;
    vID DEMANDE.ID%TYPE;
    BEGIN
    begin
    SELECT OSUSER, PROGRAM, TERMINAL,MACHINE,MODULE, LOGON_TIME
    INTO V_OSUSER,V_PROGRAM,V_TERMINAL,V_MACHINE,
    V_MODULE,V_LOGON_TIME
    FROM V$SESSION
    WHERE TYPE = 'USER'
    AND USERNAME = USER
    AND LAST_CALL_ET IN (0,1)
    AND ROWNUM < 2;
    exception when others then null; end;
    IF NVL(:NEW.SC_PART,' ') = 'CHC' THEN
    SELECT COUNT(*)
    INTO i
    FROM DEMANDE
    WHERE DEM_REF = :NEW.DEM_ID
    AND PER_NIP = :NEW.PER_NIP;
    IF i = 1 THEN
    SELECT ID
    INTO vID
    FROM DEMANDE
    WHERE DEM_REF = :NEW.DEM_ID
    AND PER_NIP = :NEW.PER_NIP;
    UPDATE COMPOSITION_SUBV
    SET --CE_ETAB     = :NEW.CE_ETAB,
    --DISCIPLINE  = :NEW.DISCIPLINE,
    DEPARTEMENT = :NEW.DEPARTEMENT,
    --DEG_DEMANDE = :NEW.DEG_DEMANDE,
    DATE_MODIF = SYSDATE,
    USER_MODIF = V_OSUSER
    WHERE DEM_ID = vID
    AND PER_NIP = :NEW.PER_NIP
    AND ANNEE = :NEW.ANNEE;
    END IF;
    END IF;
    /*EXCEPTION
    WHEN OTHERS THEN
    NULL;*/
    END;

    A standard disclaimer, the mutating trigger error is telling you that you really, really, really don't want to be doing this. It generally indicates a major data model problem when you find yourself in a situation where the data in one row of a table depends on the data in another row of that same table. In the vast majority of cases, you're far better off fixing the data model than in working around the problem.
    If you are absolutely sure that you cannot fix the data model and must work around the problem, you'll need
    - A package with a collection (or global temporary table) to store the keys that are modified
    - A before statement trigger that initializes the collection
    - A row-level trigger that adds the keys that were updated to the collection
    - An after statement trigger that iterates over the data in the collection and updates whatever rows need to be updated.
    If you're on 11g, this can be simplified somewhat by using a compound trigger with separate before statement, row-level, and after statement sections.
    Obviously, though, this is a substantial increase in complexity over the single trigger you have here. That's one of the reasons that it's generally a bad idea to work around mutating table exceptions.
    Justin

Maybe you are looking for

  • How does the so-called duplicated data saved?

    I am confused with this question now. If a DB supports duplicate data. My question is: if I put 10 record, their data with same key, would BDB save key once and data 10 times, or 10 (same)key and 10 data? I mean, the same key is "100001", different d

  • Formatting the Quiz Review Area

    Is there a way to re-format the font, background, size or any other appearance aspects in the quiz review area? I know how to change the messages presented in this area via the Quiz Manager, but need help with changing the font size, etc. Speedy repl

  • Crystal Report Template

    Hello Everyone,   I have a question on templates in crystal reports.Can we create a template in a way that a set of reports point to this template and any change made to this template will be reflected in all these reports ? Thanks, Abhi

  • Damaged installer

    I have tried downloading the installer for CS6 master collection multiple times in multiple browsers and still get the same error. After downloading when I try to run itsays the application can not be installed because the installer is damaged. Does

  • Margin difference (height) in Firefox and IE 9

    Hi all, I know this problem is really ancient but just can't find a fix. Please look here:  http://www.tridentsolutions.co.nz/howick-opt/ When the margin is set for Firefox Safari and Chrome, the banner images are too close to the horizontal menu but