Bind Variable Brain Teaser - Accessing a filtered Parent from a Child

Hi Guys and Gals,
Using JDev 11.1.2.4.0.
I have two tables, the parent(Scenarios) and the child (Orders).  They are setup as such:
SELECT Scenarios.SCENARIO_ID,
               Scenarios.NAME,
               Scenarios.COMPANY_ID
FROM SCENARIOS Scenarios
WHERE Scenarios.SCENARIO_ID = :pScenarioId
ORDER BY Scenarios.SCENARIO_ID
SELECT Orders.ORDER_ID,
               Orders.COMPANY_ID
FROM ORDERS Orders
Scenarios (The Parent) has a required bind variable which filters on the primary key, SCENARIO_ID.  The primary key for the Orders table is Order_ID.  The two tables are joined by an association & view link on COMPANY_ID, setup as a 1-to-* relationship.  However, it is in fact a *-to-* relationship since an Order row can appear in several scenarios.
In the Orders View Object, I also have a transient attribute, ScenarioInfo, which attempts to access Scenarios's current row to retrieve the name.  The getter is as such:
public BigDecimal getScenarioInfo() {
     Row row = this.getScenariosView();
     DBSequence db = ((ScenariosViewRowImpl)row).getScenarioId();
     return new BigDecimal(db.getValue());
The sequence of events:
1) Open the application module and click on the view link between Scenarios and Orders.  A window pops open asking for the bind variable (pScenarioId) value.  I enter a valid value (2) and hit enter.  This should (in theory) return only one row for the Scenarios view object, the one with the ScenarioId of 2.  Clicking only on the Scenarios view object in the application module verifies this.  The Orders view object then renders, but an error message is displayed attempting getScenarioInfo()
(oracle.jbo.AttrValException) JBO-27019: The get method for attribute "ScenarioInfo" in Orders cannot be resolved.
I'm not sure I understand why.  ScenarioId with a value of 2 is a valid number.  With the bind variable / filter in place there should be one row as the parent, turning the relationship into a 1-to-*.  Without the filter in place, I may access the parent without error, but the record that is pulled back is the first possible row due to the 1-to-* relationship.
Instead of having a bind variable, I have also tried implementing a View Criteria in the app module for the Scenarios view object.  However, the criteria doesn't seem to "stick" when the this.getScenariosView() is called from the Orders view.  It also pulls back the first row.
Does anyone have any ideas?  The only thing I can think of would be to change the relationship to a *-to-* through a translation table, but that's a complication I do not wish to add if possible.
Thanks in advance,
Will

