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/

Similar Messages

  • How to update multiple rows using cursor.

    hi all,
    i want to update rows fetched by a cursor. it don't update the rows.
    and gives error:
    ORA-01002     fetch out of sequence
    here is the trigger.
    Declare
         alert_id ALERT := Find_Alert('on');
         alert_button NUMBER;
         var number :=10;
         v_al char(3);
         v_al_da date;
         s_date date;
         al_on number;
         to_time number;
         cursor rem is
              select re_about, alarm, alert_date
              from remind
              where alarm='ON' AND alert_date = :control.showdate
              for update;
    begin
         for rem_record IN rem LOOP
              Set_Alert_Property(alert_id, ALERT_MESSAGE_TEXT, rem_record.re_about);
              al_on := show_alert('ON');
              IF alert_button = ALERT_BUTTON1 THEN
              update remind
              set alarm = 'OFF'
              --where re_about = rem_record.re_about
              where current of rem;
              ELSE
              NULL;
              END IF;
              COMMIT;
         END LOOP;
    end;
    thanks
    Muhammad Nadeem
    Mardan

    thanks dear,
    i tried the following code outside the loop
    but the same problem.
    here is the code:
    Declare
         alert_id ALERT := Find_Alert('on');
         alert_button NUMBER;
         var number :=10;
         v_al char(3);
         v_al_da date;
         s_date date;
         al_on number;
         to_time number;
         cursor rem is
              select re_about, alarm, alert_date
              from remind
              where alarm='ON' AND alert_date = :control.showdate
              for update;
    begin
         for rem_record IN rem LOOP
         Set_Alert_Property(alert_id, ALERT_MESSAGE_TEXT, rem_record.re_about);
              al_on := show_alert('ON');
              IF alert_button = ALERT_BUTTON1 THEN
              update remind
              set alarm = 'OFF'
         where current of rem;
              ELSE
              NULL;
              END IF;
         END LOOP;
    if :SYSTEM.FORM_STATUS = 'changed' then
         COMMIT;
    end if;
    end;
    thanks
    Muhammad Nadeem

  • 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.

  • How to Update a Row using ADF

    Hi every one
    Can any one help me out, How to Update a Row using ADF.
    Thanks in advance

    In addition to Clear to my question
    By Using ADF BC How can I update a record in a database.
    I have VO and EO associated with a table.
    How can I update a record using ADF BC
    Message was edited by:
    user616296

  • Update Multiple Rows using Row Selector

    Hi,
    I want to update multiple rows using a tabular form with row selector, and an item in another region of the page, using an update expression and a button.
    The syntax would be like this:
    update MY_TABLE set UPDATABLE_COLUMN = :P10_NEW_VALUE where {row selector = true}
    What is the syntax for the WHERE clause, anyone knows? In the manual there is no information at all for doing this.
    PD. I added the row selector after creating the form, so I don't have any wizard-created MRU processes in the page.
    HTMLDB version is 1.6
    Thanks.

    Hi,
    I want to update multiple rows using a tabular form with row selector, and an item in another region of the page, using an update expression and a button.
    The syntax would be like this:
    update MY_TABLE set UPDATABLE_COLUMN = :P10_NEW_VALUE where {row selector = true}
    What is the syntax for the WHERE clause, anyone knows? In the manual there is no information at all for doing this.
    PD. I added the row selector after creating the form, so I don't have any wizard-created MRU processes in the page.
    HTMLDB version is 1.6
    Thanks.

  • 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

  • How to update multiple rows in ADF Tble

    Hi,
    I have created a search form and ADF table. This ADF table is having column of Select Boolean check box along with actual table columns.
    When I click on Search button it should show the result in ADF table. I will be able to select the check box in multiple rows.
    Finally when I click on Submit button status column should be updated against the rows for which Boolean check box is selected.
    Here the thing that I would like to know is how to identify the rows whichever are selected when I click on Submit button.
    Could you please help.
    Regards
    Vinod.

    http://sameh-nassar.blogspot.de/2009/12/use-checkbox-for-selecting-multiple.html shows how to use a checkbox via a transient attribute on the EO. To get the selected row you check the transient attribute of each row.
    Timo

  • How to create multiple rows in a child table from the multi select Lov

    Hi
    We have Departments and EmployDept and Persons tables and each employee can associate multiple departments and vice versa.While creating a Department page there should be a Multi Select LOV(values from Persons table) with search option for the Persons.From the search panel we can select multiple persons for that department.Suppose we have selected 5 persons and click on submit, then it should create 5 rows in the EmployDept table for 5 persons with that department id.
    Any inputs on how to implement this scenario please..

    Maybe you can get some ideas from here -
    http://adfdeveloper.blogspot.com/2011/07/simple-implementation-of-af.html

  • Update multiple rows using CASE WHEN

    I have the table ACCOUNT of structure as follow: 
    ACCOUNT_ID
    ACCOUNT_STATUS
    004460721
    2
    042056291
    5
    601272065
    3
    I need to update the three rows at once using one SELECT statement such that, the second column will be 5, 3, 2 respectively.
    I used the following query but seems there is something missing
    UPDATE ACCOUNT
    SET ACCOUNT_STATUS = CASE  
    WHEN ACCOUNT_STATUS = '004460721' THEN 5 
    WHEN ACCOUNT_STATUS = '042056291' THEN 3 
    WHEN ACCOUNT_STATUS = '601272065' THEN 2 
    WHERE ACCOUNT_ID IN ('004460721','042056291','601272065') 
    My question, is this way correct? if no, can I use CASE WHEN statement and how or I only have choice of using SUB-SELECT to acheive that in one statement?

    Hi,
    Hawk333 wrote:
    I have the table ACCOUNT of structure as follow:
    ACCOUNT_ID
    ACCOUNT_STATUS
    004460721
    2
    042056291
    5
    601272065
    3
    I need to update the three rows at once using one SELECT statement such that, the second column will be 5, 3, 2 respectively.
    I used the following query but seems there is something missing
    UPDATE ACCOUNT
    SET ACCOUNT_STATUS = CASE  
    WHEN ACCOUNT_STATUS = '004460721' THEN 5 
    WHEN ACCOUNT_STATUS = '042056291' THEN 3 
    WHEN ACCOUNT_STATUS = '601272065' THEN 2 
    WHERE ACCOUNT_ID IN ('004460721','042056291','601272065') 
    My question, is this way correct? if no, can I use CASE WHEN statement and how or I only have choice of using SUB-SELECT to acheive that in one statement?
    What happens when you try it?
    Did you mean "WHEN ACCOUNT_ID = ..."?
    A CASE expressions always needs an END keyword.
    Depending on your requirements (that is, why are those rows being changed, and how do you determine the new values) a CASE expression in an UPDATE statement, similar to what you posted, could be a good way to do it.  MERGE (instead of UPDATE) would also be an option, especially if you want to avoid updating rows that already happen to have the correct values.

  • How to save multiple rows using ADF faces ?!

    Hello;
    I am developing a search page using ADF faces (jdeveloper 10.1.3).
    after building my view i dragged it as search form on my page then i dragged it again as a read only table to display results with different iterator.
    I have a field act as a flag with 'Y' and 'N' value so i converted this field in the table to select boolean checkbox.
    what i need is ...
    after processing search operation i want to update this flag by 'Y' or 'N' (select/un-select checkbox) then click on a save button to save all result rows flag with its new status to the data base.
    Wish to know how to implement that.
    Thanks a lot

    Searching this forum yields How to do a bound af:SelectBooleanCheckbox inside of af:Table
    Hope this helps

  • 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 multiple rows using join condition

    Hi All,
    CREATE OR REPLACE
    PROCEDURE update_t
    IS
    BEGIN
    FOR emp_rec IN (SELECT EMPLOYEE_ID,FIRST_NAME,LAST_NAME FROM hr.employees)
    LOOP
    UPDATE
    hr.employees1
    SET
    FIRST_LAST= (
    select concat(FIRST_NAME,LAST_NAME) from hr.employees where emp_rec.EMPLOYEE_ID=197);
    END LOOP;
    END update_t;
    I am trying to update first_last column in employees1 table. when i execute this procedure , i am getting the error
    Error report:
    ORA-01427: single-row subquery returns more than one row
    ORA-06512: at "SYSTEM.UPDATE_T", line 13
    ORA-06512: at line 1
    01427. 00000 - "single-row subquery returns more than one row"
    Please let me know a solution for this.
    Thanks,
    Manikandan

    Hello Manikandan,
    in your inner SQL the resultset is not restricted to give just one row.
    Try this
    UPDATE hr.employees1 SET
    FIRST_LAST= (select concat(FIRST_NAME,LAST_NAME) from hr.employees where emp_rec.EMPLOYEE_ID=hr.employees.employee_id);Your version did not have any restriction on the rows selected from hr.employees. You gave a where condition that is unrelated to the query.
    The best solution for your problem is to avoid the PL/SQL loop completely. You could try something like this:
    update
       (select
           e1.first_last,
           e.first_name,
           e.last_name
        from
           hr.employees1 e1,
           hr.employees e
        where
           e1.employee_id=e.employee_id) set
       first_last=first_name||last_name;But beware, updates on joins just work under some restrictions. The key of the table to be updated must be the key of the join. (key preserved is the word to look up.)
    Hope that helps,
    dhalek

  • How to update multiple rows

    i have one array of string score1[]
    and i want to update those value in table
    how the query should be.........
    i thought it work as like for insert query
    but following is not working
    PreparedStatement ps = con.prepareStatement("update class_test_scores set score=? where student_id=? and test_no='fct' and subject_id=?");
    while(j<k)
         ps.setString(1, score1[j]);
         ps.setString(2, name[j]);
         ps.setString(3, subject);
         ps.executeUpdate();
         j++;
    }thanx & regards
    sweety

    tahnx for reply
    Akash_Ganga
    actually now it is working fine
    there was no error
    but the conformation page that i was displaying after updating
    was not loading
    now i got it correctly
    cheers & regards
    sweety

  • How to UPDATE multiple rows in T1 with unique value from T2

    Hi,
    having on mind update query with where clause:
    WHERE (SELECT LEFT(ColumnName,7) FROM tblName) = emp2.ColumnName
    error:
    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
    The statement has been terminated.
    What am I suppose to change in WHERE clause....
    Note: there is always unique value in T2 while, in T1, there could be both, only one value to be updated or number of them that all need to be updated with that unique value from T2 (alias emp2)
    T1                                            
    T2
    colimn1          column2               column3        column4
    001A001A       string1                001A001       string10
    001A001B        string2                001A005      string20
    001B005A        string3               
    001B005B        string4
    001B005C        string5      
    should become:
    T1                                           
    colimn1          column2            
    001A001A       string10               
    001A001B        string10               
    001B005A        string20               
    001B005B        string20
    001B005C        string20      
    UPDATET1
    SET column2  = emp2.column4
    FROM  T2  as emp2
        WHERE (SELECT LEFT(column1,7) FROM T1 = emp2.column3                      

    Hi daredevil3011,
    Based on my test, the error is caused by where statement in the query. Just as the error message, in your where statement, there is a subquery “SELECT LEFT(ColumnName,7) FROM tblName” follows ”=”, this is not permitted in SQL Server.
    To fix this issue, please modify your query to like below:
    UPDATE T1
    SET column2 = emp2.column4
    FROM T2 as emp2
    WHERE LEFT(column1,7) = emp2.column3
    Reference:
    WHERE (Transact-SQL)
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to update multiple records using for loop

    Hi I want to update a particular column of few rows in database i had written followin code after that few lines of code and calling action from the task which having commit return ,still it's not updating particular colum.I had debug the code loop is running fine but still changes are not reflecting to database.Let me know if there is any prob with following code snippet.
    RealEstatePropertyUnitDetailsVOImpl realEstatePropertyUnitDetailsVO = RealEstatePropertyUnitDetailsVOImpl)realEstateService.getRealEstatePropertyUnitDetailsVO();
    for(Row row : realEstatePropertyUnitDetailsVO.getAllRowsInRange())
    if("N".equalsIgnoreCase((String)row.getAttribute("RlstdSellYn"))
    || "false".equalsIgnoreCase((String)row.getAttribute("RlstdSellYn")))
    row.setAttribute("RlstdAvlblYn", "Y" );
    System.out.println("RlsthId "+row.getAttribute("RlstdRlsthId"));
    System.out.println("AvlbYN "+row.getAttribute("RlstdAvlblYn"));
    System.out.println("RlstdUnitId "+row.getAttribute("RlstdUnitId"));
    }

    Vishwesh,
    I'd start with something along the lines of ...
        RowSet vo = (RowSet)getRealEstatePropertyUnitDetailsVO();
        vo.reset();
        while (vo.hasNext())
          Row row = vo.next();
          row.setAttribute("Attribute", value);
        }getAllRowsInRange() may exclude some rows outside the "range". Also, the vo.reset is needed since your View Object currency may not be at the beginning of your RowSet.
    Hope that helps.
    Will

Maybe you are looking for

  • How can I send an image directly from the browser as an attachment, not a link?

    I'm wondering if there's a way-- either via some kind of add-on or a direct FF customization-- to send an image as an attachment rather than as a link? either right-clicking an image and selecting "send image" or dragging an image into a "new message

  • Edit in Photoshop Elements 10 question:

    Ok, I'm using LR3 and Elements 10. I need to make sure I'm doing this right. Im in LR, and I want to send a DNG file over to Elements. I click Edit with Photoshop Elements, it sends the file over to Elements. I do my edits in Elements, then click Sav

  • Why are my pages documents unable to be attached in gmail

    Since downloading Mavericks my Pages documents are unable to be attached in Gmail. Furthermore, in Final Cut Pro X videos that I attempt to post to You Tube fail because, according to error window, network connection was lost. None of this happened b

  • My blackberry wont tur on and its fully charged

    my phone just turned its self of and it keeps turning back on and then cutting back off againa and when it isnt on the light just keeps flashing red and i dont know what to do with it

  • Account determination config for VA88

    Hi One of my user is complaining that VA88 is porting to wrong GL Account. Can some one tell me where in config I can chnage the GL account attached to VA88 ? This is very urgent for me. Also can some one send me the link of any doc for t-code VA88 ?