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

Similar Messages

  • Multiple Selection from a data block

    Hello,
    I have a data block returning the names and surnames of employees. Can I select multiple rows from that data block?
    Thank you

    You could put a checkbox on the row and if it is ticked then interpret this as a selected row.
    Sometimes it is useful to store this type of selection in some type of structure like a record group or index by table and process those rows rather than read the data block

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

  • Query from multiple data blocks

    Hello professionals,
    I having difficulty in finding solutions to query data from multiple data blocks. By the way I'm using Oracle Forms 10g
    I have 4 data blocks and all items are database items
    Below are the blocks,
    1. student_main (columns : student_id, student_name, student_state)
    2. subject_main (columns : subject_id, subject_desc, subject_student_id)
    3. invoice_main (columns : invoice_no, invoice_amt, invoice_student_id)
    4. receipt_main (columns : receipt_no, receipt_amt, receipt_invoice_ref)
    The form will need to allow user to be able to query from any of the items/fields from the data blocks as listed above
    For eg,
    : if user query student_id then all related value items from table subject_main, invoice_main, receipt_main need to be displayed
    : if user query invoice_no then all related value items from table student_main, subject_main, receipt_main need to be displayed
    However the tricky part is that some student might have or might not have invoice / receipt data
    I tried using relations but it didn't work both ways
    I even create relations in every table (student_main to subject_main, subject_main to student_main, invoice_main to student_main, student_main to invoice_main and etc.) but it just make my running process hang
    Need help on this matter
    Thank you
    Edited by: 990092 on Feb 25, 2013 12:15 AM

    990092 wrote:
    Hello professionals,
    I having difficulty in finding solutions to query data from multiple data blocks. By the way I'm using Oracle Forms 10g
    I have 4 data blocks and all items are database items
    Below are the blocks,
    1. student_main (columns : student_id, student_name, student_state)
    2. subject_main (columns : subject_id, subject_desc, subject_student_id)
    3. invoice_main (columns : invoice_no, invoice_amt, invoice_student_id)
    4. receipt_main (columns : receipt_no, receipt_amt, receipt_invoice_ref)
    The form will need to allow user to be able to query from any of the items/fields from the data blocks as listed above
    For eg,
    : if user query student_id then all related value items from table subject_main, invoice_main, receipt_main need to be displayed
    : if user query invoice_no then all related value items from table student_main, subject_main, receipt_main need to be displayed
    However the tricky part is that some student might have or might not have invoice / receipt data
    I tried using relations but it didn't work both ways
    I even create relations in every table (student_main to subject_main, subject_main to student_main, invoice_main to student_main, student_main to invoice_main and etc.) but it just make my running process hang
    In general, relation will work. your relation creating was wrong, i think.
    do as
    1. student_main master to subject_main details
    2. student_main master to invoice_main details
    3. invoice_main master to receipt_main details
    Hope this helps
    Hamid

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

  • Inserting multiple records in a data block

    Hi, how do i insert multiple rows from a record group into a data block. Thanks

    You do it manually. Copy the values and move to the next record in the record group and in the block.
    You might like the concept of basing a block on a stored procedure better. Check out the stored procedure based block sample that comes with the Oracle Forms demos.

  • 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;
    /

  • Forms Data-Block based on stored procedures - REF CURSOR feature NOT FUNCTIONING

    This topic is related to another topic in this forum titled "FORMS HOW TO SET QUERY SOURCE ARGUMENTS??" I posted my message there as well. I am posting as a NEW TOPIC so that it catches the attention of Oracle Support.
    I built a data form based on a stored procedure and REF CURSOR IN OUT parameter.
    My procedure takes a IN parameter to fill in the criteria for the OPEN <cursor_variable> select ... where ... statement.
    In the Value setting of the Query source Arguments , I set the VALUE to ":BLOCK_NAME.ITEM_NAME" at design time to supply the input value to the procedure. this works to the extent of making available the form item value to the stored procedure parameter. I verified this by doing an insert into some debug table , of the incoming parameter value inside my stored procedure.
    The cursor gets opened properly into the REF cursor variable. I verified this by fetching a record into a local variable and inserting the value into a debug table again in the stored procedure.
    (I took care to close and re-open the REF cursor variable again - so that the front-end can continue to fetch it from the first record. )
    ***** PROBLEM **************
    But the front end forms runtime is giving me a FRM-40301 - query returned no records even though the REF cursor is returned properly opened.
    Did anybody else face the same problem ??
    Please post what you found.
    Thanks,
    Shankaran
    null

    This topic is discussed at length in another thread "How Set Value For Query DataSource Arguments?"
    But I am posting the findings here as well.
    THIS TOPIC IS CLOSED.
    My Bad. The problem Cause : I did not include all columns in the
    cursor rowtype in the Data-block. In the wizard for the data block , I selected ONLY the columns that I needed. But I was doing a Select * from <my_table> in my open cursor <Cursor-Variable> .... The <Cursor Variable>
    itself was declared <my_table>%rowtype
    FIX : The Data Block structure (columns included as items) should match the cursor record Structure. One may or may not
    display all the columns in the LAYOUT though.
    But I don't understand why it gives such a misleading message like FRM-40301 Query retrieved no records. Oracle Team fix it.
    Hope this helps people who face the same problem.
    Thanks,

  • Photos in my from my iPhone have same numbering as photos from my dig camera.  They all go into iPhoto fine but when I backup to my ext hard drive it will only save one with the name IMG 1002 and I have two separate images both with that name.  Help?

    Photos in my from my iPhone have the same numbering as photos from my digital camera.  They all go into iPhoto fine but when I backup to my ext hard drive it will only save one with the name IMG 1002 and I have two separate images both with that name.  How do I get them all to save on my ext hard drive and hope do I prevent this numbering overlap in the future?  I'm really hoping I don't have to go through and manually rename every single picture.  Thanks.

    How are you backing up the photos?  The best way is to backup the library itself as that will preserve your organizational efforts as well as all metadata like keywords, titles, faces, places, books, etc.
    You can use a backup application that does incremental backups.  Thus only the first backup is a full one and subsequent backups just copy those files that are new or changed. I use Synk Pro.  The lower cost version, Synk, will do the same job.  Other similar apps can be found at MacUpdate.com.  
    OR: upload your camera to a folder on the Desktop. There you can rename the files to something that is more informative than just the file name.  I use the date (international format) along with a brief desc: 2007-1-20-adian1stbday-001.jpg.  File renaming apps can also be found at MacUpdate.com.  Also you can give the folder an informatve name which will become the Event name when you import the folder of photos into iPhoto.
    OT

  • 9i Forms Challenge! Query records from a data block based on this view

    According to Oracle Support, it is not unusual that complicated views like the one shown below fail to work in Forms. They recommend that I "try using a When-validate trigger" to solve the problem. I would be grateful if someone could show me how. It would also be helpful if someone could explain why Forms would have a problem querying such a view in the first place.
    Thanks very much!
    CREATE TABLE t (
    id NUMBER,
    property VARCHAR2(2),
    val NUMBER
    INSERT INTO t VALUES ( 1, 'A', 10 );
    INSERT INTO t VALUES ( 1, 'B', 11 );
    INSERT INTO t VALUES ( 2, 'A', 12 );
    INSERT INTO t VALUES ( 2, 'B', 13 );
    INSERT INTO t VALUES ( 3, 'A', 14 );
    || This view produces an ORA-01403 no data found error
    || in Oracle Forms 9i.
    CREATE OR REPLACE VIEW t_v
    AS
    SELECT id,
    MAX( DECODE( property, 'A', val, NULL ) ) AS a_val,
    MAX( DECODE( property, 'B', val, NULL ) ) AS b_val
    FROM t
    GROUP BY id;

    Steve,
    Your suggestion to put the view definition into the tablename field of the forms properties sheet was fruitful.
    Instead of the ORA-01403 error (No data found), I get ORA-24347 (Warning of a NULL column in an aggregate function). This error led me to discover bug 2457121, filed 11-Jul-2002, through Metalink. This bug is reported to only be a problem in Forms 9.0.2.7. It is reported to be fixed in Forms version 9.0.2.12.
    Thanks for your interest and help.
    - Doug

  • HT5517 How can I choose multiple speakers to play simultaneously from AppleTV in the same way I can from iTunes on my PC?

    Is there a way to select multiple speakers with Apple TV?

    i don't think so if I remember properly... I've wanted to do that and I remember I couldn't... would be a good feature!

  • Retrieve data from LONG data types

    Hi,
    I am trying to retrieve data from LONG data types with following query.
    select * from all_views where upper(text) like '%TABLE_NAME%';
    In above query text column has long datatype. This query works for varchar, but it returns an error for long.
    How can I modify the query so that it returns data from text column.
    Thanks in advance,
    Aditya

    You can't use any expressions against LONG. One solution is to use PL/SQL:
    BEGIN
        FOR v_rec IN (SELECT * FROM ALL_VIEWS) LOOP
          IF UPPER(v_rec.text) LIKE '%TABLE_NAME%'
            THEN
              DBMS_OUTPUT.PUT_LINE(v_rec.text);
          END IF;
        END LOOP;
    END;
    /SY.

  • Re-populating values in data block after commit

    I have a form with 2 tabs. The user can create an event in first tab and then associate/disassociate the event to data_points in the second tab (associate_event data block).
    Say, I create an event, and query the records affected by the event in second tab, 5 records are retrieved. I press the associate_to_event push button and hit Save. All the 5 records get associated to the event, but as the associate_event data block is based off a view with instead-of triggers, I do not get any message saying 'these many rows were affected'.
    I am OK with not getting the message, but atleast I should re-populate the values in that block so that the user can see that the changes were made.
    So I created a key-commit trigger on the associate_event data block. The code in that trigger is as follows:
    do_key(commit_form);
    repopulate_values;
    But my form is just sitting there (taking long to fiinish and hence timing out). Is there any other way of doing this?
    (Also on another note, if I repopulate the associate_event datablock, the status of that block will be changed (as I am proceduraly assigning values to the block ) and then when user wants to exit the form, it will agaiin ask for 'Do you want to save the changed you made?' How do I avoid it?? Do I create a global variable and assign it some value say 1 when called from the key-commit trigger and check somewhere ?? if the value is '1' then dont pop-up that message )
    Thanks in advance.

    Thank you Magoo.
    I am now able to re-populate the values. (The way my form was sitting there, made me that it was going in an infinite loop, but I could not point out what was causing that. Thanks!)
    But my data-block associate_event retreives multiple records, therefore
    "set_record_property ( :system.cursor_record, 'associate_event', status, query_status ); --> no ask for commit after repopulate_values ... "
    does not work. And if I select Yes from the pop-up, I am getting the following error 'ORA-00933: SQL command not properly ended'. I checked the error and some how the update statement is incomplete. (This error does not/did not occur earlier when I just retrieve data. Remember, its coming from a view and the datablock is getting populated proceduraly, therefore everytime I wish to go out of the form, even after a retrieve , I get the message. (Which is fine with the customer.) So I dont get the 'ORA-00933: SQL command not properly ended' , when I press yes !! (But it tries to a insert and not an update at that time and I have a instead of update/insert trigger on the view).)
    How do I get rid of the pop up, after the commit. I could not find any similar set_block_property :(.
    Or should I suppress the pop-up in key_commit, or do another commit-form after repopulating data??

  • Group by on data block

    Hi all
    sorry for troubling u frequently actually i am in a firefighting mode and the deadline of the forms is by weekend and i am relatively new to forms
    i have a summary block on which i want to use a where clause where there is a group by
    the summary data block consists of 4 columns
    order_number,part_number,status,quantity
    i want to display the records based on the sum(quantity)
    basically
    select order_number,part_number,status,sum(quantity)
    from summary
    where order_number = order number from the control block form
    and part number =part number from the control block form
    and status = status from the control block form
    group by order_number,part_number,status
    is it possible to write my where clause as
    where order_number = order number from the control block form
    and part number =part number from the control block form
    and status = status from the control block form
    group by order_number,part_number,status
    and if yes where do i specify the sum(quantity)
    please help me
    thanks a lot for your help you are providing me
    thanks
    satish

    Hi
    if yes where do i specify the sum(quantity)in any display item on the ctl block.
    SELECT order_number , part_number , status , sum(quantity)
    INTO  : order_number  , : part_number  , : status  , :quantity
    from summary
    WHERE order_number = :cotrol_block.order number
    and part number = :cotrol_block.part number
    and status = :cotrol_block.status
    GROUP BY order_number,part_number,statusHope this help...
    Regards,
    Abdetu...

  • Relationship between a data block and latch

    Hello Experts,
    I have just read an article about indexes and full table scan by Richard Foote. http://richardfoote.wordpress.com/2009/04/16/indexes-on-small-tables-part-i-one-of-the-few/
    I thought each block required only one latch for each operation. However, I don't undersand that why a single block required 2 latch? The qoute is the following,
    Note that yes indeed, there were 4 consistent gets performed and that none of the consistent gets were the “cheaper” consistent gets examinations. Therefore, the 4 consistent gets used in performing the FTS of the one block table required 4 x 2 = 8 latches.
    Can anyone explain the above quote please?
    Thanks in advance.

    Jonathan Lewis wrote:
    Solomon Yakobson wrote:
    Read Concepts manual. Database Buffer Cache in particular:Every buffer has an access mode: pinned or free (unpinned).
    I hope the manual doesn't use the word "free" as a synonym for "unpinned", since a buffer (header) with state = "free" is one that doesn't hold a copy of a datablock and is therefore immediately available for re-use.
    Regards
    Jonathan Lewis
    Hello Sir,
    I have just read Memory Architecture document, buffer states part, I know the meaning of dirty buffers. However, when we just SELECT any table, the corresponding data blocks that read into memory from disk, are they considered as clean buffers? Because as far as I understand from dirty buffers, these are modified buffers. And maybe the manual should have used "clean" instead of "free"?
    The database uses a sophisticated algorithm to make buffer access efficient. Pointers to dirty and nondirty buffers exist on the same least recently used (LRU) list, which has a hot end and cold end. A coldbuffer is one that has not been recently used. A hot buffer is frequently accessed and has been recently used
    Also the above statement is excerpt from Oracle Memory Architecture document, does the nondirty buffers refer to data blocks that move to the memory in SELECT query?
    Thanks a lot for your remarkable thoughts.

Maybe you are looking for

  • Source Material error when burning disk image

    Well, I've been haunting these forums for 10 days, finding answers to every darn problem under the sun I've encountered! (thanks folks, I've been near hysteria) Now I have yet another problem, and I cannot find an answer in the forums (sorry if it's

  • Unable to reclaim free space

    tablespace size: 62G, 14 4G files and 1 6G file, freespace =51G When I try to resize datafiles, I get an error; the max free space per file =1G --- not sure what is using up the space. environment: 10.2.0.3 2-node RAC cluster on Red Hat Linux 4 Can s

  • INVOICE NO. & DATE in Customer Complaint

    Dear SAPians, I Want to capture INVOICE NUMBER and INVOICE DATE automatically against the customer complaint type 'Q1' with in the standard fields given in the Standard SAP screens like 'Serial Number', Cus. Materil Number', or 'Device Data' etc. We

  • [SOLVED]package integrity check fails

    I recently ran a pacman -Syu so it downloaded all the files I wanted but when it went to install the packages, the integrity check failed at opera, the error I got was: http://pastebin.com/m447d9848 my questions are, what is the problem? how can I fi

  • Ehancement: ability to compound smart Collection rules

    Need a collection that is: Not rated & No stars & No color -OR- Not rated & No stars & Yellow.  Defaulting the "Match" dropdown to "all"  and adding  a new "+-" AND/OR dropdown would make the above logic possible. This would also make possible many m