Difference between records in two data blocks

Can you suggest me the best method to find difference (minus) between records in two similar data blocks.
Thanks!

What's your database version? Does this work? It can make the job a lot easier as you only have to loop through each block once.
-- create collection types
CREATE TYPE myobj AS object(col1 NUMBER, col2 NUMBER);
CREATE TYPE mytab AS TABLE OF myobj;
-- in the form:
DECLARE
  b1 mytab := mytab();
  b2 mytab := mytab();
BEGIN
  -- loop through blocks and populate collections
  b1.extend;
  b1(1) := myobj(1,1);
  b1.extend;
  b1(2) := myobj(2,1);
  b1.extend;
  b1(3) := myobj(3,5);
  b1.extend;
  b1(4) := myobj(4,2);
  b2.extend;
  b2(1) := myobj(1,1);
  b2.extend;
  b2(2) := myobj(2,2);
  b2.extend;
  b2(3) := myobj(3,5);
  -- find the difference (you might need to pass collections as parameters to a
  -- server-side function and do the query there)
  FOR rec IN (
    SELECT col1, col2 FROM TABLE(CAST(b1 AS mytab))
    MINUS
    SELECT col1, col2 FROM TABLE(CAST(b2 AS mytab))
  ) LOOP
    Dbms_Output.put_line(rec.col1||'-'||rec.col2);
  END LOOP;   
END;
/

