Bad bind variable & best practice for delete

I am working with three tables and very new to SQL. I need to create a procedure that will accept an ID and go through two sub tables and delete child records. Item is the main table. I am passing in the ID into the procedure and I want to use it as below. I keep getting a bad bind variable error message. I have verified that the table is setup as a number and my procedure accepts a number. I also want someone to review this from best practice as I am new to procedures.
PROCEDURE DeleteItem (p_ItemID IN NUMBER, p_RowsAffected OUT number)
IS
p_RowsAffected NUMBER;
-- select the itemdetail for the analysis
CURSOR c_itemdetail
IS
SELECT
itemdetailid
FROM itemDETAIL
WHERE itemid = :p_ItemID;
BEGIN
-- loop through each itemdetail and delete the itemdetailoutlay
FOR r_itemdetail IN c_itemdetail
LOOP
BEGIN
DELETE FROM ITEMDETAILOUTLAY
WHERE itemdetailid = r_itemdetail.itemdetailid;
COMMIT;
END;
END LOOP;
-- delete the itemdetail
BEGIN
DELETE FROM ITEMDETAIL
WHERE itemid = :p_ItemID;
COMMIT;
END;
-- delete the main item
BEGIN
DELETE FROM ITEM
WHERE itemdid = :p_ItemID;
COMMIT;
p_RowsAffected := SQL%ROWCOUNT;
END;
END DeleteItem;

