Update a column for every 2000 records in the table

The table has 50,000 records. I want to update the process_id every 2000 rows. For example, 1 for the 1st 2000 rows, 2 for the next 2000 rows, 3 for the next 2000 rows, and etc. Is there a quick way to do it?
Thanks much

hey <[email protected]>
Two ways of doing this...
First: PL/SQL
By declaring a cursor on the table and using the cursor%rowcount method to update your field..something like this...
Declare
Begin
For rno in MyCursor
Loop
update <tablename> set process_id = lv_pid where rowid = rno.rowid
If mod(MyCur%rowcount,2000) = 0 then
lv_pid = lv_pid + 1;
End If;
End Loop;
End
I am sorry if u already knew this :-) !!
Second: SQL
let u know once (if)i crack it :-( !!
Goodluck...
Vasudev

Similar Messages

  • How to add a default value in a site column for every item in a document library

    HI
    i created a content type with some site columns ,
    and included in a Document library.
    Process ( content type)
    -ProcessNo
    -ProcessName
    after that i uploaded 100 Documents but not  added value in a site column process name.
    now  how i add a default value in a site column for every document in a document library 
    adil

    HI
    i get below error when i change the script 
    PS C:\scripts> C:\Scripts\updatedefaultvalue.ps1
    Cannot index into a null array.
    At C:\Scripts\updatedefaultvalue.ps1:8 char:7
    + IF($i[ <<<< "Title"] -eq $null)
        + CategoryInfo          : InvalidOperation: (Title:String) [], RuntimeExce
       ption
        + FullyQualifiedErrorId : NullArray
    $web = Get-SPWeb http://tspmcwfe:89/
    $list = $web.Lists["test"]
    $item = $list.Items | Where { $_["Name"] -eq "Emc" }
    foreach($i in $items)
    IF($i["Title"] -eq $null)
             $i["Title"] = "test"
           $i.Update()
    adil
    Why are you piping a where in the items? Do you only want to add the "test" to ones matching
    a name?
    If you have ISE installed on your server I recommend you put your code in there and debug it. 
    If this is helpful please mark it so. Also if this solved your problem mark as answer.

  • How to get wage type for every time record

    Hi Pros,
          I am using DS 0CA_TS_IS_1, it includes report time type (0REPTT), but not have wage type. in CATSDB, I fied fields for attendance/absence type and wage type. but not every time record has wage type. can you please tell me how to get wage type for every time record? what is relation between reporting time type, attendance/absence type and wage typs?

    Hello,
    Can you talk to your HR/T&E functional consultant if they populate these values in CATSDB table using standard way or if there are custom fields that are in CATSDB OR any other table which can be used to meed the requirements
    Thanks
    Abhishek Shanbhigue

  • Message split for every 1000 records

    Hi All,
    My scenario is Proxy to File.We have to process thousands of records from r/3 to.I need to create separate XML file for every 1000 records in receiver directory.Is there any solution to achieve this?
    Thanks in advance
    Kartikeya

    here;s the blog krish was referring to..
    Night Mare-Processing huge files in SAP XI

  • Commit for every 1000 records in  Insert into select statment

    Hi I've the following INSERT into SELECT statement .
    The SELECT statement (which has joins ) has around 6 crores fo data . I need to insert that data into another table.
    Please suggest me the best way to do that .
    I'm using the INSERT into SELECT statement , but i want to use commit statement for every 1000 records .
    How can i achieve this ..
    insert into emp_dept_master
    select e.ename ,d.dname ,e.empno ,e.empno ,e.sal
       from emp e , dept d
      where e.deptno = d.deptno       ------ how to use commit for every 1000 records .Thanks

    Smile wrote:
    Hi I've the following INSERT into SELECT statement .
    The SELECT statement (which has joins ) has around 6 crores fo data . I need to insert that data into another table.Does the another table already have records or its empty?
    If its empty then you can drop it and create it as
    create your_another_table
    as
    <your select statement that return 60000000 records>
    Please suggest me the best way to do that .
    I'm using the INSERT into SELECT statement , but i want to use commit statement for every 1000 records .That is not the best way. Frequent commit may lead to ORA-1555 error
    [url http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:275215756923]A nice artical from ASKTOM on this one
    How can i achieve this ..
    insert into emp_dept_master
    select e.ename ,d.dname ,e.empno ,e.empno ,e.sal
    from emp e , dept d
    where e.deptno = d.deptno       ------ how to use commit for every 1000 records .
    It depends on the reason behind you wanting to split your transaction into small chunks. Most of the time there is no good reason for that.
    If you are tying to imporve performance by doing so then you are wrong it will only degrade the performance.
    To improve the performance you can use APPEND hint in insert, you can try PARALLEL DML and If you are in 11g and above you can use [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_parallel_ex.htm#CHDIJACH]DBMS_PARALLEL_EXECUTE to break your insert into chunks and run it in parallel.
    So if you can tell the actual objective we could offer some help.

  • How to add a row for every 5 records using logic:iterate

    Hi,
    In my application, using logic:iterate iam displaying 20 records per page.
    I want to insert a row for every 5 records.
    Please tell how to insert that row.
    Thanks in advance.
    Mohan

    I think this could work for you
    for (int x=1 ; x<=20 ; x++) {
    addRowWithRecord
    if (x%5==0)
    addEmptyRow
    }

  • How tu update a column having type 'Long raw' in oracle table with an image

    Hello,
    I must change the image loading in a column with 'long raw' type in the table. I find an image data already in the table.
    I have my new imgae in a file .bmp.
    What SQL instruction I mut use to update this column to load my new image ?
    I work in Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod.
    thanks for your helps.
    Regards.

    Unless I'm missing something MSFT are making it unecessarily complex by not implementing the SQL/XML standard...
    SQL> alter table emp add ( emp_xml xmltype)
      2  /
    Table altered.
    SQL> update emp set emp_xml = XMLELEMENT("EMPLOYEE",xmlattributes(EMPNO as "id"), XMLElement("Name",ENAME))
      2
    SQL> /
    14 rows updated.
    SQL> set pages 0
    SQL> select EMPNO, EMP_XML from EMP
      2  /
          7369
    <EMPLOYEE id="7369">
      <Name>SMITH</Name>
    </EMPLOYEE>
          7499
    <EMPLOYEE id="7499">
      <Name>ALLEN</Name>
    </EMPLOYEE>
          7521
    <EMPLOYEE id="7521">
      <Name>WARD</Name>
    </EMPLOYEE>
          7566
    <EMPLOYEE id="7566">
      <Name>JONES</Name>
    </EMPLOYEE>
          7654
    <EMPLOYEE id="7654">
      <Name>MARTIN</Name>
    </EMPLOYEE>
          7698
    <EMPLOYEE id="7698">
      <Name>BLAKE</Name>
    </EMPLOYEE>
          7782
    <EMPLOYEE id="7782">
      <Name>CLARK</Name>
    </EMPLOYEE>
          7788
    <EMPLOYEE id="7788">
      <Name>SCOTT</Name>
    </EMPLOYEE>
          7839
    <EMPLOYEE id="7839">
      <Name>KING</Name>
    </EMPLOYEE>
          7844
    <EMPLOYEE id="7844">
      <Name>TURNER</Name>
    </EMPLOYEE>
          7876
    <EMPLOYEE id="7876">
      <Name>ADAMS</Name>
    </EMPLOYEE>
          7900
    <EMPLOYEE id="7900">
      <Name>JAMES</Name>
    </EMPLOYEE>
          7902
    <EMPLOYEE id="7902">
      <Name>FORD</Name>
    </EMPLOYEE>
          7934
    <EMPLOYEE id="7934">
      <Name>MILLER</Name>
    </EMPLOYEE>
    14 rows selected.
    SQL>

  • How to return a record's column head given a record of a table.

    Hi:
    Do you know how to return a record's column head given a record of a table.
    For example, in a table with 3 columns "ID", "Education", "Age".
    Give you the record "Bachelor", how can you use a SQL to return the correspondent column head "Education"?
    Thanks for the big help.

    Have a look at http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSetMetaData.html.
    import java.sql.*;
    import java.util.*;
    ResultSet rs = stmt.executeQuery("SELECT * FROM testTable");
    ResultSetMetaData rsmd = rs.getMetaData();
    // loop through rsmd.getColumnCount() {
         String columnName = getColumnName(i);
         // run a query SELECT * FROM testTable WHERE columnName='Bachelor'
         // if rs !=null return columnName and break out of the loop
    }

  • How to have a vertical grid lineon the waveform graph indicator for every 10% percent of the maximum X axis value?

    Hi,
    how to have a vertical grid line on the waveform graph indicator for every 10% percent of the maximum X axis value, so the x axis will split into 10, the vertical grids line in total will be 11 (including first and last)
    Example if the maximum X axis value is 11.56, first vertical grid is at the origin(0), second vertical grid is at 1.156 and continue to last one 11.56

    Thanks JohnM and Evan,
    the increment work great and i modify it to pass the 10% into "start" too, so it will start at the point of 10% of maximum range
    attached file to let people download in future, if they met the similar situation
    Attachments:
    10percent.vi ‏31 KB

  • Customized delta data source for deleting data record in the source system.

    Hello Gurus,
           there is a customized delta data source,  how to implement delta function for deleting data record in the source system?
    I mean if there is record deleted in the source sytem, how to notify SAP BW system for this deleting change by this customized delta
    data source?
    Many thanks.

    Hi,
    when ever record deleted we need to write the code to insert the record in  Z table load this records into BW in a cube with similar structure.while loading into this cube multiply the Keyfigure by -1.
    add this cube in the Multi Provider.The union of the records in the orginal cube and the cube having deleted records will result in zero vale and will not be displayed in report .
    Regards,

  • To add new record into the table Data Service client

    When I am trying to add new record into the table Employeedetails using Data Service client it is giving a sql exception: "java.sql.SQLException: Violation of PRIMARY KEY constraint 'PK__EmployeeDetails__6383C8BA'. Cannot insert duplicate key in object 'EmployeeDetails'. Severity 14, State 1, Procedure 'PC-P41403 null', Line 1."
    Code:
    DataService ds=DataServiceFactory.newDataService(getInitialContext(),"EmplDetApp","ld:EmplDetAppDataServices/EmployeeDetails");
    EmployeeDetailsDocument edoc=EmployeeDetailsDocument.Factory.newInstance();
    edoc.addNewEmployeeDetails();
    //here I set the primary key value empid
    edet.setEmpid("1212");
    edet.setEmpname("manu");
    ds.submit(edoc);
    Error
    EmpName 5 java.sql.SQLException: Violation of PRIMARY KEY constraint 'PK__EmployeeDetails__6383C8BA'. Cannot insert duplicate key in object 'EmployeeDetails'. Severity 14, State 1, Procedure 'PC-P41403 null', Line 1
    com.bea.ld.dsmediator.DataServiceException: java.sql.SQLException: Violation of PRIMARY KEY constraint 'PK__EmployeeDetails__6383C8BA'. Cannot insert duplicate key in object 'EmployeeDetails'. Severity 14, State 1, Procedure 'PC-P41403 null', Line 1
         at com.bea.ld.dsmediator.update.JDBCAdaptor.save(JDBCAdaptor.java:247)
         at com.bea.ld.dsmediator.update.DataServiceMediator.submit(DataServiceMediator.java:528)
         at com.bea.ld.dsmediator.update.DataServiceMediator.submit(DataServiceMediator.java:245)
         at com.bea.ld.ServerBean.submit(ServerBean.java:529)
         at com.bea.ld.Server_ydm4ie_EOImpl.submit(Server_ydm4ie_EOImpl.java:910)
         at com.bea.ld.Server_ydm4ie_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:492)
         at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:435)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:430)
         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
         at java.lang.Thread.startThreadFromVM(Unknown Source)
    Caused by: java.sql.SQLException: Violation of PRIMARY KEY constraint 'PK__EmployeeDetails__6383C8BA'. Cannot insert duplicate key in object 'EmployeeDetails'. Severity 14, State 1, Procedure 'PC-P41403 null', Line 1
         at weblogic.jdbc.mssqlserver4.TdsStatement.processWarning(TdsStatement.java:1178)
         at weblogic.jdbc.mssqlserver4.TdsStatement.parseMsWarning(TdsStatement.java:1089)
         at weblogic.jdbc.mssqlserver4.TdsStatement.getMoreResults(TdsStatement.java:756)
         at weblogic.jdbc.mssqlserver4.TdsStatement.execute(TdsStatement.java:210)
         at weblogic.jdbc.mssqlserver4.TdsStatement.executeUpdate(TdsStatement.java:97)
         at weblogic.jdbc.mssqlserver4.TdsStatement.executeUpdate(TdsStatement.java:1455)
         at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:147)
         at com.bea.ld.dsmediator.update.JDBCAdaptor.save(JDBCAdaptor.java:151)
         ... 15 more
    But I am not sure why it is giving an exception as Violation of PRIMARY KEY.
    The update method works fine for the same client.
    The exception only happens when I am trying to insert a new record.
    Please help me to figure out this problem.

    If you are absolutely sure that you do not have such a row already in your table, open a case with customer support and reference CR321312. I believe the work-around is to put ld-server-core.jar in your client classpath.
    Correction: put ld-server-app.jar in the client classpath
    Edited by mreiche at 09/17/2007 3:28 PM

  • Override the unique record of the table

    friends
    i am having a record in the table , and always i want the latest value in the table.
    the record is with 4 fields.
    mandt primary key
    numb  primary key
    username
    date
    now in the program i read the numb from the ztable and after reading that
    i want to update the field with +1 ie override the old record.
    I tried with update and modify statement  but they are inserting the new record,
    i tried the where clause but that is not working.
    when i am using modify statement i am using numb+1 , so it is inserting the new record.
      How to handle this situation , please advice

    Hi,
      As Number is primary key, After reading and adding Number then you need to delete the existing latest record and Insert the new record.
    For EX
    NUM  USERNAME
    0001  NAREN
    0002 SATISH
    0003 RAVI
    Then last number is 0003 , add 1 then num is 0004.Then delete 0003 RAVI
    and add 0004 RAVI
    then DATA becomes
    NUM  USERNAME
    0001  NAREN
    0002 SATISH
    0004 RAVI
    Hope this will help  you.
    Thanks and Regards,
    Narendra.Soma

  • SQL query to get last 10 records in the table?

    Hi,
    Can anyone tell me the SQL query to get last 10 records in the table?
    Thanks!!
    MCP

    Please, define what "last" means. Sets are unordered by definition, so if you want to retrieve rows from a table in a specific order you need to specify what that order is - e.g. by maintaining a value in a column (or a combination of columns) that you can use in the ORDER BY clause of the SELECT statement.
    If, for instance, you kept the time when the row was inserted in a special column (InsertedTime), you could use this in your query like this:
    select top (10)
      <column list>
      from <table or view>
      where <restriction(s)>
      order by InsertedTime desc;
    ML
    Matija Lah, SQL Server MVP
    http://milambda.blogspot.com

  • How to find last inserted record in the table.

    Version: Oracle 10g
    I have a table called "Manufacture" and 3 columns as mfno,itemname,quantity.
    How to find last inserted record in the table "Manufacture".
    As i come to know that Rowid is not result perfect results. Please provide your inputs.

    user13416294 wrote:
    Version: Oracle 10gThat is not a version. That is a product name. A version is 10.1.0.2 or 10.2.0.4, etc.
    I have a table called "Manufacture" and 3 columns as mfno,itemname,quantity.
    How to find last inserted record in the table "Manufacture".Not possible as your data model does not cater for it. That simple.
    If there is a need to determine some order or associate some time to an entity, then that should be part of the data model - and a relationship, or one or more attributes are needed to represent that information. Thus your data model in this case is unable to meet your requirements.
    If the requirements are valid, fix the data model. In other words - your question has nothing to do with Oracle and nothing to do with rowid, rowscn or other pseudo columns in Oracle. It is a pure data modeling issue. Nothing more.

  • Incomplete Data on report (report does not show all records from the table)

    Hello,
    I have problem with CR XI, I'm running the same report on the same data with simple select all records from the table (no sorting, no grouping, no filters)
    Sometimes report shows me all records sometimes not. Mostly not all records on the report. When report incomplete sometimes it shows different number of records.
    I'm using CR XI runtime on Windows Server 2003
    Any help appreciated
    Thanks!

    Sorry Alexander. I missed the last line where you clearly say it is runtime.
    A few more questions:
    - Which CR SDK are you using? The Report Designer Component or the CR assemblies for .NET?
    - What is the exact version of CR you are using (from help | about)
    - What CR Service Pack are you on?
    And a troubleshooting suggestion:
    Since this works on some machines, it will be a good idea to compare all the runtime (both CR and non CR) being loaded on a working and non working machines.
    Download the modules utility from here:
    https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip
    and follow the steps as described in this thread:
    https://forums.sdn.sap.com/click.jspa?searchID=18424085&messageID=6186767
    The download also includes instructions on how to use modules.
    Ludek

Maybe you are looking for