Querying a multi-record in my form block

I have a form where I perform validations of items entered on my main block. I compare the value of the item entered an expected value and if they are different then an exception record must be created in a separate block, several recording in my application. A record on my main block can end up with several different recordings of exception in the block of multi-record. As a result, my validation must include determining if the user has already created an exception record for the article I'm validating in the block of multi-record.

Is it possible for me to query and uncomitted, block multi-record in my form? Help would be greatly appreciated!

That's what I meant with "loop on the block."

Write a function, lets call it FK_CHECK_FOR_EXCEPTION, give in the code and the name of the element as parameters and let it returns TRUE if the exception exists, false otherwise:

FUNCTION FK_CHECK_FOR_EXCEPTION(i_vcItem IN VARCHAR2, i_vcCode IN VARCHAR2)
RETURN BOOLEAN IS
  bFound BOOLEAN:=FALSE;
BEGIN
  GO_BLOCK('BLOCK_B');
  FIRST_RECORD;
  LOOP
    EXIT WHEN :SYSTEM.RECORD_STATUS='TRUE';
    IF     :BLOCK_B.ITEM=i_vcItem
       AND :BLOCK_B.CODE=i_vcCode THEN
      bFound:=TRUE;
      EXIT;
    END IF;
    EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
    NEXT_RECORD;
  END LOOP;
  RETURN bFound;
END;

Then, in your VALIDATION KEY, you can something like:

IF =FALSE THEN
  IF NOT FK_CHECK_FOR_EXCEPTION('ITEM1', 'THECODE') THEN
    RAISE FORM_TRIGGER_FAILURE;
  END IF;
END IF;

Tags: Oracle Development