Hi,
Welcome to the forum!
As you may notice, this site normally compresses white-space. Whenever you post code, or any formatted text, on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
I don't think you mean to use bind variables anywhere, so don't use colons before any variable names.  You were doing this correctly with p_RowsAffected; do the same thing with p_ItemID.
Try this:PROCEDURE DeleteItem (p_ItemID IN NUMBER, p_RowsAffected OUT number)
IS
-- p_RowsAffected NUMBER;     -- Don't name local variables the same as arguments
-- select the itemdetail for the analysis
CURSOR c_itemdetail
IS
SELECT
itemdetailid
FROM itemDETAIL
WHERE itemid = p_ItemID;     -- No : before p_ItemID
BEGIN
-- loop through each itemdetail and delete the itemdetailoutlay
FOR r_itemdetail IN c_itemdetail
LOOP
BEGIN
DELETE FROM ITEMDETAILOUTLAY
WHERE itemdetailid = r_itemdetail.itemdetailid;
COMMIT;
END;
END LOOP;
-- delete the itemdetail
BEGIN
DELETE FROM ITEMDETAIL
WHERE itemid = p_ItemID;     -- No : before p_ItemID
COMMIT;
END;
-- delete the main item
BEGIN
DELETE FROM ITEM
WHERE itemdid = p_ItemID;     -- No : before p_ItemID
COMMIT;
p_RowsAffected := SQL%ROWCOUNT;
END;
END DeleteItem;
The most important "best practice" with PL/SQL is to avoid doing it whenever possible. 
If SQL offers a way o do the same thing, it's usally best not to code anything in PL/SQL.
Have you considered foreign key constraints, with "ON DELETE CASCADE"?  That way, you could simply "DELETE FROM item", and all the dependent rows in the other tables would automatically be deleted.   You wouldn't need to remember to call a procedure like this; in fact, you would have no need for a procedure like this.
Given that you do have such a procedure:
You're doing row-by-row processing, which some mad wags like to call "slow-by-slow" processing.
For example, iYou're xplicitly finding each ItemDetailID separately, and deleting each one separately, like this:... CURSOR c_itemdetail
IS
SELECT
itemdetailid
FROM itemDETAIL
WHERE itemid = p_ItemID;
-- loop through each itemdetail and delete the itemdetailoutlay
FOR r_itemdetail IN c_itemdetail
LOOP
BEGIN
DELETE FROM ITEMDETAILOUTLAY
WHERE itemdetailid = r_itemdetail.itemdetailid;
COMMIT;
END;
END LOOP;
It's more efficient for the system (and less coding for you) if you let SQL handle as much as possible, so do this instead...     DELETE FROM ItemDetailOutlay
     WHERE ItemDetailID IN
          ( SELECT itemdetailid
          FROM     itemDETAIL
          WHERE     itemid     = p_ItemID
Do you really want to COMMIT 3 times?  0 or 1 times might be better.
What happens if there is some kind of error, say, after you've delete rows form ItemDetailOutlay and ItemDetail, but before you've delete from Item?  Wouldn't you want the entire transaction to fail, and leave all three tables in a consistent state?  If so, either have the calling procedure COMMIT, or have a single COMMIT at the end of DelteItem.
Edited by: Frank Kulash on May 6, 2010 2:25 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Is there a best practice for deleting a published report?

    Post Author: matthewh
    CA Forum: General
    Is there a best practice for deleting a published report from C:\Program Files\Business Objects\BusinessObjects Enterprise 11.5\FileStore on Crystal Reports Server or can I just delete the subfolders?  Does it reference them elsewhere?  I have a load of old reports I need to shed, but can't see how to do it.

    Hi,
    You can refer the SRND guide. As per document (page -292)
    you can configured -You can add a maximum of 50 agents per team.
    http://www.cisco.com/en/US/docs/voice_ip_comm/cust_contact/contact_center/ipcc_enterprise/ippcenterprise9_0_1/design/guide/UCCE_BK_S06086EC_00_srnd-9-0-1.pdf
    Also you can check the Bill of Material document of UCCE , under the section "Operating Conditions, Unified ICM, Unified CC" What are the number should configure in UCCE.

  • Best Practice for Deleted AD Users

    In our environment, we are not using AD groups. Users are being added individually. We are running User Profile Service but I am aware that when a user is deleted in AD, they stay in the content database in the UserInfo table so that some metadata can be
    retained (created by/modified by/etc).
    What are best practices for whether or not to get rid of them from the content database(s)?
    What do some of you consultants/admins out there do about this? It was brought up as a concern to me that they are still being seen in some list permissions/people picker, etc.
    Thank you!

    Personally I would keep them to maintain metadata consistency (Created By etc as you say). I've not had it raised as a concern anywhere I've worked.
    However, there are heaps of resources online to delete such users (even in bulk via Powershell). As such, I am unaware of cases of deleting them causing major problems.
    w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | YouTube: http://www.youtube.com/user/JamieMcAllisterMVP

  • Best practice for deleting multiple rows from a table , using creator

    Hi
    Thank you for reading my post.
    what is best practive for deleting multiple rows from a table using rowSet ?
    for example how i can execute something like
    delete from table1 where field1= ? and field2 =?
    Thank you

    Hi,
    Please go through the AppModel application which is available at: http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
    The OnePage Table Based example shows exactly how to use deleting multiple rows from a datatable...
    Hope this helps.
    Thanks,
    RK.

  • Select One Choice attribute' LoV based on two bind variables, best practice

    Hello there,
    I am in the process of learning the ADF 11g, I have following requirement,
    A page must contain a list of school names which is needed to be fetched based on two parameters, the parameters are student information been inserted in the previous page.
    I have defined a read only view "SchoolNamesViewRO", it's query depends on two bind variables :stdDegree and stdCateg.
    added that RO View as a view accessor to the entity to which the name attribute belongs, and then add LoV for the name attribute using the ReadOnly view,
    added the name attribute as Select One Choice to page2,
    and now I need to pass the values of the bind variables of the ReadOnly view,
    the information needed to be passed as the bind variables is inserted in the previous page, I could have the data as bindings attribute values in the page2 definition
    I have implemented the next two appraoches but both resulted in an empty list :
    * added ExecuteWithParams Action to the bindings of the page and then defined an Invoke Action (set refresh condition) in the executable s, set the default values of the parameters to be the attributes values' input value,
    in the trace I code see that the binding fetches correct values as supposed , but the select list appears empty, does the this execution for the query considered to be connected to the list ?
    * added a method to the ReadOnly view Imp java class to set the bind variables, then I define it as a MethodAction in the bindings , and then create an Invoke action for it , also the select is empty,
    if the query been executed with the passed variables, then why the list is empty? is it reading data from another place than the page!
    and what is the best practice to implement that requirement?
    would the solution be : by setting the default value of the bind variables to be some kind of Expression!
    please notice that query execution had the bound variables ( I see in the trace) are set to the correct values.
    would you give some hints or redirect me to a useful link,
    Thanks in advance
    Regards,

    please give me any example using backing bean .for example
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:selectOneChoice label="Label 1" id="soc1" binding="#{Af.l1}"
    autoSubmit="true">
    <af:selectItem label="A" value="1" id="si1"/>
    <af:selectItem label="B" value="2" id="si2"/>
    </af:selectOneChoice>
    <af:selectOneChoice label="Label 2" id="soc2" disabled="#{Af.l1=='2'}"
    partialTriggers="soc1">
    <af:selectItem label="C" value="3" id="si3"/>
    <af:selectItem label="D" value="4" id="si4"/>
    </af:selectOneChoice>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    package a;
    import oracle.adf.view.rich.component.rich.input.RichSelectOneChoice;
    public class A {
    private RichSelectOneChoice l1;
    public A() {
    public void setL1(RichSelectOneChoice l1) {
    this.l1 = l1;
    public RichSelectOneChoice getL1() {
    return l1;
    is there any mistake

  • Best practice for deletion of SAP standard configuration

    Does anyone have any documentation related to deletion of standard SAP configuration?  My client is requesting deletion of all the standard delivered company codes and I believe it is best practice to never delete them.  I am looking for supporting documentation that supports this.

    Rhonda,
    I have never seen a system where the standard delivered company codes did not exist, so I can't say what the implications of deletion are.  I suppose it is possible to do....
    For documentation,  I guess you could search through service.sap.com/support. 
    I would think you would respond to the request as follows:
    Tell the client it will be extra work to delete the items.  Which will translate into additional billable fees.
    Tell the client (in writing) that you cannot predict what all possible outcomes will be, but that you are willing to work with him to fix anything that gets broken in the process.  For additional billable fees.
    In the end, the client is paying for your advice and your services.  In the end, he owns the license and the system upon which it is running.    He can have anything he wants, there is no other 'right' or 'wrong'.
    I suggest you don't delete anything in client 000.  Most companies keep this as a reference.  If the client later decides to reconstruct, this would be a nice source of info.
    Since company codes greatly affect FI/CO, you might want to post the question in one of those forums.
    Best Regards,
    DB49

  • Best practice for deleting data based on mismatch

    I have two tables which share the same key columns (one is an extension table of the other, basically)
    INVPARTINSTOCK_C is current data
    INVPARTINSTOCK_D is a date extension table
    I want to remove all data in D which is not in C
    I can gather a list of mismatched data by using:
    select
    d.Contract,
    d.Part_No,
    d.Location_No,
    d.Lot_Batch_No,
    d.Serial_No,
    d.Eng_Chg_Level
    from invpartinstock_d d
    MINUS
    select
    c.Contract,
    c.Part_No,
    c.Location_No,
    c.Lot_Batch_No,
    c.Serial_No,
    c.Eng_Chg_Level
    from invpartinstock_c c but how do I apply that to a DELETE FROM INVPARTINSTOCK_D WHERE... ?
    Thanks

    1) It depends on, at least, the data volumes we're talking about, but
    DELETE FROM dtable
      WHERE (column_list) IN (your_minus_query)should be functionally correct. Probably more efficient would be
    DELETE FROM invpartinstock_d d
    WHERE NOT EXISTS(
        SELECT 1
          FROM invpartinstock_c c
         WHERE c.contract = d.contract
        )2) Why isn't there a foreign key relationship that prevents this sort of mismatch in the first place?
    Justin

  • Best practice for deleting data

    I need to clear several years' worth of data from our environment.  In addition, we have a number of categories that need to be cleared as well.  Is there any need to actually clear the data prior to making making the dimension changes?  Or is it enough to simply remove the time periods and categories in question and process those dimensions?

    Hi Pablo,
    If your requirement is clearing only transactional  data you can clear via clear data manager package and if you want delete master data of time and category, first you need to clear all the trasactional data of that member and then delete master data. You can not delete directly master data without deleting trasactional data, if there is data associated to that member system will not allow to delete member.
    Regards,
    Shrikant

  • Best Practice for setting bind variable when application loads

    I am using JDeveloper 11.1.2.3.
    When my application loads, the first unbounded page has a table populated by a named query.
    I would like to set the parameter used by the named query when the page loads, to populate the initial data that is displayed.
    What is the best practice for a solution to this issue?

    user6003393 wrote:
    I am using JDeveloper 11.1.2.3.
    When my application loads, the first unbounded page has a table populated by a named query.
    I would like to set the parameter used by the named query when the page loads, to populate the initial data that is displayed.
    What is the best practice for a solution to this issue?Hi,
    You can set the bind variable on VO by overriding prepareSession() method in Application Module check this http://docs.oracle.com/cd/E37975_01/web.111240/e16182/bcservices.htm#sthref357
    Setting bind variable on runtime http://docs.oracle.com/cd/E37975_01/web.111240/e16182/bcquerying.htm#CHDECJHD
    Zeeshan

  • Best practice for upgrading task definition without deleting task instances

    best practice for upgrading task definition in production system without deleting or terminating task instances
    If I try and update a task definition with task instances running I get the following error:
    Task definition 'My Task - Add User' may not be modified while there are active task instances
    Is there a best practice to handle this. I tried to force an update through the console but that didn't work. I tried editing the task from the debug page and got the same error.

    1) Rename the original task definition.
    2) Upload the new task definition with the original name.
    3) Later, after all the running tasks have timed out, delete the old definition.
    E.g., if your task definition is "myWorkflow":
    1) Rename "myWorkflow" to "myWorkflow-old-2009-07-28"
    2) Upload the new task definition as "myWorkflow".
    Existing tasks will stay linked to the original (renamed) workflow definition.
    New tasks will use the new definition.
    As the previous poster notes, depending on the changes you are making, letting the old task definitions stay active could have bad side-effects and might be better avoided.

  • ERROR: Package deleted because of bad bind-variable

    hello,
    i believe to have a serious problem here and i need help. portal deleted packages twice because of a "bad bind variable" so i had to start over again.
    i'm trying to write a simple blackboard-application. Users can post and read posts. No answers, no threads
    This is the structure:
    Tables: categories with cat_id,cat_name
    posts with post_id,cat_id, date,user_id,title,content
    Reports for list of categories and list of posts in a certain category
    Link from category-name to list of posts in category
    This link uses :cat_id as passed parameter from category-list to list of posts
    The list of posts has this select-statement:
    SELECT post_id,cat_id,date,user_id,title
    FROM schemaname.posts
    WHERE cat_id = :cat_id;
    So far everything works fine
    Now i want to customize the look of the report. On the "Report and Customization Form Text"-Tab I wrote some html-code into the header-field. Then i tried to include a select statement to print the category-name. But everything i wrote between the <oracle></oracle>-tags was displayed as code and not parsed. So i next tried to put a select-statement into the "after header displayed"-field on the "additional PL/SQL Code"-Tab.
    This is what i wrote:
    declare
    cat varchar2(20);
    begin
    SELECT cat_name into cat
    FROM schemaname.categories
    WHERE cat_id = :cat_id;
    end;
    When i now run the report i get a 4-page error-message saying package was deleted and that i used a bad bind-variable.
    Can somebody please help?
    we use portal 30982 on 9i database and windows 2000
    Thank you very much
    Ralf Schmitt

    Hi,
    You cannot use bind variable in the additional plsql section. If you want to access the value of :cat_id then you should
    pick it up from p_arg_names and p_arg_values.
    In the additional plsql code "after header displayed"-
    declare
    cat_nm varchar2(50);
    begin
    for i in 1..p_arg_names.count
    loop
    if p_arg_names(i) = 'cat_id' then
    SELECT cat_name into cat
    FROM schemaname.categories
    WHERE cat_id = p_arg_values(i);
    exit;
    end if;
    end loop;
    htp.p('Cateegory :' ||cat_nm);
    end;
    Thanks,
    Sharmila

  • Best practice for how to access a set of wsdl and xsd files

    I've recently beeing poking around with the Oracle ESB, which requires a bunch of wsdl and xsd files from HOME/bpel/system/xmllib. What is the best practice for including these files in a BPEL project? It seems like a bad idea to copy all these files into every project that uses the ESB, especially if there are quite a few consumers of the bus. Is there a way I can reference this directory from the project so that the files can just stay in a common place for all the projects that use them?
    Bret

    Hi,
    I created a project (JDeveloper) with local xsd-files and tried to delete and recreate them in the structure pane with references to a version on the application server. After reopening the project I deployed it successfully to the bpel server. The process is working fine, but in the structure pane there is no information about any of the xsds anymore and the payload in the variables there is an exception (problem building schema).
    How does bpel know where to look for the xsd-files and how does the mapping still work?
    This cannot be the way to do it correctly. Do I have a chance to rework an existing project or do I have to rebuild it from scratch in order to have all the references right?
    Thanks for any clue.
    Bette

  • Best practices for setting up projects

    We recently adopted using Captivate for our WBT modules.
    As a former Flash and Director user, I can say it’s
    fast and does some great things. Doesn’t play so nice with
    others on different occasions, but I’m learning. This forum
    has been a great source for search and read on specific topics.
    I’m trying to understand best practices for using this
    product. We’ve had some problems with file size and
    incorporating audio and video into our projects. Fortunately, the
    forum has helped a lot with that. What I haven’t found a lot
    of information on is good or better ways to set up individual
    files, use multiple files and publish projects. We’ve decided
    to go the route of putting standalones on our Intranet. My gut says
    yuck, but for our situation I have yet to find a better way.
    My question for discussion, then is: what are some best
    practices for setting up individual files, using multiple files and
    publishing projects? Any references or input on this would be
    appreciated.

    Hi,
    Here are some of my suggestions:
    1) Set up a style guide for all your standard slides. Eg.
    Title slide, Index slide, chapter slide, end slide, screen capture,
    non-screen capture, quizzes etc. This makes life a lot easier.
    2) Create your own buttons and captions. The standard ones
    are pretty ordinary, and it's hard to get a slick looking style
    happening with the standard captions. They are pretty easy to
    create (search for add print button to learn how to create
    buttons). There should instructions on how to customise captions
    somewhere on this forum. Customising means that you can also use
    words, symbols, colours unique to your organisation.
    3) Google elearning providers. Most use captivate and will
    allow you to open samples or temporarily view selected modules.
    This will give you great insight on what not to do and some good
    ideas on what works well.
    4) Timings: Using the above research, I got others to
    complete the sample modules to get a feel for timings. The results
    were clear, 10 mins good, 15 mins okay, 20 mins kind of okay, 30
    mins bad, bad, bad. It's truly better to have a learner complete
    2-3 short modules in 30 mins than one big monster. The other
    benefit is that shorter files equal smaller size.
    5) Narration: It's best to narrate each slide individually
    (particularly for screen capture slides). You are more likely to
    get it right on the first take, it's easier to edit and you don't
    have to re-record the whole thing if you need to update it in
    future. To get a slicker effect, use at least two voices: one male,
    one female and use slightly different accents.
    6) Screen capture slides: If you are recording filling out
    long window based databse pages where the compulsory fields are
    marked (eg. with a red asterisk) - you don't need to show how to
    fill out every field. It's much easier for the learner (and you) to
    show how to fill out the first few fields, then fade the screen
    capture out, fade the end of the form in with the instructions on
    what to do next. This will reduce your file size. In one of my
    forms, this meant the removal of about 18 slides!
    7) Auto captions: they are verbose (eg. 'Click on Print
    Button' instead of 'Click Print'; 'Select the Print Preview item'
    instead of 'Select Print Preview'). You have to edit them.
    8) PC training syntax: Buttons and hyperlinks should normally
    be 'click'; selections from drop down boxes or file lists are
    normally 'select': Captivate sometimes mixes them up. Instructions
    should always be written in the correct order: eg. Good: Click
    'File', Select 'Print Preview'; Bad: Select 'Print Preview' from
    the 'File Menu'. Button names, hyperlinks, selections are normally
    written in bold
    9) Instruction syntax: should always be written in an active
    voice: eg. 'Click Options to open the printer menu' instead of
    'When the Options button is clicked on, the printer menu will open'
    10) Break all modules into chapters. Frame each chapter with
    a chapter slide. It's also a good idea to show the Index page
    before each chapter slide with a progress indicator (I use an
    animated arrow to flash next to the name of the next chapter), I
    use a start button rather a 'next' button for the start of each
    chapter. You should always have a module overview with the purpose
    of the course and a summary slide which states what was covered and
    they have complete the module.
    11) Put a transparent click button somewhere on each slide.
    Set the properties of the click box to take the learner back to the
    start of the current chapter by pressing F2. This allows them to
    jump back to the start of their chapter at any time. You can also
    do a similar thing on the index pages which jumps them to another
    chapter.
    12) Recording video capture: best to do it at normal speed
    and be concious of where your mouse is. Minimise your clicks. Most
    people (until they start working with captivate) are sloppy with
    their mouse and you end up with lots of unnecessarily slides that
    you have to delete out. The speed will default to how you recorded
    it and this will reduce the amount of time you spend on changing
    timings.
    13) Captions: My rule of thumb is minimum of 4 seconds - and
    longer depending on the amount of words. Eg. Click 'Print Preview'
    is 4 seconds, a paragraph is longer. If you creating knowledge
    based modules, make the timing long (eg. 2-3 minutes) and put in a
    next button so that the learner can click when they are ready.
    Also, narration means the slides will normally be slightly longer.
    14) Be creative: Capitvate is desk bound. There are some
    learners that just don't respond no matter how interactive
    Captivate can be. Incorporate non-captivate and desk free
    activities. Eg. As part of our OHS module, there is an activity
    where the learner has to print off the floor plan, and then wander
    around the floor marking on th emap key items such as: fire exits;
    first aid kit, broom and mop cupboard, stationary cupboard, etc.
    Good luck!

  • Best practice for mouseless ADF applications

    I am developing an ADF application where the users do not want to use the mouse.
    So I would like to know if there are a best practice for this?
    I am already using the accessKey functionality and subforms defaultCommand
    But I have had problems setting focus to objects on a page like tables. I would like a button to return the focus to the table after it has made the command like delete.
    I have implemented a solution where I have found inspiration several threads and other webpages (see below).
    Is this solution okay?
    Are there any problems with it?
    I would also like to know if there are better pathways to go like
    out of the box solutions,
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/79-global-template-button-strategy-360139.pdf (are there an example implementation?), or
    http://one-size-doesnt-fit-all.blogspot.dk/2010/11/adf-ui-shell-supporting-global-hotkeys.html
    in advance thanks
    Inspiration webpages
    https://blogs.oracle.com/jdevotnharvest/entry/how_to_programmatically_set_focus
    http://technology.amis.nl/2008/01/04/adf-11g-rich-faces-focus-on-field-after-button-press-or-ppr-including-javascript-in-ppr-response-and-clientlisteners-client-side-programming-in-adf-faces-rich-client-components-part-2/
    how to Commit table by writting Java code in Managed Bean?
    Table does not refresh and getting error as UIComponent is Null
    A short description of the solution:
    (jdeveloper version 11.1.1.2.0)
    --- Example where I use onSetFocus in jsff page
    <af:commandButton text="#{hrsusuiBundle.FOCUS}" id="cb10"
    partialSubmit="true" accessKey="f"
    shortDesc="Alt+Shift+F"
    actionListener="#{managedBean_clientUtils.onSetFocus}">
    <af:clientAttribute name="focusField" value="t1"/>
    </af:commandButton>
    --- Examples where I use doTableActionAndSetFocus in jsff page
    --- There have to be a binding in the jsff page to delete, commit and rollback
    <af:commandButton text="#{hrsusuiBundle.DELETE}" id="cb4"
    accessKey="x"
    shortDesc="Alt+Shift+X"
    partialSubmit="true"
    actionListener="#{managedBean_clientUtils.doTableActionAndSetFocus}">
    <af:clientAttribute name="focusField" value="t1"/>
    <af:clientAttribute name="actionField" value="Delete"/>
    </af:commandButton>
    <af:commandButton text="#{hrsusuiBundle.COMMIT}" id="cb5"
    accessKey="s" shortDesc="Alt+Shift+S"
    partialSubmit="true"
    actionListener="#{managedBean_clientUtils.doTableActionAndSetFocus}">
    <af:clientAttribute name="focusField" value="t1"/>
    <af:clientAttribute name="actionField" value="Commit"/>
    </af:commandButton>
    <af:commandButton text="#{hrsusuiBundle.ROLLBACK}" id="cb6"
    accessKey="z" shortDesc="Alt+Shift+Z"
    partialSubmit="true"
    actionListener="#{managedBean_clientUtils.doTableActionAndSetFocus}"
    immediate="true">
    <af:resetActionListener/>
    <af:clientAttribute name="focusField" value="t1"/>
    <af:clientAttribute name="actionField" value="Rollback"/>
    </af:commandButton>
    --- This is the java class I use
    --- It is published in adfc-config.xml as a request scope managedbean
    public class ClientUtils {
    public ClientUtils() {
    public void doTableActionAndSetFocus(ActionEvent event) {
    RichCommandButton rcb = (RichCommandButton)event.getSource();
    String focusOn = (String)rcb.getAttributes().get("focusField");
    String actionToDo = (String)rcb.getAttributes().get("actionField");
    UIComponent component = null;
    String clientId = null;
    component = JSFUtils.findComponentInRoot(focusOn);
    clientId = component.getClientId(JSFUtils.getFacesContext());
    if ( "Delete".equals(actionToDo) || "Commit".equals(actionToDo) || "Rollback".equals(actionToDo) ){
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    OperationBinding operationBinding = bindings.getOperationBinding(actionToDo);
    Object result = operationBinding.execute();
    AdfFacesContext.getCurrentInstance().addPartialTarget(component);
    if (clientId != null) {           
    makeSetFocusJavaScript(clientId);
    public static String onSetFocus(ActionEvent event) {
    RichCommandButton rcb = (RichCommandButton)event.getSource();
    String focusOn = (String)rcb.getAttributes().get("focusField");
    String clientId = null;
    if (focusOn.contains(":")) {
    clientId = focusOn;
    } else {
    clientId = findComponentsClientIdInRoot(focusOn);
    if (clientId != null) {           
    makeSetFocusJavaScript(clientId);
    return null;
    private static void writeJavaScriptToClient(String script) {
    FacesContext fctx = FacesContext.getCurrentInstance();
    ExtendedRenderKitService erks = null;
    erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
    erks.addScript(fctx, script);
    public static void makeSetFocusJavaScript(String clientId) {
    if (clientId != null) {
    StringBuilder script = new StringBuilder();
    //use client id to ensure component is found if located in
    //naming container
    script.append("var textInput = ");
    script.append("AdfPage.PAGE.findComponentByAbsoluteId");
    script.append ("('"+clientId+"');");
    script.append("if(textInput != null){");
    script.append("textInput.focus();");
    script.append("}");
    writeJavaScriptToClient(script.toString());
    public static String findComponentsClientIdInRoot(String id) {
    UIComponent component = null;
    String clientId = null;
    component = JSFUtils.findComponentInRoot(id);
    clientId = component.getClientId(JSFUtils.getFacesContext());
    return clientId;
    }

    Hi,
    I am developing an ADF application where the users do not want to use the mouse. So I would like to know if there are a best practice for this?
    Well HTML (and this is the user interface you see) follows a tab index navigation that you follow with "tab" and "shift+tab". Anything else is a short cut for which you use mnemonics (as you already do) or shortcuts (explained in http://one-size-doesnt-fit-all.blogspot.dk/2010/11/adf-ui-shell-supporting-global-hotkeys.html). There is a distinction to make between non-web environments (which I think you and your users have abackground in) and client desktop environments. Browsers block some keyboard functionality for their own purpose. So you may have to find a list of keys first that work across browsers. Unlike desktop clients, which allow you to "press a button" without the button to take focus, this cannot be done on the web. So you need to be clever here, avoiding buttons at all.
    The following paper is about JavaScript in ADF and explains the basics for what Chris Muir explains in : http://one-size-doesnt-fit-all.blogspot.dk/2010/11/adf-ui-shell-supporting-global-hotkeys.html
    http://www.oracle.com/technetwork/developer-tools/jdev/1-2011-javascript-302460.pdf
    It has the outline for how to register short cut keys that perform a specific action (e.g. register ctrl+d to delete the current row you are on, or press F11 to execute a query (similar to Oracle Forms frmres files)). However, be aware that this includes some code you have to write (actually quite some code to be honest).
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/79-global-template-button-strategy-360139.pdf (are there an example implementation?), or
    http://one-size-doesnt-fit-all.blogspot.dk/2010/11/adf-ui-shell-supporting-global-hotkeys.html
    Actually these are implementations as they come with example code for you to use and customize, do they? So what is this question asking for more ? Also note that global buttons don't quite have anything in common with the question you asked. I assume you want to see it as an implementation of the Forms toolbar that operates on the form or table the focus is in. This however does not work for the web as there is nothing that keeps track of which component has a focus and to what iterator (data block) it belongs. This would involve even more coding (though possibly doable)
    Frank

  • Kernel: PANIC! -- best practice for backup and recovery when modifying system?

    I installed NVidia drivers on my OL6.6 system at home and something went bad with one of the libraries.  On reboot, the kernel would panic and I couldn't get back into the system to fix anything.  I ended up re-installing the OS to recovery my system. 
    What would be some best practices for backing up the system when making a change and then recovering if this happens again?
    Would LVM snapshots be a good option?  Can I recovery a snapshot from a rescue boot?
    EX: File system snapshots with LVM | Ars Technica -- scroll down to the section discussing LVM.
    Any pointers to documentation would be welcome as well.  I'm just not sure what to do to revert the kernel or the system when installing something goes bad like this.
    Thanks for your attention.

    There is often a common misconception: A snapshot is not a backup. A snapshot and the original it was taken from initially share the same data blocks. LVM snapshot is a general purpose solution which can be used, for example, to quickly create a snapshot prior to a system upgrade, then if you are satisfied with the result, you would delete the snapshot.
    The advantage of a snapshot is that it can be used for a live filesystem or volume while changes are written to the snapshot volume. Hence it's called "copy on write (COW), or copy on change if you want. This is necessary for system integrity to have a consistent data status of all data at a certain point in time and to allow changes happening, for example to perform a filesystem backup. A snapshot is no substitute for a disaster recovery in case you loose your storage media. A snapshot only takes seconds, and initially does not copy or backup any data, unless data changes. It is therefore important to delete the snapshot if no longer required, in order to prevent duplication of data and restore file system performance.
    LVM was never a great thing under Linux and can cause serious I/O performance bottlenecks. If snapshot or COW technology suits your purpose, I suggest you look into Btrfs, which is a modern filesystem built into the latest Oracle UEK kernel. Btrfs employs the idea of subvolumes and is much more efficient that LVM because it can operate on files or directories while LVM is doing the whole logical volume.
    Keep in mind however, you cannot use LVM or Btrfs with the boot partition, because the Grub boot loader, which loads the Linux kernel, cannot deal with LVM or BTRFS before loading the Linux kernel (catch22).
    I think the following is an interesting and fun to read introduction explaining basic concepts:
    http://events.linuxfoundation.org/sites/events/files/slides/Btrfs_1.pdf

Maybe you are looking for

  • Why does that same photo keep appearing in the edited folder????

    Why is that same photo always mysteriously appear in the edited folder whenever a photo is added to camera roll?????  If I happen to take a picture on my iPad, then if I go to iPhoto, there is this one stubborn picture that mysteriously appears in th

  • Parse files in directory newer than MM/DD/YYYY

    In the attached VI I am trying to figure out how to pull in and parse all .txt log files in Folder path newer than a particular date instead of just the *.txt (all text files) as it is set to now. The date I will be entering from a sub VI is a string

  • Is the timeline in Photoshop Elements feature still there?

    I am looking to upgrade my Elements software. I am still running 3.0 as it still worked for me. One feature I really liked about the photo organizer is the timeline view. It allow me to find photos very quickly.  I believe I saw a tutorial for 11.0 a

  • AP Aironet 1240 connection problem

    Hi there I have a problem with my AP. Basically when I plug it in to the PoE switch it will start up (I can see the lights) but for some reason there is no light on the PoE switch. Looks like there is nothing connected. I chave changed the cable, por

  • Vm 2012R2 to 2012 sp1

    I,   Need help! How to migrate a VM from Hyper-v 2012R2 to hyper-V 2012. I always have a message told to me I can perform a downgrage vm addition. What I need to do???