"execute_query" command

Is it possible to execute "execute_query" command when you are using some non data base block in your
form.
Thanks
Rajat

Rajat,
The short answer is Yes, however, it depends on how you have your data block set up. If the data block is based on a table or view, the values in the non-base table items must relate to a column in the table or view. Using the values of the non-base table items you can alter the DEFAULT_WHERE clause of the data block and then use EXECUTE_QUERY() to query the data block using these non-base table values.
Hope this helps.
Craig...
-- If my response or the response of another is helpful or answers your question please mark the response accordingly. Thanks!

Similar Messages

  • HELP - Execute_Query Bug?

    Are there any bugs in D2K which would suddenly cause an
    execute_query command to stop functioning? If so, is there a way
    around the problems?
    null

    daniel jensen (guest) wrote:
    : Are there any bugs in D2K which would suddenly cause an
    : execute_query command to stop functioning? If so, is there a
    way
    : around the problems?
    I've receiver an error
    ORA 01023 - Cursor context not found (Invalid Cursor #). Does
    anyone recognize this? What could be some possible symptoms? Any
    help would be greatly appreciated.
    null

  • Getting error 40405 , NO CHANGES TO APPLY

    SOMEHOW THE ERROR IS DISPLAYED IN MY TIGGER WHEN I DO
    EXECUTE_QUERY COMMAND. SEE MY TRIGGER BELLOW.
    CLEAR_BLOCK(DO_COMMIT);
    GO_BLOCK('CW_ENTRIES');
    EXECUTE_QUERY;
    GO_BLOCK('CW_CHANGES');
    EXECUTE_QUERY;
    GO_BLOCK('TIME_DETAIL');
    This message appeared after I have made some changes but I do
    not know when. I have version that works, but it is only fmx
    file.
    Thanks, for any info.

    I think in this case, you issued a commit without actually changing any data, so the commit was not necessary. Many Times I had to do this and did not want to see this error.
    What you can do to overcome this is to create a forms 'on error' trigger. Then trap the error like follows -
    DECLARE
    errnum NUMBER := ERROR_CODE;
    errtxt VARCHAR2(80) := ERROR_TEXT;
    errtyp VARCHAR2(3) := ERROR_TYPE;
    BEGIN
    IF errnum = 40301 THEN
    Message('Your search criteria identified no matches... Try Again.');
    ELSIF errnum = 40350 THEN /* no records found */
    null;
    ELSIF errnum = 41026 THEN /* FIELD OUTPUITING*/
    Message('This field is calculated');
    ELSif errnum=40401 then /* double commit somewhere */
    null;
    ELSif errnum=40505 then /* double commit somewhere */
    null;
    ELSif errnum=41050 then /* Record has been saved already */
    null;
    ELSIF errnum=41008 then /* Undefined Keys */
    null;
    ELSIF errnum=40100 then /* beyond first record */
    null;
    ELSIF errnum=40200 then /* field protected against update */
    null;
    ELSIF errnum=40352 then /* beyond last record */
    endif;

  • Display value in detail portion different than in table

    I'm saving a 1 character value in a table via a form. I'd like to display a longer description of that item in another item when the master item is selected and the execute_query commands runs for the detailed portion of the form. Is there anyway to set a value to an item before the execute_query command is run?
    Thanks,
    Todd

    The standard method of displaying a description associated with a value is to write code in the post-query trigger in the block. The code would set the description field based on values from the primary code value. The description display field should have its Database Item property set to No.

  • Form is not displaying data

    I am new to forms.
    I developed a form which has two blocks.
    block1 uses the header table and retrieves the header information.
    block2 uses the detail table and retieves the detail information. I joined both of the block using relations. (Batch_Id is common to both the tables)
    I put below condition in WHEN-NEW-FORM-INSTANCE (in form level i.e module)
    go_block('block1);     
    execute_query;
    go_block('block2');
    execute_query;
    I dont know what I missed..My form is not displaying any data(data exist in the tables). I really appreciate your help in this regard.
    Thanks in Advance!!

    Hi,
    Since you :
    1) set the master block to query mode as soon as the form opens
    2) set the relation correctly,
    you need not the two go_block... and execute_query commands , just the first one for the master block.
    As regards the issue that there are no records fetched/displayed in the master block ,
    1) is there any error message...????
    2) is there any where clause set at master' s block...(where clause property)???
    Have you tried to insert a record on master block and two/three on detail and queried them afterwards using your form....????
    Greetings,
    Sim

  • Exiting form after being in query mode

    Hi guys,
    Having an issue with some forms after migrating from forms version 6i to 10g. Learning as I go along.
    Forms which startup in query-mode seem to have an issue when closing - all have two blocks - one block is utilised through user query and the other (like a child) displays the query results and can be updated from here. If the user does not enter a query they can cancel it using exit_form which works fine.
    After a query has been completed the system mode returns to 'normal' mode (which I can see through debugging by entering messages/pauses throughout the code). However when exiting the application breaks with error FRM-92100. I have had this problem before with regards to exiting forms but I got round this by having an open window (acting as a parent or root window) in the background which is not closable. Been tweaking the form all afternoon including using exit_form(no_validate) and other changes. By commenting out enter_query and execute_query commands the form closes as normal without issue which means it is related to query mode or something along these lines.
    If anyone has any ideas or pointers on how to move forward with this it would be much appreciated.
    Cheers,
    Robin

    Guys,
    Thanks for the replies.
    The form currently uses exit_form twice in order to close the query mode and I receive a message "query cancelled" to confirm this.
    I have also tried - and retried for the benefit of confirming this - the code you have mentioned u3 - using it in the when-window-closed trigger. I chose <option> to be no_validate.
    The main app is opened from a webpage. Forms are opened from a menu which is attached to all forms. The code that opens the forms is open_form (i.e. not call_form or new_form) for modal reasons.
    The application is disconnected straight after exit_form is used - its as if coming out of query-mode to normal causes this as I said before closes gracefully when I remove the enter_query command.
    As for the error message itself here is a fuller picture:
    FRM-92100: Your connection to the server was interrupted. This may be the result of a network error, or a failure on the Server. You will need to reestablish your session.
    Details...
    java.lang.NullPointerException
    at oracle.forms.handler.TextComponentItem.selectionChanged(Unknown Source)
    at oracle.ewt.lwAWT.lwText.LWTextComponent._fireSelectionChanged(Unknown Source)
    at oracle.ewt.lwAWT.lwText.LWTextComponent.select(Unknown Source)
    at oracle.ewt.lwAWT.lwText.LWTextField._selectAll(Unknown Source)
    at oracle.ewt.lwAWT.lwText.LWTextField.processFocusEvent(Unknown Source)
    ...AND SO ON!
    Hope this gives a better picture of what's going on :)
    Robin
    update - There is a 'dirty' workaround to this problem - if i minimize the window (change its state in any way) after the mode is back from query-mode to normal THEN close the window it closes gracefully.
    Edited by: Robin84 on Sep 10, 2008 10:03 AM

  • To Rollback or not to Rollback

    I have a form with two blocks: block_I and block_II. Block_I is built around table_I and block_II is built around table_II. The two blocks are linked together via a master/detail relation. I have an post_change and a Key_Next_Item trigger of an item (Item_I) in block_I that do the following:
    Post_Change: does an update on table_II based upon the change in its value (the value of Item_I)
    Key_Next_Item: performs a go_block('block_II') and an execute_query command.
    When I change the value of Item_I and move out of it the values of table_II are changed accordingly in block_II.
    When I do the following steps:
    1. Enter query (in block_I)
    2. Execute query in block_I
    3.change the value in Item_I and move out of the item.
    4. Enter query again (upon which I am asked if I want to save the changes, I respond with NO)
    5. execute query again in block_I using the same data in step 1, I get the following results:
    item1 has the value it had before the change in step 3 while the block_II still retains the updated values (due to the update statement in the Post_Change trigger)
    After I close the form and reopen it and run a query on the same data, I find that BOTH item_I and block_II have their original values.
    This kind of behavior is confusing to the user. Any help?

    You are issuing an update statement to the database in the post_change trigger? If so you are in effect disconnecting Forms from the database because Forms now is wrong in its internal representation of what has happened to the data. Unless you have very unique requirements for the coordination, just let Forms handle the master detail coordination. If you must meddle with it you will have to handle almost everything with your code so you need to duplicate what Forms does and add your stuff. Try to do it without actually update the database (if that is what you meant).

  • Forms builder- only displays records created in the form builder?

    Hi there. I am new to Oracle and forms builder. I just have a query. I have created a form and when I run the form, it doesnt display the data out of my database. I can add a new record using the form and it will add it to my database:
    >
    STUDENTI FIRSTNAME LASTNAME GENDER DOB
    ADDRESS SUBURB PHONE
    20737785 Lock McIntyre Male 28-DEC-88
    384 Waterfall Gully Rosebud 0359811618
    20784939 Tim Carley F 20-FEB-89
    20 Armstrong Rd McCrae 0359811310
    20837785 LAchlan McIntyre M 28-DEC-09
    Hello Hell 5981131803
    >
    But it will only display the records that I have added using the form. Example, the first two records above were already in the database. I couldnt view them ith the form, but then I added the bottom record and I could only view that record in the form, but not the others.
    Any ideas why? I think I just dont know how to use the forms builder properly. Many thanks

    Forms starts with an empty screen(no records), only when you execute a query, the records are retrieved from the database.
    This can be done by executing the "execute_query" command.
    This can be done by pushing the button in the toolbaar, choosing the menu item, hitting the function key.
    But it can also be done programmatically in forms code(in a trigger).
    I hope this helps...

  • Populating block items

    I want to populate my block with records that have status = '4'. If a cardno with another status is entered, I want to show a message that it is not a valid card. When I enter a card no with status that is not 4, nothing happens in my form. No Message shows. What am I doing wrong here? Thank you.
    Below is my code:
    PROCEDURE GET_REC1 IS
    CURSOR cn IS SELECT * FROM memb.member
    WHERE card_no = :ret_view.card_in;
    BEGIN
    FOR rec IN cn
    LOOP
    IF :ret_view.status <> '4'
    THEN
    alert_for_val('stop_alert', 'Card Number '|| :ret_view.card_in||
    ' Is Invalid. Please Enter valid Card Number');
    --raise form_trigger_failure;
    clear_form(no_validate);
    ELSIF :ret_view.status = '4'
    THEN
    :ret_view.lodge := rec.lodge;
    :ret_view.status := rec.status;
    :ret_view.status_date := rec.status_date;
    :ret_view.first_name := rec.first_name;
    :ret_view.middle_init := rec.middle_init;
    :ret_view.last_name := rec.last_name;
    EXIT WHEN CN%NOTFOUND;
    END IF;
    END LOOP;
    END;

    Normally, you do not use a select statement to populate a block. Doing it your way will set all the rows in the block to Status=INSERT. So when you commit, your form will attempt to insert new rows in the base-table for every row you have populated.
    The correct way to populate a block is to use the Execute_Query command, or do it using the Enter Query and Execute Query function keys or menu items. You do NOT write a select statement to populate a base-table block -- Forms does it for you automatically.
    Using your For loop, every time it encounters a bad record, it should pop up an alert.
    I suspect there is a problem in your Alert_For_Val procedure.

  • What's missing? Active OCX

    I'm working with forms6 and i try to integrate an active ocx control(for charts)
    first i created a non-table block and created the ocx object it worked ok, then
    I created a database block and the ocx on the same block, the form has a WHEN-NEW-FORM-INSTANCE trigger with the EXECUTE_QUERY command, but it send the error:
    FRM 41344:OLE Object no defined for <ocx_object_name> in the current record
    Any sugerstion, please help me!!!!
    thanks...

    Hallo Rocio,
    define a controller usage relation to the component controller within the Properties Tab. Afterwards, your IPrivate-API of the component interface view controller should expose this access method to invoke the IPublic-API of the component controller.
    Best regards, Bertram

  • Could not reserve record problem

    Hi, I've got the following situation:
    I fill a block and it has a post-block trigger. So after the block is filled with data the post-block trigger fires.
    that trigger does the following: It checks whether a certain field is null or not. if the field is not null then it refills the block with different data. (It writes the data over the previous data since you cannot do a clear_block in the trigger)
    now, that all goes fine.
    But when I want to update that block it gives me the error: could not reserve record..
    this is my update code:
    PROCEDURE BUT_UPDATE_BILL_ADDRESS IS
         address1     varchar2(150);
         house_number     varchar2(150);
         bus_number      varchar2(150);
         postal_code_id      varchar2(150);
         city          varchar2(150);
         country          varchar2(150);
         al_account_id     varchar2(150);
         al_acct_location_id varchar2(150);
         account_id varchar2(150);
         acct_location_id varchar2(150);
         notes          varchar2(150);
         extern_billing_address     varchar2(150);
    BEGIN
    --save the data in temp variables.
         address1 := :account_location.address1;
         house_number := :account_location.house_number;
         bus_number := :account_location.bus_number;
         postal_code_id := :account_location.postal_code_id;
         city := :account_location.city;
         country := :account_location.country;
         al_account_id     := :account_location.al_account_id;
         al_acct_location_id     := :account_location.al_acct_location_id;
         account_id := :account_location.account_id;
         acct_location_id := :account_location.acct_location_id;
         notes := :account_location.notes;
         extern_billing_address := :account_location.extern_billing_address;
         --clear the account_location block
    -- if you don't do this you'll have touble with the update since the commit thinks its an update for the record that was inserted first (remember the post-block trigger)
         go_block('account_location');
         clear_block(no_validate);
         --fill the text items again
         :account_location.address1 := address1;
         :account_location.house_number := house_number;
         :account_location.bus_number := bus_number;
         :account_location.postal_code_id := postal_code_id;
         :account_location.city := city;
         :account_location.country := country;
         :account_location.al_account_id := al_account_id;
         :account_location.al_acct_location_id := al_acct_location_id;
         :account_location.account_id := account_id;
         :account_location.acct_location_id := acct_location_id;
         :account_location.notes := notes;
         :account_location.extern_billing_address := extern_billing_address;
    -- set status to changed (this isnt directly possible, you have to put the status tot query first)
    set_record_property(1, 'account_location', status, query_status);
    set_record_property(1, 'account_location', status, changed_status);
    commit;
    --refresh
    go_block('account_contact_main');     
    execute_query;
    what is causing the could not reserve record....? What action keeps the record busy? (I'm just a student)
    thanks in advance

    Without seeing more of your form, it is hard to say what is causing the message you are getting, or for that matter, which line of code is causing it.
    But I can say this: If this ACCOUNT_LOCATION block is a base-table block, then emptying the record and refilling the fields like you are doing will just get you into a mess.
    If you clear the block and enter values in an empty record, that record is now ready to be inserted as new row in the database. If you have a record you have queried into the block via the Execute_Query command, and you change its values, it is ready to be updated on the database.

  • Working of vo.executeQuery()

    Can someone clarify on the following:
    1.Does vo.executeQuery() always get data from database or it first searches the view cache in turn entity cahe and then the database?
    2.What happens if we add a dynamic where clause and execute query, will the proces be different if we run query by example?
    Thanks

    I have made a simple testing scenario using Jdeveloper 11g and JSF page
    I added a button the programmatically traverses an Entity based ViewObject on which the JSF page is built
    I concluded the following
    1)The executeQuery visited the database every time it is executed even if the user made no changes on the JSF, i verified that using the EXECUTIONS and ROWS_PROCESSSED fields of the V$SQLAREA view.
    2)The user Added a Row through the JSF page (CreateInsert) without committing the data, the ExecuteQuery showed this row and obviously retrieved it from its Cache.
    3)The user modified an existing Row through the JSF page without committing and the ExecuteQuery showed the modified row. Clearly the framework fetch the dirty row from its cache.
    4)I created a row directly through SQL*Plus and committed the row , and upon using the JSF ExcuteQuery , the new row appeared among the other results described above.
    5)I tried to modify the row that is updated in step (3) using SQL*Plus , the row was locked by the framework (due to default lock mode)
    ==> Simply stated, over the span of one transaction, Execute Query fetches dirty data from the Entity Cache, while at the same time, fetches non-dirty including committed data from the database
    Oracle forms developer will face some issues since the behaviour is a bit different. In oracle forms, whenever the user modified a row on the UI page and follows it by Execute_Query command, a Message asking the user if he/she wants to commit the changes first. The result of the query is then depended on the answer. If No, changes are ignored and the page is refreshed from the database.
    I am still having a little bit of confusion with Refresh() functionality. Refresh as i read has to do with associating an AM in the pool back with its binding iterator! There are method like refresh(ROW.undo-changes .... ) which indicate a database visit sometimes
    Ammar Sajdi
    Ammar

  • Sharing data between two canvases on the same form ?

    Hello,
    I have one form with two canvases and two data blocks.
    Datablock A and datablock B are same tables.
    The reason I split is so I can have a search field on canvas A, then after executing the query, I want to populate canvas B.
    I'm having trouble sharing the data across both data blocks.
    Note: I set up a relation in datablock B to correspond with A, and I've chosen field name "Horse" to be my master and detail item.
    "When-button-pressed-trigger" --> Here is part of my code after the user presses the "Search" button (in datablock A).
         execute_query;
         SHOW_VIEW('CANVAS_HORSE');
         HIDE_VIEW('CANVAS_SEARCH');
         :fox_horse.horse := :fox_horse1.horse     ;                         GO_BLOCK('FOX_HORSE');
    When I go back to my "FOX_Horse" datablock, why is the :fox_horse.horse field the only one populated? I though by creating a relation btwn the two blocks they would syncronize automatically ?
    Any advice ?
    Thanks,
    Bob

    Alex,
    I have tried your suggestion, yet I'm still having a problem once I issue my execute_query command.
    In my Search button I have this code:
    BEGIN
    :fox_horse1.horse := :fox_horse.horse;
    GO_BLOCK('FOX_HORSE1');               
    execute_query;
    END;
    Note that FOX_HORSE is NOT a database block (as you suggested), but FOX_HORSE1 is a database block.
    So when I click on the "Search" button I can see the :fox_horse1.horse field getting populated immediately, but then the system asks me if I want to save changes. When I say NO, the actual data block portion of my screen just defaults to the first record, so my exec_query show no effect at all.
    What am I doing wrong in my search button trigger ?
    Thanks so much for your advice,
    Bob

  • Setting property of individual records in a form

    Dear All,
    I have a form which executes the query at run time. I have written execute_query command on when new form instance. I would like to set property of each record based on some condition. I mean, if the status is 'D' then user should not be able to change the value of that particular record, otherwise he should change the value.
    Any help?
    Regards
    Trusha

    In your Post-Query-Trigger use
    set_item_instance_property or set_record_property
    (depends what you want to do)
    Wolfram

  • Not show record after clear_form(no_validate)

    hi master
    sir first i press add button with under blow code
    create_record
    after this i press cancel button with this code
    clear_form(no_validate);
    execute_query;
    first_record;
    but sir my system not show record when i press view button then show all record why sir i think system show all record after cancel button becuase i give execute_query command
    please sir give me idea
    thank's
    Aamir

    Dear Aamir,
    The block which contains your buttons might be a control block (i.e. a non database block) and you cannot write execute_query on such blocks.
    To achieve this,
    Move Control to your database block by writting
    Go_Block('<block_name>');
    clear_block(no_validate);
    execute_query;
    This will definitely solve your problem.
    Regards,
    Manish Trivedi

Maybe you are looking for