Using Rownum and ROwid returns duplicate records

Hi All,
We have implemented pagination as below using rowid and rownum
SELECT
id
FROM
emp
WHERE
ROWID IN
SELECT RID FROM (SELECT
ROWID RID,
ROWNUM RNUM
FROM
SELECT ID FROM emp
WHERE
((T_ID IN (200005,200229,200230,200249,200250,200049))) AND
(dte >= sysdate-90) AND
(LOWER(DESC) = LOWER ('A') AND
LOWER(NVL(FLAG,'0')) != LOWER ('3') AND
LOWER(MODDE) like LOWER ('%210%')) ORDER BY dte ASC ))
WHERE ROWNUM < 11) WHERE RNUM>= 1)) ORDER BY dte emp.ASC
But, we face that - the query inserts duplicate records in consecutive pages. For Eg:
1.if a,b,c,d,e - is returned for first iteration, then for the next iteration - f,g,h,a,y is returned.
Is it because that the Order by clause doesnt have a Unique key column.
Please help. or suggest how to efficietly implement pagination without performance hit

try distinct since you are using only one column it will eliminate any duplicates.
SELECT distinct id
  FROM emp
WHERE (ROWID IN ( SELECT RID
                     FROM (SELECT ROWID RID,ROWNUM RNUM
                             FROM (SELECT ID
                                     FROM emp
                                    WHERE ((T_ID IN (200005,200229,200230,200249,200250,200049)))
                                      AND (dte >= sysdate-90)
                                      AND (LOWER(DESC) = LOWER ('A')
                                      AND LOWER(NVL(FLAG,'0')) != LOWER ('3')
                                      AND LOWER(MODDE) like LOWER ('%210%'))
                                   ORDER BY dte ASC ))
                            WHERE ROWNUM < 11) 
                    WHERE RNUM>= 1))
ORDER BY dte emp.ASC