Similar Questions

  • have a multi-record with several unrelated elements blocking, filled by simply calling

    Forms of oracle, I have a form with a block of several recording, with several unrelated elements.
    One of these non-is a basic formula element.
    The formula for this article fills the others not consolidated items.
    A procedure with several out parameters is called.

    For example
    : cmr.id (now the unique id of a database record)
    : cmr.unbound_dummy, with the formula f_fill_blk_unbound_items(:blk.id)
    : cmr.unbound_adres
    : cmr.unbound_contactperson

    function f_fill_blk_unbound_items (p_id in customers.id%type)
    Return number
    is
    number of l_rc;
    Start
    customer_pck.get_adres_and_contactperson
    (p_id = > p_id - IN)
    , p_adres = >: cmr.unbound_adres - OUT
    , p_contactperson = >: cmr.unbound_contactperson - OUT
    );
    Return (0);
    end;

    QUESTION: How can I do something similar in the APEX; have a blocking of multi-record with several elements not related, filled by calling a procedure with several out parameters?

    The suggestion refers to functions in pipeline
    http://www.Oracle-Developer.NET/display.php?ID=207

    This will allow you to select your information you need in a query like

    SELECT * FROM TABLE(table_function)
    

    It should also more powerful than the example of forms.

    Scott

  • The assignment of value to the block multi-record in Oracle's 10 g

    Hi all

    I'm new to form of Oracle 10 g.

    I have a block of several recording that does not rely on the database. I need to assign the value to this block multi-record dynamically the ref cursor.

    I'm trying to set the value as below, but its does not work. Please help me on this.

    loop
         fetch cur Into screenval_rec ;
          exit when cur%notfound ;
          first_record;
       
      :BLOCK1.COL1:= screenval_rec.value1;
        :BLOCK1.COL2 := screenval_rec.value2;
        :BLOCK1.COL3:= screenval_rec.valu3;
      
         next_record;
    End loop;
    
    

    Kind regards

    REDA

    Hi Craig,.

    Thank you for your information.

    But I found the exact cause of this "Invalid cursor error' (ORA-01001) in Oracle forms. It is because of the unique enclosed in quotes the select statement of the REF cursor. I found in the paragraphs below Oracle.

    Note 170881.1 - ORA-1001 calling a stored procedure that contains a REF Cursor Oracle Forms

    Once I deleted the quotes, it's working properly now.

    Thanks again for your help.

    Kind regards

    REDA

  • How to check the previous value of the element in a multi-record block

    Oracle Version: 10 g
    Forms Version: 10 g

    Hi all
    Hello everyone, I have a multi-dossier block in a form where one of the values of elements is of LOV.user can select the value of LOV.

    If once the user selects the value of LOV and moves to the next of the multi-file record, and selects the value of LOV again, I shouldn't allow users to select the previous value of the user in order to avoid duplication of records.

    and important remark is that I should get there before you save it in the database because once registered in the database I can compare the values and hide the previous value.


    Any help will be appreciated.


    Thanks and greetings

    This is a question frequently asked in the forum! There are several different solutions. Take a look at the following articles. Both will perform the necessary verification of duplicates.
    Forms - registration of treatment group (value in double check...
    or
    Avoid records duplicated in a block

    If none of these solutions don't work for you, search the forum for other options.

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

  • How to check the values in multi-record block. ?

    Hello

    I'm new to forms. I have the field titled "Comments" in the block of multi-record. I have a button called "reject". Reject button is in the control block. If I press the button reject, field comments must be entered in one of the record. Otherwise, he should tell message. How to check the multi-record block. ?

    Pl.Help.

    Thanks in advance.
    Mano

    Mano,

    Add NEXT_RECORD just before the END of the LOOP.

         GO_BLOCK('');
         FIRST_RECORD;
         LOOP
              IF NVL(:., ' ' ) = ' ' THEN
                   MESSAGE('');
                   RAISE FORMS_TRIGGER_FAILURE;
              END IF;
              EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
              NEXT_RECORD;
         END LOOP;
    

    Kind regards

    Manu.

    If my response or response from another person was helpful, please mark accordingly

  • How to do the validation to the record level in multi record block.

    Hello
    I use form 10g. I have a doubt in form 10g. Look, I got multi-record block (10 records).
    In this block, I have a few items of text
    (1) S_NO
    Account_number 2)
    withdraw_amt 3)
    Deposit_amt 4)
    (5) balance_amt.

    These are the fields and sample data that I posted in forms.
    S. n ACC_No - WITHDRAW_AMT - DEPOSIT_AMT - BALANCE_AMT
    1-250 - 1000.00 - 1000.00
    2.------250-----------500.00-------------------------------------------500.00
    3-250 - 2000.00 - 2500.00


    Now, I entered the data manually in all areas...
    But what I need is if I entered the field of deposit in the amount it will add to the old balance and if I add the amount to remove the field that he removed from the old balance automatically.
    Pls tell me what are the possible ways to implement this form...


    Eliane.

    For the calculation of the fields there are some properties, you can define and then let the calculation forms. The WHEN-VALIDATE-POINT-approach will not work, because it increases your balance_amount whenever you change the value.

    But what exactly is the logic for your calculation. It's just: BALANCE_AMT =: DEPOSIT_AMT-: WITHDRAW_AMT?

    If so, create a new database item not in the block, assign Calcaulation-mode of 'Formula', a formula to something like

    NVL(:BLOCK.DEPOSIT_AMT,0)-NVL(:BLOCK.WITHDRAW_AMT)
    

    Then whenever you change DEPOSIT_AMT or WITHDRAW_AMT, the BALANCE_AMT will be calculated again.

  • navigation block multi-record question

    Hello

    I have a block multi-record with 4 fields in each record. Each field has a LOV attached to it. When I select a value from the LOV to the 1st field, the 'control' should go to the next field (ie., the slider should move to the 2nd field).

    How can I do this?

    Thank you
    Chiru

    No need for any trigger, set the automatic 'Skip' property for the LoV to 'yes '.

  • How to lock the record in the form?

    Hi all

    I want to lock the selected records in the time of the query. Let's say I want to lock the records in the Employee table. And I have a block of the base table (no view on screen) the employee and one table from another base block (display fields: Department code and the name of the Department, situation, number of employees on the screen) which is a summary of records selected in the Employee table.

    Now, I want to lock the records in the Employee table when run query so that some backend process cannot 'touch' the annals which are already displayed on the screen.

    I tried to put the ' SELECT '1' IN v_dummy FROM EMPLOYEE WHERE update_user =: B_CONTROL.c_user FOR UPDATE NOWAIT ' under the block trigger 'On-Lock' of base table. Then go to SQL * MORE to update the employee record. However, I can update the record successfully. This isn't my expected result.
    So, how can I lock the record in the form? Any suggestion? Please help and thank you all for advice.

    I use Oracle 10 g 10g 2 formula.

    Thank you.

    Kind regards.

    Looks like that record is already locked by another user. So, what do you expect the form in this case.

    BTW... Instead of locking the record "by hand", you can also use EXECUTE_QUERY (FOR_UPDATE)

  • FRM-40301 query caused no records to recover - is lost

    Hello
    I have a form with 2 tabs. the first tab is based on a block of DB and the second tab is enabled only if no records are returned by the first tab. The form works fine. But if the user enters some criteria of the query, which does not have any matching record in the comic strip, in the first tab, the form returns no error message (FRM-40301 query caused no records to retrieve). I need a way to indicate to the user that no records have been retrieved.

    the trigger for the error to the form level is-
    DECLARE
         error_value   NUMBER (5) := ERROR_CODE;
         lv_errtyp       VARCHAR2 (3) := ERROR_TYPE;
         lv_errtxt       VARCHAR2 (800) := SUBSTR (ERROR_TEXT, 0, 100);
         dbmserrcode   NUMBER := DBMS_ERROR_CODE;
         dbmserrtext   VARCHAR2 (200) := SUBSTR (DBMS_ERROR_TEXT, 0, 100);
         alt_num            NUMBER;
         alert_is        alert;
         v_err             error_tools.error_rec_type;
    BEGIN
    
         IF error_value = 40735 THEN
              alert_is := FIND_ALERT ('ME_ERROR');
              SET_ALERT_PROPERTY (alert_is, alert_message_text, ERROR_TEXT);
              alt_num := SHOW_ALERT ('ME_ERROR');
    
              IF alt_num = alert_button1 THEN
                   RAISE form_trigger_failure;
              END IF;
         ELSIF error_value IN (41039, 42100, 40401, 40405, 40102, 41009) THEN
              NULL;
         ELSIF error_value IN (40202) THEN
              alert_is := FIND_ALERT ('ME_ERROR');
              SET_ALERT_PROPERTY (alert_is,
                                              alert_message_text,
                                              :SYSTEM.current_item || ' must be entered. ');
              alt_num := SHOW_ALERT ('ME_ERROR');
         ELSIF error_value IN (40508, 40509) THEN
              alert_is := FIND_ALERT ('ME_ERROR');
    
              IF dbmserrcode <= '-20000' OR dbmserrcode >= '-20999' THEN
                   SET_ALERT_PROPERTY (alert_is,
                                                   alert_message_text,
                                                   error_tools.get_oracle_error_desc (dbmserrtext));
              ELSE
                   SET_ALERT_PROPERTY (
                        alert_is,
                        alert_message_text,
                        lv_errtyp || '-' || TO_CHAR (error_value) || ': ' || lv_errtxt
                   );
              END IF;
    
              alt_num := SHOW_ALERT ('ME_ERROR');
         ELSE
              alert_is := FIND_ALERT ('ME_ERROR');
              SET_ALERT_PROPERTY (
                   alert_is,
                   alert_message_text,
                   lv_errtyp || '-' || TO_CHAR (error_value) || ': ' || lv_errtxt
              );
              alt_num := SHOW_ALERT ('ME_ERROR');
         END IF;
    
         error_tools.clear_errors;
    END;
    I checked if I catch any exception no_data_found in the form. In the query before relaxation so that DB, I have the following code: -.
    BEGIN
    some_code..................................
    
         BEGIN
              IF :exceptional_events.screening_group_num IS NULL THEN
                   SELECT scr.screening_group_num
                     INTO scr_group_num
                     FROM screening_groups scr
                    WHERE UPPER (scr.screening_group_name) =
                                   UPPER (:exceptional_events.screening_group_name);
    
                   :exceptional_events.screening_group_num := scr_group_num;
              END IF;
         EXCEPTION
              WHEN NO_DATA_FOUND THEN
                   NULL;
         END;
    
    some_code.........................
    END;

    Hello!

    May your: system.message_level is set to something greater than "0"?

    Please try to catch the FRM-40301 in a trigger - MESSAGE like:

    begin
    if
     message_code = 40301
    then
      message ( 'Your Query returns no records. Please enter again or press STRG-Q to leave enter-query mode.' );
      message ( ' ' );
      clear_message;
    else
      message ( message_type || '-' || message_code || ': ' || message_text );
    end if;
    end;
    

    Concerning

  • How to insulate the record insertion on a block of other blocks

    Hi all

    I am facing a problem in inserting record on several blocks. Let suppose that there are three blocks A, B and C user is inserting record in the block in the user Meanwhile jumped to block B and inserting record start here and then commit those changes. Inserting record on block B is failed due to validation on block A, where user left between the two and jumped to block B and application form for incomplete registrations. However, on the block B, all elements are validated but still ask to enter data block has.

    It is possible that if the user enter the record in the current block and forms insert record in that block and validate any changes on other blocks. I tried insert_record; integrated into the insert record but did not work. An idea to get out of this situation that I would be grateful.

    Thank you.

    A form module is treated as a single unit of work or of a single transaction. Either you save all data in it or anything. If you have a logic which must be stored separately from each other, so you should design your modules accordingly, in your case, create different form-Modules for different blocks. Everything else will only cause problems and is not the way to form of work.

    Message geändert durch AndreasWeiden

  • Processing each record in table form

    Hi all

    I have a tabular presentation.
    Which queries several records at a time.
    How to treat each record in a form of Oracle one.
    Similar to a pl/sql cursor.

    Forms 6i, e-Business.

    Thanks for any help,
    Bradley

    Im having problems posting the code here so Ive posted the solution here...

    www.seeristic.com/Forum_Posts/Loop_through_all_records_in_a_block.txt

    Copy the following code loop through all records in a specific block.

    If you need move through all the records of all blocks in the form, let me know and ill show additional code for it.

    Scott

  • Fetch the multi-record acquisitions takes too long

    Hello

    I need to improve the performance of my code in multi record acquisition on the following system.

    LabVIEW 2009, Niscope 3.5.2 map 5122 digitizer on the PXI-1042 with PXI-8106 controller connected to the host PC Dell Optiplex 380 with 4 GB of RAM by crossover cable.

    I tested the speed of transfer of my connection to the chassis using the niScope memory transfer Rate.vi Maximum flow, the result was 110,74 MB/s.

    I need to use the scanner to get the waveform of different seismic sensors and it should be as fast as possible to get different transducers in a reasonable time. I used the Multi files get VI to monitor the rate at which the code executes. I want to acquire 30 signals with 10,000 record length to 100 MECH sampling rate. / s.

    Extraction of 30 records with 10 000 record length takes about 300 ms, that is far too long for my experience. I tried different numbers Records and found that the code takes 10 milliseconds per registration type. I've found that extraction vi takes most of the time. I ran my code both recording Multi search vi. Two sleeves at the rate which is not satisfactory for my application. I appreciate if someone can help me solve the problem.

    Thank you

    Ahmad

    .

    I found that on the pulse generator FRP was set at 100 Hz, which means it sends the impulse evey 1/100 sec or each 10 m I think the program was waiting to acquire the signal. I changed the FRP at 1 K Hz, it became much more quickly.

    Thank you

    Ahmad

  • Multi-record acquisition and fetch registration number

    My question relates to the fact an acquisition multi-record and go look for more than one record by extraction, but less than the total number of records.

    Let's say I am absorbing N records and go pick up j at a time where 1<>

    Hi EDD,.

    You are right that the "Fetch Record Number" property is adjustable to i * j in this case. Given that I have is starting from scratch, it works wonder. However, you need to make sure you stop the loop after the right amount of documents were recovered, which will be asked to configure the correct logic. This could be kept simple if you pick a divisor of your total of records every time, but if not, you will need to determine when you are on the last iteration, and the number of records you have left to seek before arriving at the end of your files.

    For example, if you are purchasing records total N = 100 and go for j = 10 at a time, you can simply extract I * j every time and to know when to stop, simply take (I * j) + j > = N. It works fine when j is a divisor of N integer, but otherwise, most logical should be included to determine the number of records can be left at the end, and then to seek a large number. Hope this helps,

  • Add a string when the query returns all records

    DB version: 11.2

    create table t (empname varchar2 (25), salary number, varchar2 (20) months, number of over_time);

    insert into values t ('JOHN', 2000, "NOVEMBER2014", 0);

    insert into values t ('KATE', 2000, "NOVEMBER2014", 300);

    insert into values t ('HANS', 5000, "NOVEMBER2014", 100);

    insert into values t ("KRISHNA", 2500, "NOVEMBER2014", 0);

    insert into values t ("SIEW", 3000, "NOVEMBER2014", 0);

    commit;

    SQL > select * from t;

    EMPNAME MONTHS SALARY OVER_TIME

    ------------------------- ---------- -------------------- ----------

    JOHN 2000 NOVEMBER2014 0

    KATE 2000 NOVEMBER2014 300

    HANS 5000 NOVEMBER2014 100

    KRISHNA 2500 NOVEMBER2014 0

    SIEW 3000 NOVEMBER2014 0

    SQL > select * from t where MONTH = 'NOVEMBER2014' and OVER_TIME! = 0 ;

    EMPNAME MONTHS SALARY OVER_TIME

    ------------------------- ---------- -------------------- ----------

    KATE 2000 NOVEMBER2014 300

    HANS 5000 NOVEMBER2014 100

    What I need is:

    If the query above returns at least one record, it should display the line ' Yes. We have one or more employees who worked overtime in November2014'

    before the documents are printed

    Thus, the expected production is

    Yes. We have one or more employees who worked overtime at the November2014

    EMPNAME MONTHS SALARY OVER_TIME

    ------------------------- ---------- -------------------- ----------

    KATE 2000 NOVEMBER2014 300

    HANS 5000 NOVEMBER2014 100

    If the query returns no records then usual 'no rows selected' isn't enough

    Lothar G.f. says:

    In fact, sql * more is no good tool for use considered.

    Really?  It may be a good reporting tool if you learn to use it as such...

    for example

    SQL > ttitle left 'Yes. We have one or more employees who worked overtime in November2014.
    SQL > select * from emp where empno = 1234;

    no selected line

    SQL > select * from emp where empno = 7788;

    Yes. We have one or more employees who worked overtime at the November2014
    EMPNO, ENAME, JOB HIREDATE DEPTNO COMM SAL MGR
    ---------- ---------- --------- ---------- -------------------- ---------- ---------- ----------
    7788, SCOTT, ANALYST, 7566 19 APRIL 1987 00:00:00 3000 20

    This is just a basic example.  It is possible to get SQL * more to ask for the required criteria and that the title could adjust according to this criterion, as well as the query building on it also.

    However, the OP did not specify SQL * as the reporting tool, so there is little interest providing a complete solution which, until they specify what user interface that they are actually using.

  • Multi record XML

    Hey Odie,

    I have a requirement in XML, where I'll be getting a XML file with record multi. The sample XML file is like this. I need to confirm whether or not the multi record is acceptable.
      <?xml version="1.0" encoding="UTF-8" ?> 
    - <XMLTEST>
    - <HEADERS>
      <a>RPO</a> 
      <b>000</b> 
      </HEADERS>
    - <HEADERS>
      <a>ABC</a> 
      <b>456</b> 
      </HEADERS>
    - <HEADERS>
      <a>DEF</a> 
      <b>789</b> 
      </HEADERS>
    - <HEADERS>
      <a>GHI</a> 
      <b>VALE</b> 
      </HEADERS>
    - <HEADERS>
      <a>ACCEPTED</a> 
      <b>MULTIRECRDS</b> 
      </HEADERS>
      </XMLTEST>
    There is no record of the child. It's just registration tabular information.

    For the above data, I wrote below mentioned examples of code
    DECLARE
      lv_supp_file     XMLTYPE;
      l_file_name      VARCHAR2(300);
      l_folder_name    VARCHAR2(300);
      lv_sysdate       DATE := sysdate;
      lv_err_msg       VARCHAR2(2000);
    BEGIN
    
      
      lv_supp_file  := xmltype( bfilename('XMLDIR','XMLTEST.XML'), nls_charset_id('AL32UTF8'));
       -- dbms_output.put_line('P_XML_FILE '||lv_supp_file);
    
      INSERT INTO xml_test
      (A,
      B)
       SELECT A,
       B
         FROM XMLTable('/XMLTEST'
              passing lv_supp_file
              columns
              A                      VARCHAR2(100)    path    'HEADERS/A',
              B                VARCHAR2(100)    path    'HEADERS/B'
              ) ;
    DBMS_OUTPUT.PUT_LINE('RECORDS INSERTED ');          
    COMMIT;
    EXCEPTION
        WHEN OTHERS THEN
        DBMS_OUTPUT.PUT_LINE('Error Occurred :='||SQLERRM);
        lv_err_msg   := SQLERRM;        
    END;
    /
    I'm not able to find all the records in the staging table. XML directory is already existing in the system, no problems with all other external things. Please confirm where exactly the sequence is missing.


    Kind regards
    Mr. Nagendra

    Published by: 838961 on December 5, 2011 01:20

    OK, did you change the paths accordingly too?

    SELECT a, b
    FROM XMLTable('/TESTXML/HEADERS'
          passing lv_supp_file
          columns
            a   VARCHAR2(100) path  'A'
          , b   VARCHAR2(100) path  'B'
          )
    ;
    

Maybe you are looking for