Equation with dynamic variable

Is it possible to use one equation with 2 or more variables and make one of these variable as an output without changing the equation?
Take the equation below example:
R=x/(0.28706/0.46153+x)*(101.325/P)
As usual, by inserting the values of x and P, then value of R will be answered.
But if only the value of R and x can be inserted, how can the value of P to be answered without altering the equation.
The equation is being used multiple time in the same VI. One is for generating one part of a graph (Mollier Diagram) and the others are to be used to find the value at the intersection.
I hope my question is understandable.
Thank you in advance
-sikat
Solved!
Go to Solution.

R = (x/(a+x)*(b/P) ... thx, this really will be helping me to make this Eq more understandable
Formula Node:
It seem that when i entered an equation(Eq), only the left side of the Eq can only be one variable thus producing a single output.
Case Structure(or SELECT function):
It changes the formula to a new form for every output. Let say i want make x an output. That means i need to create a new Eq : x=(P*R/b-1)*a, which i want to avoid if posible .
.... Does this means that a new Eq must be created/converted for each output.
Newton Raphson zero finder vi: (base on this N-R Example)
I have tried using this VI by making my Eq equivalent to zero and using SELECT function depending on situation. Somehow i think it will work, but the VI seem too bulky for one simple formula (with 2 variable and 1 output), which i want to avoid since many more formula will be used.
I ll be glad to see more suggestions.

Similar Messages

  • IMPORT statement with dynamic variable

    Friends, Need Help!!!!!!!
    Im trying IMPORT variable contents from a cluster table VARI. I can do a IMPORT without issues when I use exact name of the variable but I have issues with dynamic variable selection. Pls see code below.
    loop at objects.
       assign objects-name to <fs>.
       IMPORT <fs> to tmp_var from database vari(va) id st_key.
    endloop.
    I do not get any value to tmp_var.  Need help!
    thanks
    Bhaskar

    Try this.
    loop at objects.
    IMPORT (objects-name) to tmp_var from database vari(va) id st_key.
    endloop.
    Does it work?
    Regards,
    RIch Heilman

  • How to generate report with dynamic variable number of columns?

    How to generate report with dynamic variable number of columns?
    I need to generate a report with varying column names (state names) as follows:
    SELECT AK, AL, AR,... FROM States ;
    I get these column names from the result of another query.
    In order to clarify my question, Please consider following table:
    CREATE TABLE TIME_PERIODS (
    PERIOD     VARCHAR2 (50) PRIMARY KEY
    CREATE TABLE STATE_INCOME (
         NAME     VARCHAR2 (2),
         PERIOD     VARCHAR2 (50)     REFERENCES TIME_PERIODS (PERIOD) ,
         INCOME     NUMBER (12, 2)
    I like to generate a report as follows:
    AK CA DE FL ...
    PERIOD1 1222.23 2423.20 232.33 345.21
    PERIOD2
    PERIOD3
    Total 433242.23 56744.34 8872.21 2324.23 ...
    The TIME_PERIODS.Period and State.Name could change dynamically.
    So I can't specify the state name in Select query like
    SELECT AK, AL, AR,... FROM
    What is the best way to generate this report?

    SQL> -- test tables and test data:
    SQL> CREATE TABLE states
      2    (state VARCHAR2 (2))
      3  /
    Table created.
    SQL> INSERT INTO states
      2  VALUES ('AK')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AL')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AR')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('CA')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('DE')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('FL')
      3  /
    1 row created.
    SQL> CREATE TABLE TIME_PERIODS
      2    (PERIOD VARCHAR2 (50) PRIMARY KEY)
      3  /
    Table created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD1')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD2')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD3')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD4')
      3  /
    1 row created.
    SQL> CREATE TABLE STATE_INCOME
      2    (NAME   VARCHAR2 (2),
      3       PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
      4       INCOME NUMBER (12, 2))
      5  /
    Table created.
    SQL> INSERT INTO state_income
      2  VALUES ('AK', 'PERIOD1', 1222.23)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('CA', 'PERIOD1', 2423.20)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('DE', 'PERIOD1', 232.33)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('FL', 'PERIOD1', 345.21)
      3  /
    1 row created.
    SQL> -- the basic query:
    SQL> SELECT   SUBSTR (time_periods.period, 1, 10) period,
      2             SUM (DECODE (name, 'AK', income)) "AK",
      3             SUM (DECODE (name, 'CA', income)) "CA",
      4             SUM (DECODE (name, 'DE', income)) "DE",
      5             SUM (DECODE (name, 'FL', income)) "FL"
      6  FROM     state_income, time_periods
      7  WHERE    time_periods.period = state_income.period (+)
      8  AND      time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
      9  GROUP BY ROLLUP (time_periods.period)
    10  /
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> -- package that dynamically executes the query
    SQL> -- given variable numbers and values
    SQL> -- of states and periods:
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3    TYPE cursor_type IS REF CURSOR;
      4    PROCEDURE procedure_name
      5        (p_periods   IN     VARCHAR2,
      6         p_states    IN     VARCHAR2,
      7         cursor_name IN OUT cursor_type);
      8  END package_name;
      9  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY package_name
      2  AS
      3    PROCEDURE procedure_name
      4        (p_periods   IN     VARCHAR2,
      5         p_states    IN     VARCHAR2,
      6         cursor_name IN OUT cursor_type)
      7    IS
      8        v_periods          VARCHAR2 (1000);
      9        v_sql               VARCHAR2 (4000);
    10        v_states          VARCHAR2 (1000) := p_states;
    11    BEGIN
    12        v_periods := REPLACE (p_periods, ',', ''',''');
    13        v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
    14        WHILE LENGTH (v_states) > 1
    15        LOOP
    16          v_sql := v_sql
    17          || ',SUM(DECODE(name,'''
    18          || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
    19          || '"';
    20          v_states := LTRIM (SUBSTR (v_states, 3), ',');
    21        END LOOP;
    22        v_sql := v_sql
    23        || 'FROM     state_income, time_periods
    24            WHERE    time_periods.period = state_income.period (+)
    25            AND      time_periods.period IN (''' || v_periods || ''')
    26            GROUP BY ROLLUP (time_periods.period)';
    27        OPEN cursor_name FOR v_sql;
    28    END procedure_name;
    29  END package_name;
    30  /
    Package body created.
    SQL> -- sample executions from SQL:
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR                                                        
    PERIOD1       1222.23                                                                              
    PERIOD2                                                                                            
                  1222.23                                                                              
    SQL> -- sample execution from PL/SQL block
    SQL> -- using parameters derived from processing
    SQL> -- cursors containing results of other queries:
    SQL> DECLARE
      2    CURSOR c_period
      3    IS
      4    SELECT period
      5    FROM   time_periods;
      6    v_periods   VARCHAR2 (1000);
      7    v_delimiter VARCHAR2 (1) := NULL;
      8    CURSOR c_states
      9    IS
    10    SELECT state
    11    FROM   states;
    12    v_states    VARCHAR2 (1000);
    13  BEGIN
    14    FOR r_period IN c_period
    15    LOOP
    16        v_periods := v_periods || v_delimiter || r_period.period;
    17        v_delimiter := ',';
    18    END LOOP;
    19    v_delimiter := NULL;
    20    FOR r_states IN c_states
    21    LOOP
    22        v_states := v_states || v_delimiter || r_states.state;
    23        v_delimiter := ',';
    24    END LOOP;
    25    package_name.procedure_name (v_periods, v_states, :g_ref);
    26  END;
    27  /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR         CA         DE         FL                       
    PERIOD1       1222.23                           2423.2     232.33     345.21                       
    PERIOD2                                                                                            
    PERIOD3                                                                                            
    PERIOD4                                                                                            
                  1222.23                           2423.2     232.33     345.21                       

  • Navigation list issue with dynamic variable

    Hi All,
    I'm a little bit stock with (maybe) a little issue. I'm looking for a way to put variable on a navigation list in the same page. E.X. there is where my navigation list is pointing : f?p=&APP_ID.:20:&SESSION.::&DEBUG.::P20_3,P20_1,P20_2:#État#,#Année Comptable#,#Période Comptable#: .
    I Need to inherit the value ( #État#,#Année Comptable#,#Période Comptable#:) from a sql query from the main region (list are in a subregion ).
    Could some one help me with that please ?
    Thanks in advance !!
    Eric

    Hmm.. on the last APEX SIG day in Belgium Oracle was very dark about that (as usual).
    They even were not sure what features would definitely be present in the new version.
    They did however expect it to be somewhere in october / november
    again. you can mimic by using a report-region looking like a list
    regards,
    Richard

  • C:set with dynamic variable name

    Hello,
    we have a litte market system.
    we iterate over the articles to display them on a page
    foreach article type we have to include a popup, but only once foreach article type.
    So if we have more than one article of the same type, the popup should be included only one time.
    <c:forEach var="article" items="#{MyArticleController.entities}">
        <c:if test="${requestScope[article.dtype] != true}">
            <!-- <ui:include src="/market/details/#{article.dtype}.xhtml"/>  -->          
            <c:set scope="request" var="${article.dtype}" value="1" />
        </c:if>
        <!-- <ui:include src="/market/preview/#{article.dtype}.xhtml"/>-->
    </c:forEach>I think the line with the c:set seems to be the problem.
    How can I solve this problem. How can I set a dynamic value and test against it later?
    Thanks
    Dirk

    You were close with your first example.
    However as noted, the <c:set> tag doesn't accept a dynamic expression for the "var" attribute.
    Suggested alternative: instead of using request attributes, have a seperate map
    <jsp:useBean id="articleTypeUsed" class="java.util.HashMap"/>
    <c:forEach var="article" items="#{MyArticleController.entities}">
        <c:if test="${not empty articleTypeUsed[article.dtype]}">
            <!-- <ui:include src="/market/details/#{article.dtype}.xhtml"/>  -->          
            <c:set target="${articleTypeUsed}" property="${article.dtype}" value="1" />
        </c:if>
        <!-- <ui:include src="/market/preview/#{article.dtype}.xhtml"/>-->
    </c:forEach>That should solve your issue with translating this java code into jstl.
    Whether the mix of JSTL and JSF/ui will work well together is a completely seperate issue, and one I can't really help with.

  • Directive.include with dynamic variable

    How would I put a variable I have called ${includeFile} into an include directive below? I tried
    <jsp:directive.include file="${includeFile} " />
    And this did not work...

    How would I put a variable I have called
    ${includeFile} into an include directive below? I
    tried
    <jsp:directive.include file="${includeFile} " />are you sure of the Syntax ?
    >
    And this did not work...We can do 2 types of include in a jsp file see the Syntax .....
    1.<jsp:include> ----Includes a static file or sends a request to a dynamic file
    <jsp:include page="{relativeURL | <%= expression %>}" flush="true" />
    or
    <jsp:include page="{relativeURL | <%= expression %>}" flush="true" >
    <jsp:param name="parameterName"
              value="{parameterValue | <%= expression %>}" />+
    </jsp:include>
    2.Include Directive
    <%@ include file="relativeURL" %> -----Includes a static file in a JSP file, parsing the file's JSP elements.
    Deside which one you want to use...
    ---Vidya

  • Create a Java Object with Dynamic Variables

    Hi ,
    I am constructing a web based system which stores personal information on people. I have created a Person class with all the obvoius variables, forename, surname, address etc.. My problem is that some clients wish to make use of some of the variables, some want other variables and as i meet others they wish to add in some new variables eg
    Client 1 wishes to store; Forename, Surname and Address
    Client 2 wishes to store Forename, AltForename, Surname, AltSurname and Address ( AltForename - this is an alternative Forename in this case the Irish translation of their English name)
    Client 3 wishes to store Forename, Surname, Title, Address, Height, Weight, DOB, School, Occcupation.
    Each of the clients above need to submit these in an online form with each form looking different due to the fields they have to enter and also with different validation rules.
    At present i have a Person object handling all fields i can think of and different validation methods depending on the client, but there must be a better way of doing this as each time a new field is added by a new or existing client, i not only have to update the java and jsp but also the DB.
    This is all web based and i wish to use the same code base and data source for all clients. I also wish it to be all web based. So in theory if a client asked to add in a "middle name" field to their form and make it mandatory, i could go to an admin page which lists all the possible input element types and select the "field type" then set validation rules on it.
    All the web based and DB parts can be ignored - the main issue here is creating a Person class which can have any number of variables of varying types ( String, Int, etc)
    Regards,
    Cormac
    Edited by: cormacodonnell on Jun 27, 2008 6:33 AM

    cormacodonnell wrote:
    Hi ,
    I am constructing a web based system which stores personal information on people. I have created a Person class with all the obvoius variables, forename, surname, address etc.. My problem is that some clients wish to make use of some of the variables, some want other variables and as i meet others they wish to add in some new variables eg
    Client 1 wishes to store; Forename, Surname and Address
    Client 2 wishes to store Forename, AltForename, Surname, AltSurname and Address ( AltForename - this is an alternative Forename in this case the Irish translation of their English name)
    Client 3 wishes to store Forename, Surname, Title, Address, Height, Weight, DOB, School, Occcupation.You could extend the Person class with 3 sub classes, but that might be overkill just to store personal info.
    Each of the clients above need to submit these in an online form with each form looking different due to the fields they have to enter and also with different validation rules.
    At present i have a Person object handling all fields i can think of and different validation methods depending on the client, That's probably how I'd do it if it's not too much trouble. But to be OO you should probably go the inheritence route.
    but there must be a better way of doing this as each time a new field is added by a new or existing client, i not only have to update the java and jsp but also the DB. Welcome to software development. It's called "feature creep" or "scope creep". As soon as you get your code working right and deploy it and get ready to go on vacation, the customer always comes back with something else they "need" or "forgot". The app I'm building right now I've rewritten or changed 7 times in 3 months because nobody has a clue what they really need.

  • Query with dynamic variables and customised caption

    How to change the Field label when the query asking dynamic values during the execution?
    for example:  in where condition i want to give a country name during the query execution, but in the small window it will display as 'Name' which is a country name.  i want to display it as 'Country Name' which should be more readable for the end user. How can we achieve this?
    Thanks
    SV Reddy

    Hi,
    Unfortunately, it is not possible to change the system field description.
    Refer to this thread
    Re: Parameter Display Name Reg.
    Regards,
    Vijay Kumar
    SAP Business One Forums Team

  • Dynamic sql with dynamic bulk collection variable

    Hi,
    I am facing the issue while bulk collecting dynamic sql query data into dynamic variable.
    Eg:
    query1:= << dynamic select query>>
    Execute immediate query1 bulk collect into Dynamic_varibale;
    here dynamic_varible is pl/sql table type with 1 column.
    How do i declare "dynamic_variable" here????
    please suggest...

    create type t_id is table of number
    SQL> create type t_id is table of number
      2  /
    Type created.
    SQL> declare
      2
      3   v_tid t_id;
      4   v_results sys_refcursor;
      5
      6   v_employee_id number;
      7   v_name varchar2(100);
      8
      9   v_sql varchar2(1000);
    10
    11
    12  begin
    13   v_tid := t_id(7902,7934);
    14
    15  --
    16
    17
    18   v_sql := 'select empno, ename from scott.emp ' ||CHR(10)
    19           || 'where empno in (select column_value from table(cast(:v_tid as
    t_id)))';
    20
    21   dbms_output.put_line(v_sql);
    22   dbms_output.put_line('----------');
    23
    24   open v_results for v_sql using v_tid;
    25
    26
    27   IF v_results IS NOT NULL
    28     THEN
    29        LOOP
    30           FETCH v_results
    31            INTO v_employee_id, v_name;
    32
    33           EXIT WHEN (v_results%NOTFOUND);
    34           dbms_output.put_line(v_name);
    35        END LOOP;
    36
    37        IF v_results%ISOPEN
    38        THEN
    39           CLOSE v_results;
    40        END IF;
    41    END IF;
    42
    43  end;
    44  /
    select empno, ename from scott.emp
    where empno in (select column_value from
    table(cast(:v_tid as t_id)))
    FORD
    MILLER

  • How to build an equation with variables

    I want to solve an equation shown in below by the Newton Raphson zero finder vi:
    z-a*b*c*exp(-z/a),
    a, b, and c are variables
    I can build equation with constant a,b,c, but how can I build this one?
    Many thanks!
    Solved!
    Go to Solution.

    A couple of points I usually feel compelled to make when I see the use of the NR method.
    1)  Not an issue in a simple case like this, but the NR routine is typically a poor choice when you have a 1D problem and you calculate the derivative numerically.
    2)  If I am going to hardwire the formula like the previous example, then I will just use a VI instead of a formula.  I only use formulas when I want to be able to make changes on-the-fly.  I am just a bit dubious of the formula parsing VIs in general.
    3) There is a VI called Substitute Variables which will take a set of rules and substitute numbers for parameters in your formula.  Here is a quick example of its use.  Here the names and number of parameters is fixed by the cluster itself.  If I need full flexibility I use a table to hold the parameters and their values, but I do not want to muddy the waters here.  You can just choose your favorite UI and convert (if necessary) to the proper cluster for the substitution rules.

  • Problem with Dynamic Node & UI Elements

    Hi,
                                            The scenario is to create an Questioaire.Since the number questions which I get from R/3 may vary, I have created the Dynamic Node which is mapped with Dynamic set of Radio button Group by index for options & Dynamic text view for displaying Questions..  A New Dynamic Node will be created for each set of Questions .The Number of questions displayed per page is controlled by the Static Counter Variable....
                                              Now the issue is ,if i click back button the count will be initialized so again it needs to trigger the DoModifyView(). at that time It is arising an exception "Duplicate ID for view & Radio button ..." because while creating Dynamic node i used to have "i" value along the Creation of node name...
    for(i=Count;i<i<wdContext.nodeQuestions().size();i++)
                   customnod=<b>nodeinfo.getChild("Questionaire"+i);</b>
                        if(customnod==null)
    Its not possible to create a new node whenever i click the Back button.
    At the same time i am not able to fetch the elements which had already created Dynamically...
    How do i make the Next & back button work?
    If anyone  bring me the solution It would be more helpful to me.
    Thanks in advance..
    Regards,
    Malar

    Hi,
          We can Loop through the Node Elements but how can we do Option Button Creation for each set of question Options?. At design time we can not have the radio buttons,because we do not know how many set of questions are available at the Backend.

  • SLOW report performance with bind variable

    Environment: 11.1.0.7.2, Apex 4.01.
    I've got a simplified report page where the report runs slowly compared to running the same query in sqldeveloper. The report region is based on a pl/sql function returning a query. If I use a bind variable in the query inside apex it takes 13 seconds to run, and if I hard code a string it takes only a few hundredths of a second. The query returns one row from a table which has 1.6 million rows. Statistics are up-to-date and the columns in the joins and where clause are indexed.
    I've run traces using p_trace=YES from Apex for both the bind variable and hard coded strings. They are below.
    The sqldeveloper explain plan is identical to the bind variable plan from the trace, yet the query runs in 0.0x seconds in sqldeveloper.
    What is it about bind variable syntax in Apex that is causing the bad execution plan? Apex Bug? 11g bug? Ideas?
    tkprof output from Apex trace with bind variable is below...
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM(:P71_SEARCH_SOURCE1)))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.01          0          1         27           0
    Fetch        2     13.15      13.22      67694      72865          0           1
    total        4     13.15      13.23      67694      72866         27           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=72869 pr=67694 pw=0 time=0 us cost=29615 size=14255040 card=178188)
          1   FILTER  (cr=72869 pr=67694 pw=0 time=0 us)
          1    HASH JOIN RIGHT SEMI (cr=72865 pr=67694 pw=0 time=0 us cost=26308 size=14255040 card=178188)
          1     INDEX FAST FULL SCAN IDX$$_0A300001 (cr=18545 pr=13379 pw=0 time=0 us cost=4993 size=2937776 card=183611)(object id 68485)
    1696485     TABLE ACCESS FULL PERSONS (cr=54320 pr=54315 pw=0 time=21965 us cost=14958 size=108575040 card=1696485)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     HASH JOIN (RIGHT SEMI)
          1      INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                     'IDX$$_0A300001' (INDEX)
    1696485      TABLE ACCESS   MODE: ANALYZED (FULL) OF 'PERSONS' (TABLE)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file scattered read                       1276        0.00          0.16
      db file sequential read                       812        0.00          0.02
      direct path read                             1552        0.00          0.61
    ********************************************************************************Here's the tkprof output with a hard coded string:
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM('0b')))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.02       0.04          0          0          0           0
    Execute      1      0.00       0.00          0          0         13           0
    Fetch        2      0.00       0.00          0          8          0           1
    total        4      0.02       0.04          0          8         13           1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=10 pr=0 pw=0 time=0 us cost=9 size=80 card=1)
          1   FILTER  (cr=10 pr=0 pw=0 time=0 us)
          1    NESTED LOOPS  (cr=8 pr=0 pw=0 time=0 us)
          1     NESTED LOOPS  (cr=7 pr=0 pw=0 time=0 us cost=8 size=80 card=1)
          1      SORT UNIQUE (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1       TABLE ACCESS BY INDEX ROWID PERSON_SYSTEMS (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1        INDEX RANGE SCAN IDX_PERSON_SYSTEMS_SOURCE_KEY (cr=3 pr=0 pw=0 time=0 us cost=3 size=0 card=1)(object id 68561)
          1      INDEX UNIQUE SCAN PK_PERSONS (cr=3 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 68506)
          1     TABLE ACCESS BY INDEX ROWID PERSONS (cr=1 pr=0 pw=0 time=0 us cost=2 size=64 card=1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     NESTED LOOPS
          1      NESTED LOOPS
          1       SORT (UNIQUE)
          1        TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                       'PERSON_SYSTEMS' (TABLE)
          1         INDEX   MODE: ANALYZED (RANGE SCAN) OF
                        'IDX_PERSON_SYSTEMS_SOURCE_KEY' (INDEX)
          1       INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'PK_PERSONS'
                      (INDEX (UNIQUE))
          1      TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                     'PERSONS' (TABLE)

    Patrick, interesting insight. Thank you.
    The optimizer must be peeking at my bind variables with it's eyes closed. I'm the only one testing and I've never passed %anything as a bind value. :)
    Here's what I've learned since my last post:
    I don't think that sqldeveloper is actually using the explain plan it says it is. When I run explain plan in sqldeveloper (with a bind variable) it shows me the exact same plan as Apex with a bind variable. However, when I run autotrace in sqldeveloper, it takes a path that matches the hard coded values, and returns results in half a second. That autotrace run is consistent with actually running the query outside of autotrace. So, I think either sqldeveloper isn't really using bind variables, OR it is using them in some other way that Apex does not, or maybe optimizer peeking works in sqldeveloper?
    Using optimizer hints to tweak the plan helps. I've tried both /*+ FIRST_ROWS */ and /*+ index(ps pk_persons) */ and both drop the query to about a second. However, I'm loath to use hints because of the very dynamic nature of the query (and Tom Kyte doesn't like them either). The hints may end up hurting other variations on the query.
    I also tested the query by wrapping it in a select count(1) from ([long query]) and testing the performance in sqldeveloper and in Apex. The performance in that case is identical with both bind variables and hard coded variables for both Apex and SqlDeveloper. That to me was very interesting and I went so far as to set up two bind variable report regions on the same page. One region wrapped the long query with select count(1) from (...) and the other didn't. The wrapped query ran in 0.01 seconds, the unwrapped took 15ish seconds with no other optimizations. Very strange.
    To get performance up to acceptable levels I have changed my function returning query to:
    1) Set the equality operator to "=" for values without wildcards and "like" for user input with wildcards. This makes a HUGE difference IF no wildcard is used.
    2) Insert a /*+ FIRST_ROWS */ hint when users chose the column that requires the sub-query. This obviously changes the optimizer's plan and improves query speed from 15 seconds to 1.5 seconds even with wildcards.
    I will NOT be hard coding any user supplied values in the query string. As you can probably tell by the query, this is an application where sql injection would be very bad.
    Jeff, regarding your question about "like '%' || :P71_SEARCH_SOURCE1 || '%'". I've found that putting wildcards around values, particularly at the beginning will negate any indexing on the column in question and slows performance even more.
    I'm still left wondering if there isn't something in Apex that is breaking the optimizer "peeking" that Patrick describes. Perhaps something in the way it switches contexts from apex_public_user to the workspace schema?

  • Running a SQL Stored Procedure from Power Query with Dynamic Parameters

    Hi,
    I want to execute a stored procedure from Power Query with dynamic parameters.
    In normal process, query will look like below in Power Query. Here the value 'Dileep' is passed as a parameter value to SP.
        Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData 'Dileep'"]
    Now I want to pass the value dynamically taking from excel sheet. I can get the required excel cell value in a variable but unable to pass it to query.
        Name_Parameter = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        Name_Value = Name_Parameter{0}[Value],
    I have tried like below but it is not working.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData Name_Value"]
    Can anyone please help me with this issue.
    Thanks
    Dileep

    Hi,
    I got it. Below is the correct syntax.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData '" & Name_Value & "'"]
    Thanks
    Dileep

  • Need help with Dynamic Excel File Name please.

    I am try to output an excel file with dynamic date. 
    Here what I done.
    I am using SQL 2012.
    Create Execute SQL Task Connect Type: Excel
    Create Data Flow Task set to DelayValidation: True
    Create OLE DB Sourc
    Create Data Converstion
    Excel Destination
    Excel Connection, Expression, select ExcelFilePath
    @[User::sXLFilePath] +  @[User::sFileName] + RIGHT("0" + (DT_WSTR, 2) DATEPART("DD", GETDATE()), 2)+ RIGHT("0" + (DT_WSTR, 2) DATEPART("MM", GETDATE()), 2) + RIGHT((DT_WSTR,
    4) DATEPART("YYYY", GETDATE()), 2) +".csv"
    C:\ExcelOutPut\SOX_CAM_SQL_Report_010215.xls
    What I try to accomplish is output the file with each day append to it, date must be DDMMYY.
    I google it and found many samples, tested it, and none of them is work for me. 
    Any suggestions or some examples to share is greatly appreciate. 
    I am new to SSIS.  I found one poster have similar issue and inside the posted below, there was one suggestion to create variable and connection string but how do I bind that variable to Excel Connection manger.
    Please help.
    Thank you so much in advance.
    Ex: SOX_CAM_SQL_Report _020215.csv
           SOX_CAM_SQL_Report _030215.csv
    --Similar issue:
    https://social.msdn.microsoft.com/Forums/en-US/bda433aa-c8f8-47c9-9e56-efd20b8354ac/creating-a-dynamic-excel-file?forum=sqlintegrationservices
    Suggestion in the above posted but where can bind this to Excel Connection Manger. 
    Please help provide step by step.  Thanks.
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\temp\\" + "ExcelTarget" + (DT_WSTR,4)DATEPART("yyyy",GETDATE())  +
    ".xls" + ";Extended Properties=\"EXCEL 8.0;HDR=YES\";"
    And yes, as you were intimating, the delay validation on the dataflow should be set.

    Hi NguyenBL,
    According to your description, you created ssis package to export data from database to excel, when the package runs, you want to create new excel and name the file with time stamp. If that is the case, we can achieve the goal by following steps:
    Create a script task used to create excel files.
    Create a data flow task to export data from database to excel.
    Add OLE DB source to data flow task.
    Add Excel Destination to data flow task.
    Create connection manager for OLE DB and Excel.
    Click Excel Connection Manager, in Properties window, click (…) button next to Expressions, then set ExcelFilePath with expression like below:
    "C:\\ETL Lab\\CreateNewExcel\\ExportData_"+REPLACE((DT_STR, 20, 1252)(DT_DBTIMESTAMP)@[System::StartTime], ":", "")+".xls"
    For detail information, please refer to the document:
    https://sqljourney.wordpress.com/2013/01/12/ssis-create-new-excel-file-dynamically-to-export-data/
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Binding dynamic variable in XQuery doesn't work: ORA-00932

    I have a table with several columns. One of those columns is a XMLType.
    My goal is to have a query which selects rows from the table of which the XML column matches certain criteria.
    I'm trying following example (JDBC) : http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_xquery.htm#insertedID11
    First, I created my own query, which looks like:
    select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement[contains(Element, "someValue")] return "true"' passing t.xmlColumn)This works as expected. Next, as done in the example, I'm trying to replace the "someValue" with a dynamic variable.
    Query then looks like:
    select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement[contains(Element, $val)] return "true"' passing t.xmlColumn, :1 as "val")This does not seem to work, neither in SQLDeveloper nor in java.
    I always get the :
    java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got CHAR(SQLDeveloper just gives ORA-00932)
    When I put $val between quotes (so "$val") then I get no error, but then I get no results either.
    I think it will not replace $val in that case but just use it as a literal, so thats not what I want
    I also tried to remove "contains" xpath and use the exact same example as on the oracle page
    select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement/Key = $val return "true"' passing t.xmlColumn, :1 as "val")But this doens't help either.
    I'm clueless about this, so any help would be appreciated
    Edited by: user5893566 on Nov 29, 2008 6:24 AM

    Ok, I tested it using the latest enterprise edition (11g) and there it works as expected.
    However, on 10.2.0.1.0 and 10.2.0.3.0 it gives this error.
    Is this a bug which has been fixed or should I do something special on 10g ?
    I installed all of these as normal without any special settings, created the tables and ran the query...

Maybe you are looking for

  • If I make a new apple ID, will I be able to transfer my credits and purchases?

    Recently, my brother was given an iTunes Gift Card. Whenever he tries to purchase something, however, it asks for the answers to his security questions. The problem is that he has no recollection of even answering these security questions. I have no

  • Set password for sleeping computer

    How can I set a password on my imac following sleep so no one can access except me?

  • Microsoft PowerPoint Web App - "The service is temporarily unavailable"

    Hi all,  I have had a problem with Office Web Apps/SharePoint 2010 now for over a week. When trying to access PowerPoint Presentations I receive the error: I have looked through all of the Technet articles on this error and more, but still I have had

  • FF 3.6.12 keeps telling me to update to FF 3.6.12

    I have upgraded to Firefox 3.6.12 and have been asked 3 times since doing so to upgrade to Firefox 3.6.12. All systems appear to function as they should. Not sure why I get this question so many times. This version is the only one that has produced t

  • General ABAP clarifications

    1.How to design subscreens in selection-screen in a report program? 2.how to u design tabs selection screens?like for one Tab one display and other Tab other display ..? 3.in selection screen there are 20 fields but in display i need to display only