Run update query on page load

Hello All
This is my first post here, am hoping some of the more experienced guys/girls can help me. I just started using apex a few weeks ago for a College project.
I am having a problem that has had me stuck for hours now.
I have an interactive report on a page. What i want to do is run an update query that will pass values into another collum for each row everytime the page is opened.
This is the query:
UPDATE confectionary d
SET itemprice_test = (SELECT price_per_item
FROM confectionary c
WHERE d.confect_id = c.confect_id )
I have tried, what feels like every option for this as well as many google searches.
Does anyone have a suggestion that could solve this problem?
Thanks

not sure if i completely understand you..
just my 2 cents..
if you want to run the same update command that you posted..
go to you page..
create a ""onload before header process" --> PL/SQL with the following code.
{code}
begin
UPDATE confectionary d
SET itemprice_test = (SELECT price_per_item
FROM confectionary c
WHERE d.confect_id = c.confect_id )
end;
{code}
For creating ""onload before header process"
1)edit the page
2) create process
3)select PL/SQL
4)select ""point as"" : On load before header
sorry..if i a am wrong..

Similar Messages

  • Unanle to run update query

    Hi Experts,
    I got the solution from SAP to run update query on table E071 by using SQLPLUS prompt.
    But when I run this query I am getting message as below:
    ERROR at line 1:
    ORA-00942: table or view does not exist
    I am also unable to execute simple query like
    - select * from E071;
    - desc E071;
    For all above queries I am getting the same message as shown.
    But I am able to open view the table in SE11.
    I am also able to execute the following query in sqlplus -
    - select owner, table_name from all_tab_cols where table_name like 'E071';
    - select * from all_tables where table_name like 'E071';
    Please provide me the solution / alternative to run this update query on table E071.
    Thanks in Advance
    Best RG//
    Ramesh.

    Hi,
    if you use
    sqlplus / as sysdba
    you are SYS to the DB. You need to specify the schemauser.
    desc sapr3.E071
    desc sapsr3.E071
    desc sapsid.E071
    depending on how you schemauser is named.
    check your sidadm environment:
    env | grep -i schema
    Hope this helps
    Volker

  • Oracle ADF refresh as deferred does not execute query on page load

    In the oracle ADF page I have two panel boxes. (Oracle ADF 11.1.1.4)
    a) Personal information panel box with PanelFormLayout (PersonalInfoViewObj) - ReadOnly View Object
    b) Address information panel box with Table (AddressInfoViewObj) - Read Only View Object
    For the iterators in a) and b) I have kept refresh condition as deferred and cacheResult=false. Also in b) for af:table, I have kept contentDelivery="immediate"
    When page loads it fires SQL query for a) and populate the data in Personal information panel box. However for b) it does not execute the SQL query and the data is not getting populated ( in AddressInformation panel with the tables. Please note data is there in the DATABASE......)
    Becasue with the refresh as deferred it was not executing the sql query for Panel b) (panel with Table and table iterator). I have tried refresh as always and refresh ifNeeded/renderModel/prepareModel however in that case it is executing the SQL query two times (twice).
    Please let me know the best way to fix this issue.

    Hi,
    I think you need a method in an application module to init your data.
    In your AM : create a method like :
    public void init(){
    getViewObject().executeQuery();
    }In your adfc-config.xml create a methodCall from this method and a "control flow case" from the methodCall to your page.
    and keep refresh as "deferred " in your pageDef.
    Clément

  • Update record on page load

    I need to update a record on page load. Basically, I need to
    keep track of new content for users, so if they've viewed it, it
    changes the viewed column from 0 to 1. any suggestions?

    I guess there is no requirement for a stored procedure here,
    though, is
    there? You could just have code on the page that executes
    before the <html>
    tag to update that record, no?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Dooza" <[email protected]> wrote in message
    news:g0rgk3$nm5$[email protected]..
    > jsteinmann wrote:
    >> I need to update a record on page load. Basically, I
    need to keep track
    >> of new content for users, so if they've viewed it,
    it changes the viewed
    >> column from 0 to 1. any suggestions?
    >
    > Create a stored procedure, then call it using a
    Recordset, passing the
    > user id and content id.
    >
    > Steve

  • Table executes query on page load

    I have a popup in my page and a table in my popup...
    I use this popup for searching among records. When I render my popup, table comes with the sql suery results (invokes in popup load)...
    But I don't want the table come with the query results on load...I want table to list sql query results when I execute the search query.
    I want ; On load table as es empty,then When I execute, list query results.
    How Can I do this?
    Here is My sql query:
    SELECT KODU,ADI FROM TCARI WHERE UPPER(KODU) LIKE UPPER(:pk || '%') AND
    UPPER(ADI) LIKE UPPER(:pab || '%') AND UPPER(ADI) LIKE UPPER('%' || :pai || '%')
    Regards, islam

    Hi,
    option 1: Set the default value of the bind variable so that the query returns no result
    option 2: before launching the dialog (e.g. in a actionListener) set the underlying VO into find mode
    Frank

  • Query on Page Load

    I want to get the query result on Page Load.
    Is there any way for this?

    Hi,
    You can use the afterMethod property on the f:view tag (if you are on a JSPX page) to perform the query and access the result, or use a method call activity if you are in a bounded task flow using jSFF
    Frank
    Edited by: Frank Nimphius on Feb 21, 2011 7:12 AM

  • Problem for running Update query with Chinese

    Hi all,
    I am running a web application in Lotus Domino.
    I have a Lotus Script Agent which need to update Oracle 8i Database with Chinese Character throught ODBC but i find that all characters become some strange characters.
    I got the problem only for update query.
    I have no problem for select query for getting the chinese data.
    Also, I got no problem to run the update query with chinese characters in Sqlplus.
    I also try to run the same update query which the ODBC connection is pointing to an MS Access Database. It works too.
    So the only things i leave is the Oracle ODBC driver.
    Anythings I should do for the Oracle ODBC server?
    Thanks very much.

    Hi, I checked the registry of Oracle and
    in the NLS_LANG field, the values is AMERICAN_AMERICA.UTF8. In the server side, I set the same.
    It should be okay, as i can retrieve the chinese content in the Oracle. Just that when i try to run a query contain chinese, such as,
    "insert into TableA values ('���')". i will got some strange character inserted in the databasae.
    Could you tell me what should i do?
    Thanks a lot a lot.

  • How to run update query statement to update a table cell

    I have a job within that has dataflow which loads data to target after teh dataflow is done loading, i would like to call to run the following: in the workflow context do i need to add a script object , plus also the below query is it the proper way to run an update statement.
    sql('Target_DS','update tbl_job_status set endtime=sysdate() where endtime is null');
    Thank you very much for the helpful info
    kind regards.

    Arun,
    Is this the right way instead of doing enable recovery.
    Manaully taking care of recoverable workflow logic, by updating a table_job_status(starttime and end_time columns)?
    the only advantage of going this way rather than using recover as a unit is, if i use recover as a unit.
    then if any problem occurs in any dataflow, then all the dataflow one more time gets executed.
    instead i want only the data flow with the error occur has to run. for delta's.
    Kind regards.
    Edited by: cplusplus1 on Feb 13, 2012 4:21 PM

  • Create Simple Form Execute Query on Page Load

    Hi Everyone.
    I have a simple question.
    I created a simple form using the wizard based on a table.
    The result - 2 pages - One with a report and one linked page for maintaining data in the table (click on edit icon on page1 and page 2 loads executing a query).
    My question is this: Where on Page2 can I find the variable that Page1 populated?
    Meaning, when page2 loads, it executes a query and uses a variable that was populated on page 1.
    I checked under processes, but cannot see the query. Also checked Region and even default value for the primary key.
    This is important to me, because I might want to create a simple form that executes a query retrieving all data from the table without a where clause.
    Sorry - New to this tool and environment.
    Any suggestions would be appreciated.
    Regards
    Barend

    Barend - Check the Automated Row Fetch process on the form page. The report link will pass the primary key value into an item on that page and the process will use the value of that item to fetch the row for the form. You don't see the actual query because it's all declarative, i.e., you "declared" that you want a form populated from a table. We know the item name containing the PK value for the query and we know which items to populate on the form page.
    Scott

  • Query activated on page load

    Hi
    I have a query region with autoCustomizationCriteria on my page. I set some initial values for the query fields. How can I activate the query on page load so the users can see the results based on the default values when the first visit the page? Currently they have to click the search button.
    Thanks

    In the processRequest of your controller you can invoke a method in the AM which in turn invokes a method in the Search VO which sets the where clause and executes the query.

  • Reset .asp form on page load

    I produced an .asp fillable form in DWCS5 using ASP Form 2 Email extension. Worked very well. Problem -- ONLY with IE. When I "submit" the form, I get the "success" page. If I hit the back button on the browser, all the form info is still there. I inserted the "pragma" meta into the <head> and it resolved the problem in all browsers EXCEPT IE. Any suggestions as to how I can force the cache to clear on page load? Or, maybe a way to disable the "back" button on the browser when the success page has appeared?
    Tom

    DelMar wrote:
    > DW8 / PHP / MySQL
    > How can I submit a form when the user enters the page? I
    want to emulate the
    > user selecting the page and clicking the submit button.
    Can this be done
    > easily?
    Perhaps you're not phrasing your question correctly, but what
    you're
    suggesting is nonsense/not necessary. A form is designed for
    user input.
    If you want the form to be submitted when the page loads, the
    user has
    no opportunity to enter any input before it's submitted. If
    you don't
    want any user input, there is no need to submit a form. You
    simply write
    a PHP script that runs automatically when the page loads.
    Forms play no
    role in your scenario.
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • Using nested IIF expressions in an update query - is it possible?

    Hi everyone,
    I've been tasked by my manager to build a database which replicates a large, complicated Excel spreadsheet that consumes too much of our team's time and system resources. I've just about got most of it, but there is one particular required field that, in
    Excel, requires multi-layered nested If/Then formulae. I have to ask if building something similar in Access is possible. Here is the problem and the logic:
    Let us assume two established fields, Field 1 and Field 2; and then one field to be created via Update query, Field 3.
    Let us further assume that in Fields 1 and 2, there are three specific alphanumeric sequences occurring (“X1A”, “X1”, and “Z1”) that need to be identified and then called out as either “S1” or “U1” in field 3.
    If an Update Query were to be written to populate Field 3 with either “S1” or “U1” depending on one of the three alphanumeric sequences appearing in either Field 1 or Field 2, could it be written as the following expression, using the IIF and OR operators?
    And if so, is the syntax of the following expression correct?
    IIf([FIELD 1]="* X1A", "U1", OR IIf([FIELD 2]="* X1", "U1", OR IIf([FIELD 2]="* Z1", "U1", OR IIf([FIELD 1]="* X1", "U1", OR IIf([FIELD 1]="* Z1", "U1", "S1")))))
    Any help, critiques, or guidance would be appreciated.

    IMHO, a main consideration when "migrating" from Excel to Access is that a relational database is fundamentally different from a spreadsheet (although there can be much overlap).  In Excel, calculated values are "live" (unless you paste the values only
    into some other cells).  To replicate this "live" quality in Access, you can use a query with a calculation to display (not create or update) Field 3 in your case; Field 3 really wouldn't be a field, just a representation (query, form, report) or snapshot
    (export, print).  One reason for this is to avoid conflicts and redundancy.  In other words, if Field 3 is based solely on Fields 1 & 2 and some rule, then usually there is no need to waste disk space to store Field 3 and you don't risk Field
    3 being wrong as in the case when the rule changes.
    So here are a couple of options.
    1) Create view only query to display Field 3.  In query design view, enter the following where you would normally select a field:
    [FIELD 3]: IIf([FIELD 1]="* X1A", "U1", IIf([FIELD 2]="* X1", "U1", IIf([FIELD 2]="* Z1", "U1", IIf([FIELD 1]="* X1", "U1", IIf([FIELD 1]="* Z1", "U1", "S1")))))
    I assume you literally mean the asterisk character and are not trying to invoke a wildcard for the LIKE operator.
    There are other ways of doing this (e.g. with the LIKE operator or multiple queries and UNION), but I leave that up to you to explore.
    2) Actually update the value of FIELD 3 in a table.  Create two update queries and use your rules as conditions (i.e. the criteria in the bottom of query design).
    a) Update query 1 (run first): set [FIELD 3] = "U1" where [FIELD 1] = "* X1A" OR [FIELD 1] = "* X1" OR [FIELD 1] = "* Z1" OR [FIELD 2] = "* X1" OR [FIELD 2] = "* Z1"
    b) Update query 2 (run after): set [FIELD 3] = "S1" where [FIELD 3] is null
    Again, there are other ways of doing this such as setting the default value of [FIELD 3] in the table to "S1" and just running update query 1.
    Good luck.

  • Javascript in 'Execute when page loads', not working when paging results grid

    I have some Javascript in an Apex page, running in 'Execute when page loads'. It does some stuff to a results grid. It works fine on page load, but then doesn't run when I page through, or sort the grid. I presume this is because the grid is being sorted / paged using Ajax, which means the page isn't being fully loaded.
    Is there anywhere else I can put the code so it gets applied to the grid on sorts and paging?

    Thanks, works perfectly! I used the After Refresh and just selected the region I wanted to trigger the Javascript, and it works great. As you say the scope needs to be Dynamic.
    For anyone else reading this, something which caught me out was that my reports region was using the No Template setting, and the Dynamic Action didn't work, as it requires you to use a template which contains #REGION_STATIC_ID# - which is used by the dynamic action to identify the region. Once I switched to using a template, it worked fine.

  • Have been running version 4 for a week without problems. Today, downloaded MS live security update, and have had problems since. when I click on a favorite site, it takes 20 to 40 seconds before the page load's and the same if I click a link on the page.

    been running version 4 for a week without problems. Today, downloaded MS live security update, and have had problems since. when I click on a favorite site, it takes 20 to 40 seconds before the page load's.'''bold text'''

    http://portableapps.com/apps/internet/firefox_portable/localization#legacy36

  • Looking for hook into a mb method on page load of jsff with auto query on view criteria.

    Hello,
    I have a View Criteria that is set to Query Automatically (showing data to match today's date).  The target table has a detail table and there is a control that shows parsed XML from the current row in the detail table into a table that I build dynamically. The main table and the detail table show the proper data on page load but the table for the parsed XML is empty.  The dynamic table is bound to a managed bean where the parsing is done and data is created.  I have the control refreshing properly on a row change of the main and detail tables and on a queryListener for the view criteria.
    This is for a jsff page. I have been trying a bunch of approaches with no success.  The detail table has a ppr to the main table and the query.  I am looking some event on either the query, the main table or the detail table where I can make a call to my managed bean to parse the XML, build the table and refresh the control.  I have an attribute binding to the XML data (when I placed it in a control as plane XML it refreshed properly).  I only need this on initial page load or first time the tables are populated, I have the other use cases covered.
    Running JDev 11.1.2.4
    Thank you
    Rudy

    ok but where?
    i have read a topic about "setRefreshOption", but i need a component to execute it.
    i have read a topic about a false criteria (1=2), and when i want search, i remove it, but again, i need a component to execute it.
    i have read a topic about ${adfFacesContext.postback == true} to write into iterator proeprty, but i haven't this view into my appmodule.
    i'm really sorry, but please, can you explain me a little ?
    Edited by: bradici on 8 oct. 2009 16:36

Maybe you are looking for