Similar Messages

  • How to call two data blocks at a time.

    hi all
    i want to call two data blocks at a time on function when button pressed.
    how can I it?
    many thanks

    Many thanks that you people reply,
    I am working in oracle form developer 6i and database 10g.
    I have a form that have three data blocks,
    first block have text boxes and search button,and next two blocks display records on the basis of search criteria that is inserted in the first block and when is clicked on save button.
    the data that is to b displayed is from two different tables.
    i used Go_block('my_block')
    and call other block with the same method.
    kindly guide me how can i do it.
    Thanks in advance

  • Updating record in a data block based on view in oracle forms

    hi all ,
    We have two data blocks in our custom oracle form.The first data block is for search criteria provided with buttons 'GO' and 'ADD ROW' and the second data block is based on a view that fetches record when user clicks on GO based on the the criteria specified in the above block. The Below block contains one SAVE button too.
    We have a requirement when GO button is pressed and corresponding records are shown in the below block, user should be able to edit the record. Want to know how to make it editable?
    Help appreciated....!!!

    Your view is based on how many tables and does it include all NOT NULL fields from all tables?

  • How to query two data blocks simultaneously?

    Dear all,
    Need your inputs on the following problem statement...
    Existing Functionality:
    We have two data blocks A (Parent) and B (Child) in a relationship. Both data blocks refer to different tables.
    Data block A is the query data block and for a single record in block A we can have multiple records in block B. Multiple records in block B are shown one at a time after executing a query, this is implemented by using a list item C (belongs to a third block).
    For example
    Let us say block B can have 5 different types of entries for each record in block A. In this case the list item C will have 5 values corresponding to these entries. Once the query is executed, block B will show the default entry for the queried record in block A. To see other entries for the record user can select the required value in list item C and corresponding entry in block B will be fetched.
    Requirement:
    Our requirement now is to enable querying upon both data blocks A and B simultaneously. To implement this I replaced data blocks A and B with a single data block X which is based on the join of the two tables referred by the Data blocks A and B earlier. As the fields should allow insert, update, delete operations we did not use a view here.
    Issue:
    Now the problem is, each record in block A for which block B had multiple entries earlier is now getting listed multiple times because of the join.
    I have tried but could not find any solution for this. I would appreciate if any of you can suggest how we can query both blocks simultaneously without affecting the existing functionality.
    Thanks,
    Amit

    I don't understand your requirement in detail. I try to repeat what i understood so far.
    You have a master-block A based on a table A and a detail-block B based on a table B. So far so good. You can now query based on conditions just the datablock A, because B is a detail and therefore can only be queryied in context of block A.
    Your reuirement is to query on both blocks A and B and find block in B also without giving conditions for the relevant block A.
    Is it that ?
    What i don't understand, what is block C used for?
    An idea for the querying of block B's data: Create Non-database-items items in block A for the search-criteria you need on block B and make them Queryable.
    In the PRE-QUERY-trigger on block A build a WHERE-condition if that search-criteria is entered, something like
    IF :BLOCK_A.SEARCH_CRITERIA_FOR_BLOCK_B IS NOT NULL THEN
      SET_BLOCK_PROPERTY('BLOCK_A', ONETIME_WHERE, 'WHERE PKVALUE IN (SELECT FKVALUE_TO_A FROM TABLE_B WHERE FIELDVALUE=' ||:BLOCK_A.SEARCH_CRITERIA_FOR_BLOCK_B)');
    END IF;This would query also records to A for which you want to have the B-records. So you could keep block-structure up to master-detail.

  • Retrieving records from a Data Block same as retrieving records from cursor

    Dear Gurus,
    Is it possible to retrieve records from a datablock same as retrieving records from a cursor,
    Eg:
    I am having two data blocks in two different tabs, Say B1 in Tab1, B2 in Tab2
    B1 is filled with two records, now when I switch to Tab2,
    I want all records of B1 in B2, assuming that blocks are having the same structure.
    The code I wish to write is,
    Goto B1,
    Take all the records like a cursor,
    Goto B2,
    loop
    insert
    end loop;
    Is this possible???

    I need to show it before saving,
    I tried this and it is successful somehow, do not know about any further problems,
    I took the record count of both blocks
    if :B1.reccount <> :B2.reccount
                   then
                   go_block('B1');
                   first_record;
                   for i in 1..:B1.reccount
                   loop
                        go_block('B1');
                        go_record(i);
              assign values from B1 to variables.
              go_block('B2');
              assign values from variables to B2
              next_record;
                   end loop;
                   clear_record;
              end if;
    This is working, Now I just want to know, if my block is having numerous fields, say more than 100 (may not be a value for large databases)
    how can I replace these variables here.
    I mean is it possible to declare something like a cursor record type.
    For eg : r1 cursor%rowtype

  • How can we scroll two data blocks..?

    HI,
    Can any one please help if it is possible to scroll two data blocks at the same time? Like I got two blocks . One block 'Block1' has list of products .Its a multiple record block.The other is like a details block 'Block2'. It's also a multiple record block but it has got more than one record for each record in 'Block1'.So what I need is if the user scrolls through 'Block1' then the corresponding 'Block' should also be scrolled to corresponding detail records.
    Iam not sure if its possible or not. So can any one please help me with this.
    Thanks in advance,
    Karlos

    Agree,
    what you are looking for is master-detail. If you have a realtionship defined in the database then Forms will automatically pick up this condition and set the relation. Just add each table as a block onto the canvas
    Frank

  • Difference between relational integrity and data intigrity

    hi
    could anybody tell me
    what is the difference between
    relational integrity and data intigrity
    tahnx
    kals.

    hi,
    Data Integrity
    Data integrity means, in part, that you can correctly and consistently navigate and manipulate the tables in the database. There are two basic rules to ensure data integrity; entity integrity and referential integrity.
    The entity integrity rule states that the value of the primary key can never be a null value (a null value is one that has no value and is not the same as a blank). Because a primary key is used to identify a unique row in a relational table, its value must always be specified and should never be unknown. The integrity rule requires that insert, update, and delete operations maintain the uniqueness and existence of all primary keys.
    The referential integrity rule states that if a relational table has a foreign key, then every value of the foreign key must either be null or match the values in the relational table in which that foreign key is a primary key.
    What is a Relational Integrity?
    A relational database contains tables of data which are related to each other. For example, articles are related to the author who wrote them, and conversely, authors are related to the articles they wrote. (Sounds obvious, and it is.) That's the relational part.
    When we work with a relational database, we naturally expect that data in related tables stay related. For example, articles written by MartinB should always be related to MartinB and never be confused with articles written by any other author. That's the integrity part.
    Relational Integrity is also called Referential Integrity, perhaps because the mechanism for ensuring integrity is implemented by the way the tables reference each other. Both terms are okay with me. I usually just say RI anyway.
    Regards,
    Sourabh

  • Difference between 0FI_AP_30 and 0FI_AP_4 Data source

    HI,
    What is the difference between 0FI_AP_30 and 0FI_AP_4 Data source.
    Thanks in advance

    Hi,
    In addition to above differences. Below is the functional difference between 0FI_AP_30 & 0FI_AP_4:
    0FI_AP_4 gives you accounts payable line items in your report. Here GL account shows the balances of particular types of  vendors/payables to which that particular GL account is been assigned.
    And If subledger is activated in ECC, then by using 0FI_AP_30 you can get the break up of that particular GL balance according to vendors.
    To make use of datasource 0FI_AP_30, subledger accounting must be activated in ECC.
    Regards,
    Pradip

  • Counting number of records in a data block

    hi folks,
    Simple question for you guys: How can I count number of records in a data block.
    In other words, say I have 10 detail records listed on a data block (one of my columns is a non-database item for entering a number). Now I just want to do somethin like:
    Select count(*) From <data_block> into lnRecCount
    Where <non-database column> <> 0 ;
    Can I do this in a button trigger? I can't get it to work?
    Thanks,
    bob

    You should make a routine that go through records of the block and count the records that agree with your condition.

  • Please  tell me the difference between CREATE OBJECT & CREATE DATA ,statements in CRMTECHNICAL

    Please  tell me the difference between CREATE OBJECT & CREATE DATA ,statements in CRMTECHNICAL

    found it on my own . the best way to do this is use the RetriveLimitedHierTreeCommand  with a search on the taxonomy table.

  • Difference between DEclaring Itab with DATA & TYpe Statement?

    HI Friends,
      What is the Difference between Declaring Itab with DATA & TYpe Statement?

    Hi,
    The Statements TYPES and DATA
    Each ABAP program define its own data types using the statement.
    TYPES dtype TYPE type ...
    and declare its own variables or instance attributes of classes using the statement
    DATA var {TYPE type} ...
    Within the program or a class, you can also define local data types and variables within procedures. Local variables in procedures obscure identically-named variables in the main program or class.
    When creating data types and data objects, there are a number of naming convention that also apply for other local program definitions, such as procedures. These are described in detail in the keyword documentation.
    The Additions TYPE and LIKE
    The additions TYPE type and LIKE dobj are used in various ABAP statements. The additions can have various meanings, depending on the syntax and context.
    ·        Definition of local types in a program
    ·        Declaration of data objects
    ·        Dynamic creation of data objects
    ·        Specification of the type of formal parameters in subroutines
    ·        Specification of the type of formal parameters in methods
    ·        Specification of the type of field symbols
    TYPES: BEGIN OF struct,
             number_1 TYPE i,
             number_2 TYPE p DECIMALS 2,
           END OF struct.
    DATA:  wa_struct TYPE struct,
           number    LIKE wa_struct-number_2,
           date      LIKE sy-datum,
           time      TYPE t,
           text      TYPE string,
           company   TYPE s_carr_id.
    This example declares variables with reference to the internal type STRUCT in the program, a component of an existing data object wa_struct, the predefined data object SY-DATUM, the predefined ABAP type t and STRING, and the data element S_CARR_ID from the ABAP Dictionary.
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • Difference between Manual Standby and Data Guard Broker..

    hi,
    could any let me know any usefull docs which help to understand the difference between manual dr and data guard broker?
    thanks,

    >
    could any let me know any usefull docs which help to understand the difference between manual dr and data guard broker?
    >
    Without Data Guard Broker:
    http://www.oracle.com/pls/db112/to_toc?pathname=server.112/e17022/toc.htm
    With Data Guard Broker:
    http://www.oracle.com/pls/db112/to_toc?pathname=server.112/e17023/toc.htm
    See especially why you want to use the broker:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17023/concepts.htm#i1013106
    In short: You should have a good reason if you do not use the broker, because it is the officially recommended way to maintain Data Guard. It is even required for some features like Fast-Start Failover.
    Kind regards
    Uwe Hesse
    http://uhesse.wordpress.com

  • Difference between passive and active data connection mode for  FTP

    Hi,
    Does any body have the idea of passive and active data connection mode for the transport protocol FTP.
    I have one server with FTP, I have to pick the data from this FTP to XI.
    What is the difference between active and passive data connection? Does XI supports both the connections?
    Thanks & Regards
    Katta Mohan Reddy

    Hi
    According to SAP Note - 821267
    Q: Does the File Adapter support active data connections when connecting to an FTP server?
    A: Up to and including SP14, the File Adapter exclusively uses passive data connections. Starting with SP15, active connections will be available.
    Difference between active and passive,
    You can definitely refer to the site mentioned by Suraj
    cheers
    Sameer

  • Whats the difference between records & arrays?

    hi,
    Im very new to JAVA... and one thing I dont seem to understand is the difference between a record and an array!
    Any help would be much appreciated..
    Thanx!

    an array is sort of like a group of records with one column. A two dimensional array is like an array of arrays and starts to look a little like a record (in that there are a number of "rows" each of which has a group of values. The concept is pretty far away from the idea of records like in a relational database though. For instance a java array can look like this:
    int[][] table =
    {   { 2, 2, 4, 3, 1, 2},
    { 1, 3, 3, 0, 0, 9},
    {12,9 ,1, -2, 5, 7},
    { 3, 5, 7, 2, 9, 1} };
    each row sort of being like a record. But a java array can also look like this, where the number of "columns" in each "row" is different
    int table[][] = { {1, 2, 3, 0, 3},
    {3, 8},
    {2, 1, 7, 9},
    {4, 6, 2, 8, 7, 0, 7, 8} };

  • Difference between "Database Variant To Data" and "Variant To Data"

    Can anyone tell me the differnce between the 2 VI's "Database Variant To Data" and "Variant To Data"?
    I am using the database connectivity toolset and making a query.
    I have tried using both, but the give me the same result.
    Attachments:
    Variant to Data.JPG ‏45 KB

    You won't see a difference between these two functions with just a string or other simple data types.  Where you'll see a difference is with clusters and more complex data types that come from the database.  The variants returned by databases can be slightly different than the standard variant.  That is where the Database Variant To Data is needed.  Otherwise, if you are just reading string information, either function will work fine.
    Crystal

Maybe you are looking for

  • Help with if and elseif

    I have this script working fine: if (DateTimeField1.rawValue ne null) then Num2Date(Date2Num(DateTimeField1.formattedValue, "EEEE, MMM D, YYYY")+ 1, "EEEE, MMM D, YYYY") else null endif But I need to add 2 days if the first date selected is a SATURDA

  • Problem with Configuration in Production ( ABAP Proxy - XI - FILE)

    Hi All, I have a ABAP Proxy -> XI -> FILE scenario wich is working perfectly in DEV and QAS environment. When the person responsible for transporting tried to transport the objects in QAS to PRD, the following error happened: Direction of communicati

  • My page generates an Excel file but sometimes fails if the page loads to slowly...

    I'm having a problem generating an Excel file using CF and looping over a bunch of queries to get a table of data to display to the user. This is slow but works fine except for an instance recently where the page seems to be loading but after a few m

  • How to maintain the date fromat in DD.MM.YY

    Hi I want maintain the date fromat like DD.MM.YY i have used following statement but it is showing systax error. please send the solution for this asap          write: i_vbrk-erdat to v_erdat dd.mm.yy. regards venu

  • How do I change "Save" defaults?

    The current default when I go to save a file is 44100 stereo, 32-bit.  How do I change it to 44100 stereo 16-bit?  The same goes for the "Save As" and "Save Selection As" functions.