Here is an alternate approach.  This one removes the bind variable from the Scenarios query and instead implements the following code in the app module impl.
    public void refreshScenario() {
        ViewObjectImpl allScenarios = this.getAllScenarios();
        VariableValueManager manager = allScenarios.getVariableManager();
        manager.setVariableValue("pScenarioId", new BigDecimal(2));
        ViewCriteriaManager criteriaManager = allScenarios.getViewCriteriaManager();
        ViewCriteria vc = criteriaManager.getViewCriteria("ScenariosViewCriteria");
        criteriaManager.applyViewCriteria(vc);
        allScenarios.executeQuery();
The getter is the same as my second getter example:
    public String getScenarioInfo() {
        // remove the default getter for the transient string variable ScenarioInfo
        // return (String) getAttributeInternal(SCENARIOINFO);
        // get the view link accessor for the parent row, Scenarios
        ScenariosViewRowImpl row = (ScenariosViewRowImpl)this.getScenariosView();
        // This should return 1 row, which would be the row remaining after filtering by the bind variable with a value of 2
        // Get that rows Name attribute
        String s = row.getName();
        return s;
I run the app module tester and then run the refreshScenarios() method.  I then double-click the view link which pops up a dialog box.  The bind variable pScenarioId is pre-filled with 2.  I click enter a receive the following unexpected output as seen here: http://www.williverstravels.com/JDev/Forums/Threads/11077337/ViewCriteriaAttempt.jpg
As you can see, the ScenarioInfo column returns "#1" when it should return the parent's Name, which would be "#2".  I am a little confused as to why this is functioning this way.

Similar Messages

  • Access a main function from a child MXML

    Hi im just a beginner in flex.Someone please giude me.
    I have a main MXML which holds another MXML.Is there any
    possiblity to access the main MXML component from the child MXML.If
    there is no possiblity i just want to know how to access the main
    MXML function from the child MXML script.
    thanks in advance
    karan

    Thankyou man..its working...i might require ur help in the
    coming days...
    hei do u have any experience in drawing API

  • Accessing method of parent from instanced class

    Heyo!
    I don't know if this makes sense. But I can't figure out another way to do it. Hell, I can't even figure this out. :P
    So. I've got this class:
            JPanel cp = new JPanel();
         JPanel menuScreen = new egMenuScreen();
         JPanel newGame = new egNewGameScreen();
         public EscapeGravityUI() {
              // Create toolkit and get screen size
              Toolkit toolkit = getToolkit();
              Dimension size = toolkit.getScreenSize();
              // Set size, title and close operation on main game window
              setSize(1024, 768);
              setTitle("Escape Gravity");
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              // Remove border
              setUndecorated(true);
              // Instructions for centering game window
              setLocation(size.width/2 - getWidth()/2,
                   size.height/2 - getHeight()/2);
              // Create JPanel and add to JFrame
              cp = menuScreen;
              getContentPane().add(cp);
              // Set KeyListener so we can close window in fullscreen
              this.addKeyListener(new KeyAdapter() {
                   public void keyPressed(KeyEvent e) {
                        if(e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                             System.exit(0);
                             //TODO add nice code for confirming exit
         public void changeScreen(String np) {
              getContentPane().remove(cp);
              if(np == "egngs") {
                   JPanel p = new egNewGameScreen();
              getContentPane().add(p);
              repaint();
         }This class is supposed to be a "holder" for diffrent screens in my game. Every screen represented by a JPanel.
    in egMenuScreen that looks like this:
    public class egMenuScreen extends JPanel {
         public egMenuScreen() {
              // Setup the menu screen
              setBackground(Color.white);
              setSize(1024, 768);
              setLayout(null);
              setFocusable(false);
              // Create menu buttons
              JButton newGame = new JButton("New Game");
              newGame.setBounds(getWidth()/2-60, 60, 120, 30);
              newGame.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent event) {
                        super.changeScreen("egngs");
              JButton loadSaved = new JButton("Load Saved");
              loadSaved.setBounds(getWidth()/2-60, 100, 120, 30);
              loadSaved.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent event) {
                        System.out.println("Load Saved");
              JButton options = new JButton("Options");
              options.setBounds(getWidth()/2-60, 140, 120, 30);
              options.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent event) {
                        System.out.println("Options");
              JButton quit = new JButton("Quit");
              quit.setBounds(getWidth()/2-60, 180, 120, 30);
              quit.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent event) {
                        System.out.println("Quit");
                        System.exit(0);
              // Add buttons to JPanel
              this.add(newGame);
              this.add(loadSaved);
              this.add(options);
              this.add(quit);
    }What I want to do is to change that egMenuScreen to another JPanel class that holds the other screen. I figured I needed to do that from the JFrame (EscapeGravityUI). So the method changeScreen() is supposed to handle that. However I don't know how to run that method from within that instanced JPanel class... does that even make sense?
    I'd really appriciate any help!
    Peace

    Styrisen wrote:
    I looked at CardLayout but that looks like it needs to always have the buttons visible. Huh??
    I may be wrong, Very
    but I want to change the entire screen and as I saw it that wasn't possible with card layout!You're not reading the same stuff that I'm reading.
    Here's a simple seizure-inducing program program that uses CardLayout to change a JPanel that fills the entire JFrame. Each card is simply a JPanel of random color with a label at the top and a red circle of increasing size. The cards are swapped by way of a Swing Timer:
    import java.awt.BasicStroke;
    import java.awt.CardLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.Stroke;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.geom.Ellipse2D;
    import java.util.Random;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    class CardLayoutFun4 extends JPanel
        private static final int DELAY = 100;
        private static final int CARD_COUNT = 180;
        private CardLayout cardlayout = new CardLayout();
        private Timer timer = new Timer(DELAY, new ActionListener()
            public void actionPerformed(ActionEvent e)
                cardlayout.next(CardLayoutFun4.this);
        public CardLayoutFun4()
            setLayout(cardlayout);
            setPreferredSize(new Dimension(1024, 768));
            addCards();
            timer.start();
        private void addCards()
            Random random = new Random();
            for (int i = 0; i < CARD_COUNT; i++)
                final int index = i;
                JPanel cardPanel = new JPanel()
                    private final double diameter = 600 * (index + 1) / CARD_COUNT;
                    protected void paintComponent(Graphics g)
                        super.paintComponent(g);
                        Graphics2D g2 = (Graphics2D) g;
                        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
                        Stroke oldStroke = g2.getStroke();
                        g2.setStroke(new BasicStroke(5));
                        g2.setPaint(Color.red);
                        g2.draw(new Ellipse2D.Double(20, 80, diameter, diameter));
                        g2.setStroke(oldStroke);
                cardPanel.setBackground(new Color(
                        random.nextInt(128),
                        random.nextInt(128),
                        random.nextInt(128)));
                cardPanel.add(new JLabel(String.valueOf(i)));
                add(cardPanel, String.valueOf(i));
        private static void createAndShowUI()
            JFrame frame = new JFrame("CardLayoutFun4");
            frame.getContentPane().add(new CardLayoutFun4());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    }Edited by: Encephalopathic on Jan 19, 2008 8:06 PM

  • Control of NotifyIcon in MDI Parent from MDI child (C# Express)

    I have an MDI application with a base(Parent) form (FormA) and several child forms (Form1, Form2, etc). My Parent Form (FormA) is invisible and contains a ContextMenuStrip (contextMenuStrip1) and a NotifyIcon (notifyIcon1). I have 3 Icons defined in my properties.resources
    (a yellow, green, and red check mark). I start FormA from Main() in my Program.cs with  Application.Run(new FormA()); . FormA starts and checks various things via code in FormA or in Program.cs, selects the proper icon and sets it, may or may not
    create a message balloon depending on what it finds and gives the user access to the ContextMenuStrip by right-clicking the Icon. From the ContextMenuStrip the user can select the various other forms to make certain adjustments. Whichever form is selected
    by the user is started with:
    Form1 newMDIChild = new Form1();
                // Set the Parent Form of the Child window.
                newMDIChild.MdiParent = this.MdiParent;
                // Display the new form.
                newMDIChild.Show();
    Form1 (or Form2 or Form97) starts, checks stuff via routines in Form1 (or 2 or 97) and Program.cs and allows the user to change certain things via  textboxes or run certain routines via buttons that are made visible if appropriate. This all works flawlessly
    and I'm happier than a pig in you know what BUT... what I NEED to be able to do is change the Icon in FormA (notifyIcon1.Icon) from a yellow or red check mark to a green one, once things causing a problem are corrected while still remaining in Form1 (and/or
    2 and/or 97) to allow other changes to be made. My understanding was that Form Papa = (Form)this.MdiParent; would give me the Parent (FormA) form, but no matter what I have tried, I cannot change notifyIcon1.Icon, so there is an obvious disconnect in
    my thinking.
    Please understand that I am new at C#. The last time I "mastered" a programming language was in the days of Clipper 5.3 and C (DOS) when OOL was in its' infancy, so my toes got damp but my feet never got truly wet with OOL, so please type slowly
    Please understand also that I Understand that MDI is the personification of Satan himself here on Earth, but it is what for now I am stuck with and must solve. If you know better ways of accomplishing what I have described, by all means please point me to
    them for future use. I am learning, and will continue to learn until about two weeks after they wrap me in burlap with some heavy stones and drop me off a ship at sea.
    My thanks in advance for your patience, understanding and help.
    Dan

    Hello Dan,
    >>Form1 newMDIChild = new Form1();
                // Set the Parent Form of the Child window.
                newMDIChild.MdiParent = this.MdiParent;
                // Display the new form.
                newMDIChild.Show();<<
    1. First, I will point that if you called that MDI form with that way, you will not be able to access main form's instance, since you set its mdiparent to the
    main form's parent. So I would recommend you change it to the following one.
    newMDIChild.MdiParent = this;
    If you don't want the main form is mdi container, you could add a property to mdi form and pass the instance directly to that property instead.
    2. You could add the following property to the main form class.
    public Icon MyIcon
    get { return this.notifyIcon1.Icon; }
    set { this.notifyIcon1.Icon = value; }
    And then inside the MDI form, change that property to the one you want to change the icon to, e.g change it to Icon2.
    private void button1_Click(object sender, EventArgs e)
    Form1 f1 = (Form1)this.MdiParent;
    f1.MyIcon = Properties.Resources.Icon2;
    Result:
    Regard,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • High number of execution while using bind variables

    Hi,
    The below query is going for 79000 executions when bind variables are used.
    Select COUNT ( InID) From InD   PPR BO95_PPR where  IND.PPR = PPR. PPRName AND   ( ( ( ( ( (  AGD = :1 ) AND (  AGUD is null ) ) AND (  MW is null ) ) AND ( ( (  Status = :2 ) OR (  Status = :3 ) ) ) ) AND  BD = :4 ) )
    Bind variable values are as follows
    :1 = 10
    :2 = Down
    :3 = Run
    :4 = 10
    | Id  | Operation                     | Name                 | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT              |                      |     1 |    54 |    74   (3)| 00:00:01 |
    |   1 |  SORT AGGREGATE               |                      |     1 |    54 |            |          |
    |   2 |   NESTED LOOPS                |                      | 79543 |  4194K|    74   (3)| 00:00:01 |
    |   3 |    TABLE ACCESS BY INDEX ROWID| PPR     |     1 |    15 |     1   (0)| 00:00:01 |
    |*  4 |     INDEX RANGE SCAN          | IDX_PPR_BD     |     1 |       |     1   (0)| 00:00:01 |
    |   5 |    INLIST ITERATOR            |                      |       |       |            |          |
    |*  6 |     INDEX RANGE SCAN          | IDX_InD_ASABMP | 79543 |  3029K|    73   (3)| 00:00:01 |
    ------------------------------------------------------------------------------------------------------When I replace the bind variables with hard coded values, the row returned is 29000 only.
    Why is it different?
    Thanks

    Huh?
    How are you comparing 79000 executions with 29000 rows?
    Your question:
    a). Doesn't make sense
    b). Lacks information (version of Oracle, doesn't show how you determine 79,000 executions and 29,000 rows)
    c). Lacks information about how the query is being submitted/executed - the client determines how many times it's executed, and bind variables wouldn't impact this.
    John

  • How to call a report with a bind variable from a multi-record block

    Hi,
    I have created a report using the BI Publisher functionality. I did all the integration, created the SQL Query and uploaded the template. Up till here everythings fine!
    My SQL Query has 2 bind variables.
    I will call my report from a multi record block, at the end of each record an icon is shown which the user can click to open the report.
    I created a column link for this item (PRINT_REPORT=Inschrijvingsformulier) but I do not manage to pass the parameters to my report. The parameters I want to pass are 2 columns in this Multi Record block.
    I created 2 hidden fields on the page P9_PARAMETER1, P9_PARAMETER2 with the same names as my bind variables and fill this in with the values #PARAMETER1#, #PARAMETER2# from the multi record block.
    It seems it does not work as my report stays empty. (also XML file stays empty).
    Am I trying the wrong way?
    Thanks for any advice,
    Kris

    hi khadeer,
         create one report program and write the required code,and call this function module 'SSF_FUNCTION_MODULE_NAME' and give your smartform name  and also when u activate ur smart form u will get one function module call that function module also and specify any tables used...
    i think this solves ur problem...
    any queries revert back..
    pls reward points if helpful,
    shylaja

  • Asking for bind variable where none is needed

    Good Morning,
    I am still working these regexp date_time project.
    I have a problem where oracle is asking for a bind variable where it doesn't need any as far as I can see. I am trying to capture various date times in a column and formatting them into one default format used by oracle. Here is what I got which works before I wrap it in the TO_DATE function
    There are many when then's but I am using only one here.
    select case
    when regexp_substr(date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/9[[:digit:]]{4}') is not null
    then regexp_substr(date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/9[[:digit:]]{4}')
    else date_time
    end as new_time
    from raw_data;
    The above statement works
    Now when I want to format the date that I found with this:
    select case
    when regexp_substr(date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/9[[:digit:]]{4}') is not null
    then TO_DATE('regexp_substr(date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/9[[:digit:]]{4}')','MM/DD/YYYY')
    else date_time
    end as new_time
    from raw_data;
    I get a request to insert a value for the digit as a bind variable. The digit should be populated from the when statement when it returns not null when a date is found.
    Could some one please tell me even if what I wrote here is even possible or make a suggestion to the syntax to get around this issue?
    All this is going to be incorporated into an update statement later on.
    I am running this on sql developer, oracle 11g.
    Thanks for your help in this matter in advance.
    regards,
    Al

    From looking at the code, as you have not supplied any scripts to create a table and demonstrate the error...
    Your case statement is trying to return two types
    select case
    when regexp_substr(date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/9[[:digit:]]{4}') is not null
    then TO_DATE('regexp_substr(date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/9[[:digit:]]{4}')','MM/DD/YYYY')
    else date_time
    end as new_time
    from raw_data;or simply
    select case when <expr>
                then <RETURN A DATE>
                else <RETURN A VARCHAR2>
            end as new_time
      from raw_data;The column cannot be both.
    Sorry I don't know your requirements.
    You could drop the else part and just return the converted date.
    You could fetch it back in two columns, the ones you can convert in one column (Which would be an oracle date type),
    the ones you cannot convert in another (which would be varchar2).
    Cheers,
    GP>

  • Performance when using bind variables

    I'm trying to show myself that bind variables improve performance (I believe it, I just want to see it).
    I've created a simple table of 100,000 records each row a single column of type integer. I populate it with a number between 1 and 100,000
    Now, with a JAVA program I delete 2,000 of the records by performing a loop and using the loop counter in my where predicate.
    My first JAVA program runs without using bind variables as follows:
    loop
    stmt.executeUpdate("delete from nobind_test where id = " + i);
    end loop
    My second JAVA program uses bind variables as follows:
    pstmt = conn.prepareStatement("delete from bind_test where id = ?");
    loop
    pstmt.setString(1, String.valueof(i));
    rs = pstmt.executeQuery();
    end loop;
    Monitoring of v$SQL shows that program one doesn't use bind variables, and program two does use bind variables.
    The trouble is that the program that does not use bind variables runs faster than the bind variable program.
    Can anyone tell me why this would be? Is my test too simple?
    Thanks.

    [email protected] wrote:
    I'm trying to show myself that bind variables improve performance (I believe it, I just want to see it).
    I've created a simple table of 100,000 records each row a single column of type integer. I populate it with a number between 1 and 100,000
    Now, with a JAVA program I delete 2,000 of the records by performing a loop and using the loop counter in my where predicate.
    Monitoring of v$SQL shows that program one doesn't use bind variables, and program two does use bind variables.
    The trouble is that the program that does not use bind variables runs faster than the bind variable program.
    Can anyone tell me why this would be? Is my test too simple?
    The point is that you have to find out where your test is spending most of the time.
    If you've just populated a table with 100,000 records and then start to delete randomly 2,000 of them, the database has to perform a full table scan for each of the records to be deleted.
    So probably most of the time is spent scanning the table over and over again, although most of blocks might already be in your database buffer cache.
    The difference between the hard parse and the soft parse of such a simple statement might be negligible compared to effort it takes to fulfill each delete execution.
    You might want to change the setup of your test: Add a primary key constraint to your test table and delete the rows using this primary key as predicate. Then the time it takes to locate the row to delete should be negligible compared to the hard parse / soft parse difference.
    You probably need to increase your iteration count because deleting 2,000 records this way probably takes too short and introduces measuring issues. Try to delete more rows, then you should be able to spot a significant and constant difference between the two approaches.
    In order to prevent any performance issues from a potentially degenerated index due to numerous DML activities, you could also just change your test case to query for a particular column of the row corresponding to your predicate rather than deleting it.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Bind variable and normal variable/parameter

    Hi all
    In many references it is common suggestion to use bind variable in SQL query for better performance. In oracle forms if we write query we use bind variable usually like as below:
    select emp_name
    from hr_employee
    where emp_no = :emp_no;
    But if we use backend function, we send the employee number through parameter and in backend function the query is as below
    select emp_name
    from hr_employee
    where emp_no = pEmpNo; --- IN Parameter
    Does this query get facility as bind variable??
    Thanks in advance.
    Mokarem.

    You may check Bind Variables for reference.
    String literals are usually not automatically converted to binds, unless (and only in certain circumstances)cursor_sharing is enabled.

  • Bind variable vs. variable....

    Hi ,
    In the Oracle Master Glossary ... there is the following explanation about bind variable:
    A variable in a SQL statement that must be replaced
    with a valid value, or the address of a value, in order
    for the statement to successfully execute
    According to the above .. which is the difference between bind variable and variable....????
    Tom Kyte in one , at least, of his book... points out to use the bind variables...not simple variables.
    He also proves this using the following example:
    tkyte@TKYTE816> set timing on
    tkyte@TKYTE816> declare
    2 type rc is ref cursor;
    3 l_rc rc;
    4 l_dummy all_objects.object_name%type;
    5 l_start number default dbms_utility.get_time;
    6 begin
    7 for i in 1 .. 1000
    8 loop
    9 open l_rc for
    10 ʹselect object_name
    11 from all_objects
    12 where object_id = ʹ || i;
    13 fetch l_rc into l_dummy;
    14 close l_rc;
    15 end loop;
    16 dbms_output.put_line
    17 ( round( (dbms_utility.get_time‐l_start)/100, 2 ) ||
    18 ʹ seconds...ʹ );
    19 end;
    20 /
    14.86 seconds...[[/b]pre]
    And using bind variables
    tkyte@TKYTE816> declare
    2 type rc is ref cursor;
    3 l_rc rc;
    4 l_dummy all_objects.object_name%type;
    5 l_start number default dbms_utility.get_time;
    6 begin
    7 for i in 1 .. 1000
    8 loop
    9 open l_rc for
    10 ʹselect object_name
    11 from all_objects
    12 where object_id = :xʹ
    13 using i;
    14 fetch l_rc into l_dummy;
    15 close l_rc;
    16 end loop;
    17 dbms_output.put_line
    18 ( round( (dbms_utility.get_time‐l_start)/100, 2 ) ||
    19 ʹ seconds...ʹ );
    20 end;
    21 /
    1.27 seconds...I'm confused as in my PL/SQL programs i do not use of course literal values but 'simple variables' not 'bind variables'....
    Should i replace all uses and occurences of 'simple variables' with bind variables...?????
    Thanks....a lot
    Sim

    No need for something as complex as SQL tracing. Simply look in the shared pool. E.g.
    SQL> create or replace procedure foo2 is
    2 n number := 1;
    3 c number;
    4 begin
    5 select
    6 count(*) into c
    7 from dept
    8 where deptno = n;
    9 end;
    10 /
    Procedure created.
    SQL> -- we flush the shared pool and remove cached cursors
    SQL> alter system flush shared_pool;
    System altered.
    SQL> -- is there a cursor in the shared pool using DEPT as our stored proc is using?
    SQL> select
    2 sql_text
    3 from v$sqlarea
    4 where sql_text like UPPER('%dept%')
    5 and sql_text not like '%v$sqlarea%';
    no rows selected
    SQL> -- we execute our stored proc which will cause our SQL in that stored proc to be cached
    SQL> exec Foo2
    PL/SQL procedure successfully completed.
    SQL> -- do we see our stored proc's SQL in the shared pool using a bind variable?
    SQL> select
    2 sql_text
    3 from v$sqlarea
    4 where sql_text like UPPER('%dept%')
    5 and sql_text not like '%v$sqlarea%';
    SQL_TEXT
    SELECT COUNT(*) FROM DEPT WHERE DEPTNO = :B1
    SQL>

  • Can't create multiple dependent LOVs from the same bind variable

    Hi all,
    I'm having difficulty creating multiple dependent LOVs from queries based on the same bind variable in my JSF application (JDev 10.1.3.1). Basically I have a static LOV in a af:selectOneChoice component from which users select a value which then becomes the bind variable value for two separate queries that generate two different dependent LOV. Having developed the code along the lines of Steve Muench 's blog (http://radio.weblogs.com/0118231/2006/04/03.html#a685), the first dependent LOV works really well. The first dynamic LOV gets refreshed whenever the list from the static LOV changes, and I can execute other queries based on the values selected.
    The problem arises when I want to create the second dynamic/dependent LOV that has the same bind variable based on the same selected value from the static LOV. Here I would also like the functionality whereby the second dynamic LOV is also refreshed after the selected value in the static LOV changes. Thinking that all I had to do was replicate the methodology used in creating the first dependent LOV, I created the second iterator, invokeAction and other binding components in the PageDef. The executable section now looks like the following:
    <iterator id="SelectStaticQueryViewObjIterator"
                  Binds="SelectStaticQueryViewObj" RangeSize="-1"
                  DataControl="DMSApplicationModule1DataControl"/>
    <invokeAction id="refreshDynamicQuery1BindParameter"
                  Binds="ExecuteWithParams1" Refresh="prepareModel"
                  RefreshCondition="#{empty requestScope.VariableChanged}"/>
    <iterator id="SelectDynamicQuery1ViewObjIterator"
                  Binds="SelectDynamicQuery1ViewObj" RangeSize="-1"
                  DataControl="DMSApplicationModule1DataControl"/>
    <invokeAction id="refreshDynamicQuery2BindParameter"
                  Binds="ExecuteWithParams2" Refresh="prepareModel"
                  RefreshCondition="#{empty requestScope.VariableChanged}"/>
    <iterator id="SelectDynamicQuery2ViewObjIterator"
                  Binds="SelectDynamicQuery2ViewObj" RangeSize="-1"
                  DataControl="DMSApplicationModule1DataControl"/>I now have a problem whereby everytime I change the value of the static LOV, multiple HTML components for the same ADF component are being generated (the LOVs are refreshed via PPR). The surprising thing is that this duplicating behaviour applies to all ADF components listed after the first dynamic LOV in the *.jspx source. For example, I have a <af:outputText="Test Text"/> component created after the first dynamic LOV. Each time the value in the static LOV changes, a duplicate HTML component is created. This also applies to the 'related' second dynamic LOV which is bound to a af:selectOneChoice component - multiple dropdown lists are created. I've checked with the browser's Page Source and there are actually multiple html components being generated with their own unique ADF-generated IDs. I've tried all different options for the Referesh and RefreshCondition attibutes in the second invokeAction element but nothing seems to eliminate this issue.
    Any suggestions about how I might create multiple dependent LOVs from the same bind variable that get refreshed when the selected value changes would be greatly appreciated.
    Thanks
    George

    Hi all,
    Just updating the thread on how I've overcome this issue. As it stood the manner in which I was trying to solve my use case, as described above, was creating an absolute mess. Then with a blank sheet of paper I quickly realised that a much simpler solution would be to create a whole series of master-detail VOs and build my components around them. Thankfully I haven't had any issues going down this path as yet.
    Cheers
    George

  • Bind variables limit and overhead in single query

    HI,
    I've got query with 348 bind variables used in a way like :
    select * from table
    where
    col1 = :1 and col2 = :2
    AND apl_id in (:3, :4 ... , :348)
    is there any overhead related to such high bv number ?
    The session with that query is using about 160MB of PGA (mostly UGA about 150MB).
    Is that somehow related ?
    I'm on 9.2.0.8 EE , AIX .
    Regards
    G

    You can use an array instead of bind variables, it will give you flexibility and scalabilty,
    Example
    Note : replace sys.ODCIVarchar2List with desc sys.dbms_debug_vc2coll for 9i
    Select emp.* from  emp,
    table (sys.ODCIVarchar2List ('SCOTT','ALLEN','KING','KINGDOM'))
    where column_value=ename
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
    desc sys.ODCIVarchar2List
    sys.ODCIVarchar2List VARRAY(32767) OF VARCHAR2(4000)
    on 9.2.0.8  USE
    desc sys.dbms_debug_vc2coll
    sys.dbms_debug_vc2coll TABLE OF VARCHAR2(1000)HTH
    SS

  • How to compute a bind variable from another?

    I am trying to create a View Criteria that has the following View Object Where Clause:
    (UPPER(LOCALE) = UPPER(:LocaleCode) ) OR (UPPER(LOCALE) = UPPER(SUBSTR(:LocaleCode,1,2)))
    In other words, I have a bind variable called LocaleCode, and I want to return all rows that either match the LocaleCode exactly (first part of the Where Clause), or match the first 2 characters of the LocaleCode value (second part of Where Clause).
    I can't seem to figure out any way to do this straight-up using the UI for a View Criteria - there doesn't seem to be a "substring" operator when adding an item to the clause.
    So, my thought was to create a second bind variable (e.g. "LocaleCode2") that was computed from the first bind variable (LocaleCode). This new bind variable would contain the first 2 characters from LocaleCode. I could then have the Where Clause be:
    (UPPER(LOCALE) = UPPER(:LocaleCode) ) OR (UPPER(LOCALE) = UPPER(:LocaleCode2))
    My problem is that when I define the LocaleCode2 bind variable, I see the option to set it to an Expression, but I can't seem to figure out how to build an expression that refers to another bind variable.
    So, my questions are:
    1. How can I have a bind variable expression refer to another bind variable (e.g. "LocaleCode2 = substring(:LocaleCode,1,2)" or something)?
    2. Is there a better way to do this altogether? (What I'm trying to do is set up a view criteria for a lookup table that will return rows that match a passed-in locale exactly (language and country), or just on the 'language' part (first 2 characters).)
    Thanks!

    I think that bind variable accessors in the VO class is what you need. You can override the getter method of the bind variable "LocaleCode2" in order to return the first 2 chars from the bind variable "LocaleCode". Have a look at this blog post for details:
    http://jdeveloperandadf.blogspot.com/2011/03/custom-java-bind-variable-in-where.html
    Dimitar

  • Setting VO bind variable using session variable

    Hi,
    I need to get/set VO bind variable using ApplicationModuleImple or ViewObjectImple class. Does Any one know how to do it?
    I have one VO based on query like "select name from users where password = :password ". I had a bind variable to it too. now i want to set it from a session scoped variable. can i do it using ADFContext.getCurrent().getSession().get('username'); ? but somehow I am not able to get the knowledge i.e where to set bind variable. please help.

    Timo thanks for the reply, actually I don't want to do it using data control i.e drag and drop method to a page. Instead i just want to set bind variable to a session varable already got from login page.
    I got the following sollotion but don't know where to put them,
    1.
    FacesContext context = FacesContext.getCurrentInstance();
    ValueBinding vb = context.getApplication().createValueBinding("#{data}");
    BindingContext bci = (BindingContext)vb.getValue(context);
    DCDataControl dc = bci.findDataControl("AppModuleDataControl");
    ApplicationModule am = (ApplicationModule)dc.getDataProvider();
    AppModuleImpl service = (AppModuleImpl)am;
    ViewObject vo = service.findViewObject("YourViewObject").setNamedWhereClauseParam("nameBindVariable", objectValue);
    vo.executeQuery();
    what is the #{data} in second line ? if you know please let me know.
    Second Solution :
    2- In backing bean code:
    FacesContext context = FacesContext.getCurrentInstance();
    Application fapp = context.getApplication();
    JUFormBinding adfbc = (JUFormBinding)fapp.createValueBinding("#{bindings}").getValue(context);
    DCIteratorBinding iter = adfbc.findIteratorBinding("YourIterator");
    iter.getViewObject().setNamedWhereClauseParam("nameBindVariable", objectValue);
    iter.executeQuery();
    where would I get "YourIterator" ... ? I am still a new at jdev ... ;)

  • HOW to get the bind variables list.

    I've the following problem : I've some SQL queries stored in my DB as VARCHAR2 values.
    I need to use DBMS_SQL in order to execute them.
    In theese SQL statements I have some bind variables like :NUMORD. (ex. SELECT 'X' FROM YYYY WHERE FIELD_1 = :NUMORD).
    I don't know "a priori" names and number of such variables.
    Is there any way to have a list of such bind variables ?
    I found DBMS_DESCRIBE but is seems to act only on stored procedures/functions.
    I know I can tray to inspect the code looking for every ':' but a cleaner solution woulf be appreciated.
    Tks
    Tullio

    I don't know "a priori" names and number of such variables.
    Is there any way to have a list of such bind variables ?The names are probably not important, but you can get the count (and other useful information) like this:
    SQL> var cur refcursor
    SQL> declare
        cl clob;
    begin
        dbms_lob.createtemporary (cl, true);
        sys.utl_xml.parsequery (user, 'select e.deptno, :x x from emp e where deptno = :deptno', cl);
        open :cur for select cl cl from dual union all
                      select 'Count binds: ' || xmlquery('count(//BIND_VARIABLE)' passing xmltype(cl) returning content).getclobval() from dual;
        dbms_lob.freetemporary (cl);
    end;
    PL/SQL procedure successfully completed.
    SQL> print cur
    CL                                                                             
    <QUERY>                                                                        
      <SELECT>                                                                     
        <SELECT_LIST>                                                              
          <SELECT_LIST_ITEM>                                                       
            <COLUMN_REF>                                                           
              <SCHEMA>MICHAEL</SCHEMA>                                             
              <TABLE>EMP</TABLE>                                                   
              <TABLE_ALIAS>E</TABLE_ALIAS>                                         
              <COLUMN>DEPTNO</COLUMN>                                              
            </COLUMN_REF>                                                          
          </SELECT_LIST_ITEM>                                                      
          <SELECT_LIST_ITEM>                                                       
            <BIND_VARIABLE>1</BIND_VARIABLE>                                       
            <COLUMN_ALIAS>X</COLUMN_ALIAS>                                         
          </SELECT_LIST_ITEM>                                                      
        </SELECT_LIST>                                                             
      </SELECT>                                                                    
      <FROM>                                                                       
        <FROM_ITEM>                                                                
          <SCHEMA>MICHAEL</SCHEMA>                                                 
          <TABLE>EMP</TABLE>                                                       
          <TABLE_ALIAS>E</TABLE_ALIAS>                                             
        </FROM_ITEM>                                                               
      </FROM>                                                                      
      <WHERE>                                                                      
        <EQ>                                                                       
          <COLUMN_REF>                                                             
            <SCHEMA>MICHAEL</SCHEMA>                                               
            <TABLE>EMP</TABLE>                                                     
            <COLUMN>DEPTNO</COLUMN>                                                
          </COLUMN_REF>                                                            
          <BIND_VARIABLE>2</BIND_VARIABLE>                                         
        </EQ>                                                                      
      </WHERE>                                                                     
    </QUERY>                                                                       
    Count binds: 2                                                                 
    2 rows selected.

Maybe you are looking for

  • I Can't Get I-tunes to Open Anymore

    I reinstalled a fresh copy of I-tunes, because when I tried to open I-tunes, the hour-glass came on for a few seconds and then nothing. This had gone on for days. Now when I try to open it, the user agreement flashes for a fraction of a second and th

  • Acer Aspire One -- Its protected against bad BIOS Flashes

    I found on the site http://macles.blogspot.com there is a way to flash the system bios of the netbook should something go wrong. It involves a flash drive, renaming a bios bin file and pressing function and escape on bootup.. You might want to go to

  • Dynamic Regions w/Train Component

    I'm working on a web app (JDeveloper 11g) where one page has a dynamic reqion with a task flow associated with it that sets the fragment for the view. Most of the fragments for this region use a page template with a train component. Navigation using

  • Discoverer Graphics in a web page as separate components

    Hi I have a portal open source and i want to integrate my discoverer graphs like discoverer viewer, because discoverer viewer don't let me configure my views (always the graph is deployed in the end of the discoverer viewer and i want to put it in th

  • Process Administrator as a service

    Hi, Can you kindly let me know if there is a way to configure process administrator as a windows service. Thanks, Charan