Similar Messages

  • Restricting number of rows in EJB  QL    using rowNum or rowId

    Hii Javaites
    I am using EJB finder methods to get a a list of records from database.
    Now i want that only particular number of records should be fetched.
    For tht i want 2 use rownum or rowId.
    Can anyone plz tell me can we do tht in EJB QL.
    I m using Weblogic 8

    shouldn't use rownum or rowid to do such a thing.
    %

  • Importing and Updating Non-Duplicate Records from 2 Tables

    I need some help with the code to import data from one table
    into another if it is not a duplicate or if a record has changed.
    I have 2 tables, Members and NetNews. I want to check NetNews
    and import non-duplicate records from Members into NetNews and
    update an email address in NetNews if it has changed in Members. I
    figured it could be as simple as checking Members.MembersNumber and
    Members.Email against the existance of NetNews.Email and
    Members.MemberNumber and if a record in NetNews does not exist,
    create it and if the email address in Members.email has changed,
    update it in NetNews.Email.
    Here is what I have from all of the suggestions received from
    another category last year. It is not complete, but I am stuck on
    the solution. Can someone please help me get this code working?
    Thanks!
    <cfquery datasource="#application.dsrepl#"
    name="qryMember">
    SELECT distinct Email,FirstName,LastName,MemberNumber
    FROM members
    WHERE memberstanding <= 2 AND email IS NOT NULL AND email
    <> ' '
    </cfquery>
    <cfquery datasource="#application.ds#"
    name="newsMember">
    SELECT distinct MemberNumber
    FROM NetNews
    </cfquery>
    <cfif
    not(listfindnocase(valuelist(newsMember.MemberNumber),qryMember.MemberNumber)
    AND isnumeric(qryMember.MemberNumber))>
    insert into NetNews (Email_address, First_Name, Last_Name,
    MemberNumber)
    values ('#trim(qryMember.Email)#',
    '#trim(qryMember.FirstName)#', '#trim(qryMember.LastName)#', '#
    trim(qryMember.MemberNumber)#')-
    </cfif>
    </cfloop>
    </cfquery>
    ------------------

    Dan,
    My DBA doesn't have the experience to help with a VIEW. Did I
    mention that these are 2 separate databases on different servers?
    This project is over a year old now and it really needs to get
    finished so I thought the import would be the easiest way to go.
    Thanks to your help, it is almost working.
    I added some additional code to check for a changed email
    address and update the NetNews database. It runs without error, but
    I don't have a way to test it right now. Can you please look at the
    code and see if it looks OK?
    I am also still getting an error on line 10 after the routine
    runs. The line that has this code: "and membernumber not in
    (<cfqueryparam list="yes"
    value="#valuelist(newsmember.membernumber)#
    cfsqltype="cf_sql_integer">)" even with the cfif that Phil
    suggested.
    <cfquery datasource="#application.ds#"
    name="newsMember">
    SELECT distinct MemberNumber, Email_Address
    FROM NetNewsTest
    </cfquery>
    <cfquery datasource="#application.dsrepl#"
    name="qryMember">
    SELECT distinct Email,FirstName,LastName,MemberNumber
    FROM members
    WHERE memberstanding <= 2 AND email IS NOT NULL AND email
    <> ' '
    and membernumber not in (<cfqueryparam list="yes"
    value="#valuelist(newsmember.membernumber)#"
    cfsqltype="cf_sql_integer">)
    </cfquery>
    <CFIF qryMember.recordcount NEQ 0>
    <cfloop query ="qryMember">
    <cfquery datasource="#application.ds#"
    name="newsMember">
    insert into NetNewsTest (Email_address, First_Name,
    Last_Name, MemberNumber)
    values ('#trim(qryMember.Email)#',
    '#trim(qryMember.FirstName)#', '#trim(qryMember.LastName)#', '#
    trim(qryMember.MemberNumber)#')
    </cfquery>
    </cfloop>
    </cfif>
    <cfquery datasource="#application.dsrepl#"
    name="qryEmail">
    SELECT distinct Email
    FROM members
    WHERE memberstanding <= 2 AND email IS NOT NULL AND email
    <> ' '
    and qryMember.email NEQ newsMember.email
    </cfquery>
    <CFIF qryEmail.recordcount NEQ 0>
    <cfloop query ="qryEmail">
    <cfquery datasource="#application.ds#"
    name="newsMember">
    update NetNewsTest (Email_address)
    values ('#trim(qryMember.Email)#')
    where email_address = #qryEmail.email#
    </cfquery>
    </cfloop>
    </cfif>
    Thank you again for the help.

  • Select statement without using Rownum or Rowid

    Hi,
    I have a requirement where I have delete the first 100 records from table without using the rownum or rowid.
    Thanks to all for your time
    Narain

    Hi
    delete from yourtab x where (select count(*) from yourtab where yourpk <= x.yourpk) < 101;HTH
    Laurent Schneider
    OCM DBA

  • Calendar and Adressbook error: Duplicate records found for GUID

    Hi all,
    i have a Mountaion Lion Server running on a mac mini and everything was working well.
    This morning one user of mine is unable to connect to his calendar and adressbook.... i found this error in the log files:
    2013-06-30 15:19:50+0200 [-] [caldav-1]  [-] [twistedcaldav.directory.appleopendirectory.OpenDirectoryService#error] Duplicate records found for GUID ****USER_GUID****:
    2013-06-30 15:19:50+0200 [-] [caldav-1]  [-] [twistedcaldav.directory.appleopendirectory.OpenDirectoryService#error] Duplicate: ***USER_Shortname***
    Apperetnly there is a duplicate match in the database. how can i fix this issue?
    In Server App this user is only listed once.
    Mail and other services for this user are working correctly.
    Thanks for any advice!

    Hi Samuel,
    You may try:
    select code,count(code)
    from [dbo\].[@XTSD_XA_CMD\]
    group by code having count(code) > 1
    What is the result?
    Thanks,
    Gordon

  • How to monitor ADFS 2012r2, Commercial services use HEAD and ADFS returns 500 instead of 200

    I have set up an on-prim ADFS and an off-prim ADFS.
    I want to use DNS Failover to monitor them and switch off-prim as required.
    I've tried both Amazon Route 53 and DNS Made Easy monitoring, and both appear to use the HEAD command rather than the GET command. How can I monitor these services? ADFS 2012r2 does not seem to support the HEAD command.
    curl -iX GET h t t p s ://fs.redclay.com/adfs/ls/idpinitiatedsignon.htm returns 200 whereas
    curl -iX HEAD ... or curl -I ... return 500 or just hangs forever.
    Only by the process of elimination have I come to the conclusion that the HEAD command is being used. I don't know how to sniffer SSL, but both DNSMadeEasy and AmazonAWS say the services are down when I know they are up.

    Hi,
    Would you please be more specific about your requirements?
    If you want to figure out how to use curl –iX command, you can refer to the Official Scripting forum below:
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    If you have doubts about your third-party software, I suggest you contact third-party support to get accurate answers.
    If you just want to monitor your ADFS servers, you can configure performance monitoring as this article guides:
    Configure Performance Monitoring
    http://technet.microsoft.com/en-us/library/ff627833.aspx
    Best Regards,
    Amy Wang

  • SAP query returning duplicate records

    Hi all,
    I'll try to elaborate as much as possible so here goes:
    I have a query that I am trying to run in SAP B1 8.8 which is not returning the true set of results I am expecting.
    Essentially I am trying to filter by product based on delivery notes. I have the query as follows -
    SELECT count(*), sum(T0.[DocTotal]-T0.[VatSum]) as "Order Value"
    FROM ODLN T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    WHERE DateName(mm,T0.DocDate) = 'November'
    and DateName(yyyy,T0.DocDate) = '2011'
    and (T1.[GroupCode] = '102' or T1.[GroupCode] = '107')
    This returns the correct result of 1320 row numbers and the given sum.
    When I try to break this query down further by product using the query below, the values are doubled, tripled, quadrupled etc and summed up to give a number that is extremely high.
    The code is as follows:
    SELECT distinct count (*), sum(distinct T0.[DocTotal]-T0.[VatSum]) as "Order Value" from DLN1 T1
    inner join ODLN T0 on T0.DocEntry = T1.DocEntry
    Inner join OITM T2 on T2.ItemCode = T1.ItemCode
    inner join OCRD T3 on T0.CardCode = T3.CardCode
    WHERE DateName(mm,T0.DocDate) = 'November'
    and DateName(yyyy,T0.DocDate) = '2011'
    and (T3.[GroupCode] = '102' or T3.[GroupCode] = '107')
    and (T2.[ItmsGrpCod] = '108' or T2.[ItmsGrpCod] = '112' or T2.[ItmsGrpCod] = '115')
    This also returns 1819 rows where there should be less based on the product.
    Please let me know if I am not explaining myself well or need further clarification.
    Thanks!

    hi,
    try to run this code from your SQL management studio
    SELECT     SUM(T0.DocTotal - T0.VatSum) AS [Order Value], T0.DocTotal - T0.VatSum AS [Order Value], T0.DocNum, T0.DocDate, T0.CardCode, T0.CardName, T0.DocTotal,
                          T1.ItemCode, T1.Dscription, T1.Quantity, T2.GroupCode, T3.ItmsGrpCod
    FROM         ODLN AS T0 INNER JOIN
                          DLN1 AS T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
                          OCRD AS T2 ON T0.CardCode = T2.CardCode INNER JOIN
                          OITM AS T3 ON T1.ItemCode = T3.ItemCode
    GROUP BY T0.DocTotal - T0.VatSum, T0.DocNum, T0.DocDate, T0.CardCode, T0.CardName, T0.DocTotal, T1.ItemCode, T1.Dscription, T1.Quantity, T2.GroupCode,
                          T3.ItmsGrpCod
    HAVING      (T2.GroupCode = 102 OR
                          T2.GroupCode = 107) AND (T3.ItmsGrpCod = 108 OR
                          T3.ItmsGrpCod = 112 OR
                          T3.ItmsGrpCod = 115) AND (T0.DocDate BETWEEN CONVERT(DATETIME, '2011-11-01 00:00:00', 102) AND CONVERT(DATETIME, '2011-11-17 00:00:00', 102))
    regards,
    Fidel

  • Using java beans to return a record set

    Hello,
    I fairly new to JSP and what I'm trying to do is use Beans to connect to a database and then display the result on the JSP page. Can someone please post an example of how I would do this from a JSP page. I already have my JDBC code set up.
    Thanks

    Thanks for the feedback M
    I have added the JSTL 1.1 library and used the Foreach components and data source components which now totally eliminate the need for beans altogether. :P
    <c:forEach var="row" items="${deejays.rows}">
    <tr onmouseover="this.bgColor='gold';"
    onmouseout="this.bgColor='#FFFFFF';">
    <c:forEach var="column" items="${row}">
    <td>
    <c:out value="${column.value}"/>
    </td>
    </c:forEach>
    <td width="24%" align="center">
    <input type="image" src="7af5.jpg" name="test" value="test"/>
    </td>
    <td width="15%">
    <input type="radio" name="book1"/>
    </td>
    </tr>
    </c:forEach>
    </table><p align="left">
    How and where do i add the beans in here now???

  • Loacate and remove duplicate records in infocube.

    Hi!!
    we have found the infocube 0PUR_C01 contians duplicate records for the month april 2008, approx 1.5lac records are extracted to this infocube, similar situations may be occuring in the subsequent months.
    How do I locate these records and remove them for the infocube?
    How do I ensure that duplicate records are not extracted in the infocube?
    All answers/ links are welcome!!
    Yours Truly
    K Sengupto

    First :
    1. How do I locate duplicate records in an Infocube? other than down load all the records in an excel file and use excel funtionality to locate duplicate records.
    This is not possible since a duplicate record would not exist - the records are sent to a cube with a + and - sign to accordingly summarize data.
    You search for duplicate data would become that much troublesome.
    If you have a DSO to load it from - delete data for that month and reload if possible this would be quicker and cleaner as opposed to removing duplicate records.
    If you had
    ABC|100 in your DSO and it got doubled
    it would be
    ABC|+100
    ABC|+100
    against different requests in the cube - and added to this ill be your correct deltas also.

  • How Oracle returns queries & using rownum

    Hi, I need to limit query results using rownum, but my question is regarding how Oracle retrieves its data.
    Assume I have a table containing 500 records and my query without using rownum will retrieve 62 of those records. The actual query will use rownum and limit results to 20.
    I have a JSP that will display those first 20. It has a simple feature for pagination, a "next" button that will retrieve the next results. So far simple enough, going forwards is easy. But how about going back.
    I am trying to work out the SQL for using a "previous" button, so for example, say records 40-60 are being displayed, and say the first record on that page has a primary key value of 200, what should the SQL be to retrieve the previous 20 records using rownum ? I ask because if I do:
    select * from tablename where pri_key < 200 and rownum <=20;
    I know it will retrieve 20 records, but would the query fetch its results from the beginning of the table or would it count backwards from 200 ? If it is the first way, how could I word the SQL query to go backwards from 200 ? I am pretty sure it will start from the beginning and thats what I don't want. I know there are pagination tags for jsp out there but I want to do this myself.
    Thanks
    Kevin
    Message was edited by:
    MrVen

    First, you need to understand that rownum is only assigned when a record is selected for output, it has nothing to do with any sort of internal order of the table (like insertion order). The same row can have a different rownum even for two invocations of the same query on the same data if the optimizer chooses a different access path. The only way to get a repeatable set of rownum is to sort the records by some field.
    Second, any SQL statement you issue will be executed essentially in isolation. Oracle has no idea what query you executed previously. So, your query:
    SELECT *
    FROM tablename
    WHERE pri_key < 200 and
          rownum <=20;will select a random set of 20 rows wih a primary key less than 200. It is likely to be the first (i.e. lowest values of the pk) rows, but that is not guaranteed.
    The cannonical way to paginate rows is something like:
    SELECT col1, col2, ...
    FROM (SELECT col1, col2, ..., rownum rn
          FROM (SELECT col1, col2, ...
                FROM table
                WHERE <conditions>
                ORDER BY pk) ti
          WHERE rownum <= :maxrownum) to
    WHERE rn >= :minrownumThe innermost query (with the <condition>) selects the appropriate rows and sorts them, in this case by the pk.
    The middle query (rownum <- :maxrownum) discards the rows that would be after the last record you want to display. By using the maxrownum here, it gives Oracle information that allows it to do a fast sort on the inner query if possible.
    In a fast sort, Oracle will get the first maxrownum rows from the query and sort them, then when it gets the next row, it checks if it is less than the highest value already found. If it is, it slots it into the correct place and discards the highest value, otherwise it discards that row.
    The outermost query simply discards the records where the row number after sorting is less than the minimum value.
    Another alternative may be:
    SELECT col1, col2, ...
    FROM (SELECT col1, col2, ...,
                 ROW_NUMBER() OVER(ORDER BY pk) rn
          FROM table
          WHERE <conditions>)
    WHERE rn BETWEEN :minrownum AND :maxrownumdepending on your database version, and your actual query.
    Note tha pagination like this is expensive.
    HTH
    John
    The outermost

  • Removing Duplicate Records  and Merging with the previous record

    Hi
    Can any one help me in doing this..
    I want to delete a duplicate record from the current table.If there is one more record of the same kind. Compare the two records and fill the columns which are empty. Then Merge it. and Remove the duplicate record...Before deleting the record move it into the backup table..
    with regards
    srikanth

    I understand conceptually what you're after. At a detailed level, though, you're going to have to enunciate some specific rules to enforce.
    1) What makes row A a duplicate of row B? Is it just the Name column? Some combination of columns? Something else?
    2) What is the exact rule for merging rows? Among other questions
    - If you have multiple non-NULL values for a particular column, which column wins? If you have one row that is Manchester, NH and one that is Nashua, NH, which would you keep?
    - Does the merge logic depend on the particular column (i.e. perhaps you want the city & state to come from one row whereas first and last name can come from different rows)
    Justin

  • Remove Duplicate record

    Dear All,
    I have oracle 10g R2 On windows.
    I have table structure like below...
    ASSIGNED_TO
    USER_ZONE
    CREATED
    MASTER_FOLIO_NUMBER
    NAME
    A_B_BROKER_CODE
    INTERACTION_ID
    INTERACTION_CREATED
    INTERACTION_STATE
    USER_TEAM_BRANCH
    A4_IN_CALL_TYPE
    A5_IN_CALL_SUBTYPE
    DNT_AGING_IN_DAYS
    DNT_PENDING_WITH
    DNT_ESCALATION_STAGE_2
    DT_UPDATEI use sql loader to load the data from .csv file to oracle table and have assign the value to dt_update sysdate. Everytime i execute the sql loader control file dt_update set as sysdate.
    Sometimes problem occures while inserting data through sql loader and half row get insert. after solving the problem again i execute sql loader and hence these duplicate records get inserted.
    Now I want to remove all the duplicate records for those dt_update is same.
    Please help me to solve the problem
    Regards,
    Chanchal Wankhade.

    Galbarad wrote:
    Hi
    I think you have two ways
    first - if it is first import in your table - you can delete all record from table and run import yet one time
    second - you can delete all duplicate records and not running import
    try this script
    <pre>
    delete from YOUR_TABLE
    where rowid in (select min(rowid)
    from YOUR_TABLE
    group by ASSIGNED_TO,
    USER_ZONE,
    CREATED,
    MASTER_FOLIO_NUMBER,
    NAME,
    A_B_BROKER_CODE,
    INTERACTION_ID,
    INTERACTION_CREATED,
    INTERACTION_STATE,
    USER_TEAM_BRANCH,
    A4_IN_CALL_TYPE,
    A5_IN_CALL_SUBTYPE,
    DNT_AGING_IN_DAYS,
    DNT_PENDING_WITH,
    DNT_ESCALATION_STAGE_2,
    DT_UPDATE)
    </pre>Have you ever tried that script for deleting duplicates? I think not. If you did you'd find it deleted non-duplicates too. You'd also find that it only deletes the first duplicate where there are duplicates.
    XXXX> CREATE TABLE dt_test_dup
      2  AS
      3  SELECT
      4      mod(rownum,3) id
      5  FROM
      6      dual
      7  CONNECT BY
      8      level <= 9
      9  UNION ALL
    10  SELECT
    11      rownum + 3 id
    12  FROM
    13      dual
    14  CONNECT BY
    15      level <= 3
    16  /
    Table created.
    Elapsed: 00:00:00.10
    XXXX> select * from dt_test_dup;
            ID
             1
             2
             0
             1
             2
             0
             1
             2
             0
             4
             5
             6
    12 rows selected.
    Elapsed: 00:00:00.18
    XXXX> delete
      2  from
      3      dt_test_dup
      4  where
      5      rowid IN ( SELECT
      6                    MIN(rowid)
      7                 FROM
      8                     dt_test_dup
      9                 GROUP BY
    10                     id
    11                )
    12  /
    6 rows deleted.
    Elapsed: 00:00:00.51
    XXXX> select * from dt_test_dup;
            ID
             1
             2
             0
             1
             2
             0
    6 rows selected.
    Elapsed: 00:00:00.00

  • Check for duplicate record in SQL database before doing INSERT

    Hey guys,
           This is part powershell app doing a SQL insert. BUt my question really relates to the SQL insert. I need to do a check of the database PRIOR to doing the insert to check for duplicate records and if it exists then that record needs
    to be overwritten. I'm not sure how to accomplish this task. My back end is a SQL 2000 Server. I'm piping the data into my insert statement from a powershell FileSystemWatcher app. In my scenario here if the file dumped into a directory starts with I it gets
    written to a SQL database otherwise it gets written to an Access Table. I know silly, but thats the environment im in. haha.
    Any help is appreciated.
    Thanks in Advance
    Rich T.
    #### DEFINE WATCH FOLDERS AND DEFAULT FILE EXTENSION TO WATCH FOR ####
                $cofa_folder = '\\cpsfs001\Data_pvs\TestCofA'
                $bulk_folder = '\\cpsfs001\PVS\Subsidiary\Nolwood\McWood\POD'
                $filter = '*.tif'
                $cofa = New-Object IO.FileSystemWatcher $cofa_folder, $filter -Property @{ IncludeSubdirectories = $false; EnableRaisingEvents= $true; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite' }
                $bulk = New-Object IO.FileSystemWatcher $bulk_folder, $filter -Property @{ IncludeSubdirectories = $false; EnableRaisingEvents= $true; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite' }
    #### CERTIFICATE OF ANALYSIS AND PACKAGE SHIPPER PROCESSING ####
                Register-ObjectEvent $cofa Created -SourceIdentifier COFA/PACKAGE -Action {
           $name = $Event.SourceEventArgs.Name
           $changeType = $Event.SourceEventArgs.ChangeType
           $timeStamp = $Event.TimeGenerated
    #### CERTIFICATE OF ANALYSIS PROCESS BEGINS ####
                $test=$name.StartsWith("I")
         if ($test -eq $true) {
                $pos = $name.IndexOf(".")
           $left=$name.substring(0,$pos)
           $pos = $left.IndexOf("L")
           $tempItem=$left.substring(0,$pos)
           $lot = $left.Substring($pos + 1)
           $item=$tempItem.Substring(1)
                Write-Host "in_item_key $item in_lot_key $lot imgfilename $name in_cofa_crtdt $timestamp"  -fore green
                Out-File -FilePath c:\OutputLogs\CofA.csv -Append -InputObject "in_item_key $item in_lot_key $lot imgfilename $name in_cofa_crtdt $timestamp"
                start-sleep -s 5
                $conn = New-Object System.Data.SqlClient.SqlConnection("Data Source=PVSNTDB33; Initial Catalog=adagecopy_daily; Integrated Security=TRUE")
                $conn.Open()
                $insert_stmt = "INSERT INTO in_cofa_pvs (in_item_key, in_lot_key, imgfileName, in_cofa_crtdt) VALUES ('$item','$lot','$name','$timestamp')"
                $cmd = $conn.CreateCommand()
                $cmd.CommandText = $insert_stmt
                $cmd.ExecuteNonQuery()
                $conn.Close()
    #### PACKAGE SHIPPER PROCESS BEGINS ####
              elseif ($test -eq $false) {
                $pos = $name.IndexOf(".")
           $left=$name.substring(0,$pos)
           $pos = $left.IndexOf("O")
           $tempItem=$left.substring(0,$pos)
           $order = $left.Substring($pos + 1)
           $shipid=$tempItem.Substring(1)
                Write-Host "so_hdr_key $order so_ship_key $shipid imgfilename $name in_cofa_crtdt $timestamp"  -fore green
                Out-File -FilePath c:\OutputLogs\PackageShipper.csv -Append -InputObject "so_hdr_key $order so_ship_key $shipid imgfilename $name in_cofa_crtdt $timestamp"
    Rich Thompson

    Hi
    Since SQL Server 2000 has been out of support, I recommend you to upgrade the SQL Server 2000 to a higher version, such as SQL Server 2005 or SQL Server 2008.
    According to your description, you can try the following methods to check duplicate record in SQL Server.
    1. You can use
    RAISERROR to check the duplicate record, if exists then RAISERROR unless insert accordingly, code block is given below:
    IF EXISTS (SELECT 1 FROM TableName AS t
    WHERE t.Column1 = @ Column1
    AND t.Column2 = @ Column2)
    BEGIN
    RAISERROR(‘Duplicate records’,18,1)
    END
    ELSE
    BEGIN
    INSERT INTO TableName (Column1, Column2, Column3)
    SELECT @ Column1, @ Column2, @ Column3
    END
    2. Also you can create UNIQUE INDEX or UNIQUE CONSTRAINT on the column of a table, when you try to INSERT a value that conflicts with the INDEX/CONSTRAINT, an exception will be thrown. 
    Add the unique index:
    CREATE UNIQUE INDEX Unique_Index_name ON TableName(ColumnName)
    Add the unique constraint:
    ALTER TABLE TableName
    ADD CONSTRAINT Unique_Contraint_Name
    UNIQUE (ColumnName)
    Thanks
    Lydia Zhang

  • How to make a duplicate record in oracle fomr

    Hi,
    I have a custom master-detail form in ebs. User wants to query a record and store a duplicate record in the database with modification of some column values.
    I am using custom tables in data blocks.
    Please guide me how can I do it.
    Regards
    Farooq

    create a button and then insert a record based on the records queried:
    when button-pressed:
    insert into t_x() values();
    commit;

  • Calling a function from SQL prompt that returns a record

    Hi,
    I've been trying to execute a function that is present on a different database. for eg. I am loged on to a database say 'A' and trying to execute a function present in database 'B'. this function is present in a package 'X' which has 2 functions and two procedures. From the packages i am able to execute the two procedures and one of the function.
    So i guess it is not a problem with the access permissions. The function that i am trying to call say function I has got 3 OUT
    parameters and 1 IN parameter. the Function returns a record. When i try to execute this function i get an error. Can you please let me know as to how exactly i need to call this function from the SQL prompt...
    thanx in advance
    null

    Hi Anand,
    As your function has 3 OUT parameters and it returns a record you can not just call it from SQL Plus. You need to write small PL/SQL program and use variables to hold the OUT values and the returned record.
    Good Luck,
    RajKiran
    null

Maybe you are looking for

  • Need to replace the screen on my ipad and ipod, how to do without having to pay a fortune?

    Do not refuse to pay, but pay practically the value of another product, and all the expenses with displacement, because in my state do not have a service that does this serviço.isso I do not accept. here is my outrage and disappointment. Another alte

  • IFRAME Page being redirected to iFrame SRC url instead.

    I am having a problem in getting iFRAME code to work in iWeb 08. I have a link on page A which takes me to page B where I have pasted following code within a Html Snippet : +<IFRAME SRC="http://www. google.com" WIDTH=1000 HEIGHT=500>+ +Not working bu

  • Oracle TimesTen In-Memory Database VS Oracle In-Memory Database Cache

    Hi, What is difference in Oracle TimesTen In-Memory Database VS Oracle In-Memory Database Cache. For 32 bit on windows OS i am not able to insert data's more than 500k rows with 150 columns (with combinations of CHAR,BINARY_DOUBLE,BINARY_FLOAT, TT_BI

  • ANN: Open Source Flash Player Scripting Engine

    Mozilla bekommt den Quellcode für die ActionScript™ Virtual Machine Das OS-Projekt heißt "Tamarin". Dürfte spannend werden. http://www.adobe.com/aboutadobe/pressroom/pressreleases/200611/110706Mozilla.html http://www.mozilla.org/projects/tamarin

  • Syncing calendars using Outlook 2007 from iCal Server

    Hi, I would like to know the procedure to sync calendars using Outlook 2007 from iCal Server. I'm setting up Internet Calendar on Outlook 2007 from == Tools> Account Settings> Internet Calendars>New> Enter the URL and click on add button Post that, I