Binding variable

How can i make the value for the binding variable is always upper case. I am wroking with asp.net
thanks a bunch
Dim Sql As String = " select * from vendor where vnamel like :VendorName"

Thank you Justin the UPPER function worked! that was exactly what i needed.thanks again.
Actually, this is what i wanted to do. do you see anything worng with this code?
no row selected. when i remove like and the percentage sing i get one row.
select * from vendaddr where vendor like '%' || upper(:VendorName')

Similar Messages

  • Report Performance with Bind Variable

    Getting some very odd behaviour with a report in APEX v 3.2.1.00.10
    I have a complex query that takes 5 seconds to return via TOAD, but takes from 5 to 10 minutes in an APEX report.
    I've narrowed it down to one particular bind. If I hard code the date in it returns in 6 seconds, but if I let the date be passed in from a parameter it takes 5+ minutes again.
    Relevant part of the query (an inline view) is:
    ,(select rglr_lect lect
    ,sum(tpm) mtr_tpm
    ,sum(enrols) mtr_enrols
    from ops_dash_meetings_report
    where meet_ev_date between to_date(:P35_END_DATE,'DD/MM/YYYY') - 363 and to_date(:P35_END_DATE,'DD/MM/YYYY')
    group by rglr_lect) RPV
    I've tried replacing the "to_date(:P35_END_DATE,'DD/MM/YYYY') - 363" with another item which is populated with the date required (and verified by checking session state). If I replace the :P35_END_DATE with an actual date the performance is fine again.
    The weird thing is that a trace file shows me exactly the same Explain Plan as the TOAD Explain where it runs in 5 seconds.
    Another odd thing is that another page in my application has the same inline view and doesn't hit the performance problem.
    The trace file did show some control characters (circumflex M) after each line of this report's query where these weren't anywhere else on the trace queries. I wondered if there was some sort of corruption in the source?
    No problems due to pagination as the result set is only 31 records and all being displayed.
    Really stumped here. Any advice or pointers would be most welcome.
    Jon.

    Don't worry about the Time column, the cost and cardinality are more important to see whther the CBO is making different decisions for whatever reason.
    Remember that the explain plan shows the expected execution plan and a trace shows the actual execution plan. So what you want to do is compare the query with bind variables from an APEX page trace to a trace from TOAD (or sqlplus or whatever). You can do this outside APEX like this...
    ALTER SESSION SET EVENTS '10046 trace name context forever, level 1';Enter and run your SQL statement...;
    ALTER SESSION SET sql_trace=FALSE;This will create a a trace file in the directory returned by...
    SELECT value FROM v$parameter WHERE name = 'user_dump_dest' Which you can use tkprof to format.
    I am assuming that your not going over DB links or anything else slightly unusual?
    Cheers
    Ben

  • How to Dene a Data Link Between Queries: Bind Variables

    This is an interesting topic and I cannot get it to work using Bind Variables.
    I have 2 queries: Q1 and Q2. Q2 needs c_id, account_code and account_type from Q1.
    Whe I run the data template below, I get only the data for Q1.
    Now people may argue that there is no data in Q2 for the relevant clause. So if I even remove the where clause in Q2 I still get no joy i.e Data appears for Q1 but not for Q2
    <dataTemplate name="FLCMR519_DATA_SET" description="Termination Quote Report">
         <parameters>
              <parameter name="cid" dataType="number" defaultValue="1"/>
              <parameter name="p_cln_id" dataType="number" defaultValue="62412"/>
         </parameters>
         <dataQuery>
              <sqlStatement name="Q1">
                   <![CDATA[SELECT qm.qmd_id,
    qm.contract_period,
    qm.quo_quo_id||'/'||qm.quote_no||'/'||qm.revision_no reference_no,
    qm.contract_distance,
    qm.mdl_mdl_id,
    q.qpr_qpr_id,
    q.quo_id,
    q.drv_drv_id,
    qm.revision_user username,
    pb.first_name||' '||pb.last_name op_name,
    pb.telephone_no,
    pb.facsimile_no,
    pb.email,
    q.c_id c_id,
    q.account_type account_type,
    q.account_code account_code,
    m.model_desc,
    ph.payment_description payment_head_desc,
    cl.fms_fms_id,
    cl.start_date,
    cl.end_date,
    cl.actual_end_date,
    cl.con_con_id,
    cl.cln_id,
    cl.term_qmd_id term_qmd_id,
    qm2.contract_period term_period,
    qm2.contract_distance term_distance
    FROM quotations q,
               quotation_models qm,
               contract_lines cl,
               personnel_base pb,
               models m,
               model_types mt,
               payment_headers ph,
               quotation_models qm2
    WHERE q.quo_id = qm.quo_quo_id
           AND cl.cln_id = :p_cln_id
           AND qm.qmd_id = cl.qmd_qmd_id
           AND qm2.revision_user = pb.employee_no (+)
           AND qm.mdl_mdl_id = m.mdl_id
           AND m.mtp_mtp_id = mt.mtp_id
           AND qm.payment_id = ph.payment_header_id
           AND qm2.qmd_id (+) = cl.term_qmd_id
    ]]>
              </sqlStatement>
              <sqlStatement name="Q2">
                   <![CDATA[SELECT ea.c_id,                  ea.account_type,ea.account_code,ea.account_name
    FROM external_accounts ea
                 WHERE ea.c_id = :c_id
                   AND ea.account_type = :account_type
                   AND ea.account_code = :account_code
    ]]>
              </sqlStatement>
         </dataQuery>
    </dataTemplate>

    Defining dataStructure section is mandatory for multiple queries.

  • Can I use bind variable instaed of writing static COLUMN Name

    Hi , I am having a table containing id and column names, the data is stored against that id in other tables. Now I wish to update data into another table so that it goes into apppropriate column without using decode function.
    I am trying to do this:
    EXECUTE IMMEDIATE 'update TEST set :1 = :2
    where PROJECT_ID= :3 and UNIQUE_ID= :4' using P_DEST_COLUMN, P_TEXT_VALUE, P_PROJ_ID, P_TASK_UID;
    the values P_DEST_COLUMN, P_TEXT_VALUE, P_PROJ_ID, P_TASK_UID are populated using a cursor in PL/SQl
    Is this statement valid? If not can you tell me how to do it as I am getting some error I am unable to comprehend.
    thanks
    Rishabh

    Column names cannot be substituted at run-time as bind variables. If you need to specify the column name at run-time, you'd need to construct a new string and execute that string dynamically, i.e.
    EXECUTE IMMEDIATE 'UPDATE test SET ' || p_dest_column || ' = :1 ' || ...From a data model standpoint, storing column names as data elements in another table is generally a rather poor idea. It's likely to make ad-hoc reporting nearly impossible and to cause a lot more parsing than would otherwise be required.
    Justin

  • Dynamic sql and bind variables

    Hi,
    I have a stored procedure which filters a table on 5 five columns. The filters come from the input parameters,
    and these 5 parameters can come in any combination, I mean some of them may be null and some of them may not be null.
    So I constructed the where filter of the query with IF blocks like the following:
    dynamic_query := 'select * from TESTTABLE where 1= 1';
    IF (P1 is not null) THEN
    dynamic_query := dynamic_query || ' AND column1 = :1';
    END IF;
    IF (P2 is not null) THEN
    dynamic_query := dynamic_query || ' AND column2 = :2';
    END IF;
    IF (P3 is not null) THEN
    dynamic_query := dynamic_query || ' AND column3 = :3';
    END IF;
    IF (P4 is not null) THEN
    dynamic_query := dynamic_query || ' AND column4 = :4';
    END IF;
    IF (P5 is not null) THEN
    dynamic_query := dynamic_query || ' AND column5 = :5';
    END IF;
    OPEN CUR_OUT FOR dynamic_query USING P1, P2, P3, P4, P5;
    The problem is how can I construct the USING and bind parameters, I cannot use "USING P1, P2, P3, P4, P5" because some of bind variables
    may not be in dynamic query if the input parameters are null. Is there a way to overcome this problem without writing all the 2 ^ 5 combinations?
    Any help is greatly appreciated.

    here it is in the Tomer Cohen way:
    IF (P1 is not null) THEN
    dynamic_query := dynamic_query || ' AND column1 = :1';
    ELSE
    dynamic_query := dynamic_query || ' AND  :1 IS NULL';
    END IF;
    IF (P2 is not null) THEN
    dynamic_query := dynamic_query || ' AND column2 = :2';
    ELSE
    dynamic_query := dynamic_query || ' AND  :2 IS NULL';
    END IF;
    IF (P3 is not null) THEN
    dynamic_query := dynamic_query || ' AND column3 = :3';
    ELSE
    dynamic_query := dynamic_query || ' AND  :3 IS NULL';
    END IF;
    IF (P4 is not null) THEN
    dynamic_query := dynamic_query || ' AND column4 = :4';
    ELSE
    dynamic_query := dynamic_query || ' AND  :4 IS NULL';
    END IF;
    IF (P5 is not null) THEN
    dynamic_query := dynamic_query || ' AND column5 = :5';
    ELSE
    dynamic_query := dynamic_query || ' AND -1 = :5';
    END IF;
    OPEN CUR_OUT FOR dynamic_query USING P1, P2, P3, P4, P5;Amiel Davis

  • Bind variables and Dynamic sql

    I have this function which works only when i'm not passing bind variables. The moment i add bind variables it is not able to execute the function.
    Oracle Db Version: 8.1
    Thanks
    Source Code
    FUNCTION TestFunction( In_Test_id in Number,
    In_Asof in Date )
    Return ScoreType
    IS
    LvScore ABC.LV_SCORE.SCORE%TYPE;
    DVScore ABC.LV_SCORE.SCORE%TYPE;
    Begin
    EXECUTE IMMEDIATE
    'SELECT SCORE,DVSCORE
    FROM
    SELECT SCORE,DVSCORE
    DENSE_RANK() OVER (PARTITION BY TEST_ID ORDER BY ASOF_DT DESC) AS score_RANK
    FROM ABC.LV_SCORE
    WHERE TEST_ID = :x
    AND ASOF_DT <= :y
    ) WHERE score_RANK = 1'
    INTO LvScore,DVScore
    USING In_tEST_ID,In_Asof;
    Return ScoreType( LvScore,
    DVScore);
    End;

    It just keeps on executing for sometime and then disconnects itself from database What was the indication that told you that it disconnected? Was there a visible indication of this disconnect?
    Did you get ORA-03113?
    ===========================================
    ORA-03113: end-of-file on communication channel
    Cause: The connection between Client and Server process was broken.
    Action: There was a communication error that requires further investigation. First, check for network problems and review the SQL*Net setup. Also, look in the alert.log file for any errors. Finally, test to see whether the server process is dead and whether a trace file was generated at failure time.

  • Using bind variable in dynamic where clause and concatenate with query

    Hi,
    In my procedure i am framing where clause dynamically with bind variable,When i am concatenate this with my sql query for REF CURSOR i got sql command not properly ended exception.
    Is it possible to pass values to the bind variable through the dynamic variable/value?
    Please advise
    Thanks in advance
    Siva
    IF in_applicationId IS NOT NULL THEN
              optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
         END IF;
    My query is like this
    open Out_Main FOR SelectQuery USING optional_using

    Thanks for reply,
    In my procedure, i suppose to frame the where clause with bind dynamically according to the input parameters. so that i am framing the values of the bind variables also dynamically like this,
    Please advise...
    IF in_assignedAppFlag IS NOT NULL THEN
              IF in_assignedAppFlag = 'Y' THEN
                   optional_where := optional_where || ' AND b.ASSIGNED_TO = :b' ;
              optional_using := ' in_appFuncGroup'||',in_currentUserID';          
              ELSe
                   IF in_isSupervisor = 0 THEN
                        optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
              optional_using := ' in_appFuncGroup'||',in_currentUserID';
                   END IF;
              END IF;
         ELSE
              IF in_isSupervisor = 0 THEN
                   optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
                   optional_using := ' in_appFuncGroup'||',in_currentUserID';
              END IF;
         END IF;
         IF in_appFuncGroup IS NOT NULL THEN
              optional_where := optional_where || ' AND e.APP_FUNC_GROUP= :c';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup';
         END IF;
         IF in_queue_id IS NOT NULL THEN
              optional_where := optional_where || ' AND b.QUEUE_ID = :d';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id';
         END IF;
         IF in_applicationId IS NOT NULL THEN
              optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
         END IF;
         IF in_sourceCode IS NOT NULL THEN
              optional_where := optional_where || ' AND e.APP_SOURCE_CODE like '||':f%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode';
         END IF;
         IF in_logo IS NOT NULL THEN
              optional_where := optional_where || ' AND appProds.PRODUCT_TYPE like '||':g%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo';
         END IF;
         IF in_firstName IS NOT NULL THEN
              optional_where := optional_where || ' AND upper(a.FIRST_NAME) like upper(:h%)';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName';
         END IF;
         IF in_surName IS NOT NULL THEN
              optional_where := optional_where || ' AND upper(a.SURNAME) like upper(:i%)';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName';
         END IF;
         IF in_retreival_id IS NOT NULL THEN
              optional_where := optional_where || ' AND e.RETREIVAL_ID like :j%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName'||',in_retreival_id';
         END IF;

  • How to update bind variable and restrict values in a Model Driven LOV?

    Hi Guys,
    Using JDev 11.1.1.2.0
    I've recreated an excellent Frank Nimphius article about restricting values derived from a model driven LOV (http://www.oracle.com/technetwork/developer-tools/adf/learnmore/44-restrict-lov-169186.pdf)
    But my bind variable isn't updating. Deleting the bind variable gets me the entire LOV. Activate the code below and insert a bind variable into the where clause like Frank says and I get nothing back. Bind variable is blank. Any ideas? Code wasn't supplied with the article. It seems simple enough but the bind variable isn't updating in the SQL, even though the updated value shows up here...
      public void onLovLaunch(LaunchPopupEvent launchPopupEvent)
        BindingContext bctx = BindingContext.getCurrent();
        BindingContainer bindings = bctx.getCurrentBindingsEntry();
        FacesCtrlLOVBinding lov = (FacesCtrlLOVBinding)bindings.get("DepartmentId");
        lov.getListIterBinding().getViewObject().setNamedWhereClauseParam("deptId","60");
        System.out.println("lov name: " + lov.getName().toString());
        System.out.println("lov Param Attrs: " + lov.getListIterBinding().getViewObject().getNamedWhereClauseParams().getAttribute("deptId").toString());
        System.out.println("lov View Object: " + lov.getListIterBinding().getViewObject().getName().toString());
        System.out.println("lov IterBinding: " + lov.getListIterBinding().getName().toString());
       }Gets me ...
    lov name: DepartmentId
    lov Param Attrs: 60
    lov View Object: _LOCAL_VIEW_USAGE_lov_model_queries_EmployeesView_DepartmentsView
    lov IterBinding: DepartmentIdList_2

    That's a good idea, but it's still not working. Here is how I implemented it. It might be different from your suggestion as I'm still pretty new to this.
    I have a recursive tree table. You select a node. You then click a button which calls the listener below. "findParents" is a method call to the AppModuleImpl class and it finds all parent nodes of your selection. "restrictPartBomLOV", also of the AppModuleImpl class, then modifies the model driven lists' View Object (partBomLOV) to exclude those parent node values.
    The resulting model driven LOV on the popup should be updated, yeah? But it still isn't udpating. If I manually type in the updated Where clause in PartBomLOV.xml query tab, it works, but it doesn't programmatically.
      public void insertPopupFetchListener(PopupFetchEvent popupFetchEvent)
        BindingContainer bindings = getBindings();
        OperationBinding operationBinding = bindings.getOperationBinding("findParents");
        parents = (List)operationBinding.execute();
        operationBinding = bindings.getOperationBinding("restrictPartBomLOV");
        operationBinding.execute();
       public void restrictPartBomLOV(List parents)
          ViewObjectImpl vo = getPartBomLOV();
          String wcl = "";
          Object[]   p = parents.toArray();
          for(int i = 0; i < p.length; i++)
             if (i == 0)
                wcl = wcl + "PNUM <> '" + p.toString() + "'";
    else
    wcl = wcl + "AND PNUM <> '" + p[i].toString() + "'";
    vo.setWhereClause(wcl);
    System.out.println(vo.getWhereClause().toString());
    vo.executeQuery();
    Edited by: LovettWB on Nov 11, 2010 11:23 PM

  • Can Oracle convert literals to bind variables?

    Good morning everyone.
    I have a procedure similar to this in our database:
        FUNCTION Get_Tag_Element_Id_For_Set(Element_Attr_Id_Table_In   in    ATTRIBUTE_TABLE_ID_TAB) RETURN NUMBER IS
          v_Select_Statement                    VARCHAR2(32767);
          v_Element_Id                             ELEMENT.Element_Id%TYPE;
        BEGIN
          FOR I IN 1..Element_Attr_Id_Table_In.COUNT LOOP
            IF v_Select_Statement IS NULL THEN
              v_Select_Statement := 'SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Element_Attribute_Id = ' || Element_Attr_Id_Tab_In(i);
            ELSE
              v_Select_Statement := v_Select_Statement || ' intersect ' ||
                                    'SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Element_Attribute_Id = ' || Element_Attr_Id_Table_In(i);
            END IF;
          END LOOP;
          EXECUTE IMMEDIATE v_Select_Statement INTO v_Element_id;
          RETURN v_Element_Id;
        END;What this does is to create a query similar to this:
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 1 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 2 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 3 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 4 intersect
    SELECT distinct Element_Id FROM ELEMENT_ATTRIBUTE_MANY_2_MANY WHERE Tag_Element_Attribute_Id = 5;
    I am using Dynamic SQL because the number of intersect pieces can vary from 1 to 15 and in the future it can grow.
    The problem that I have is that because the literals are part of the string, the query is being hard parsed every single time. In our production environment this means 100s of thousands of times per day which according to our DBA has added 15% plus to our average load. I know that I can come up with a rewrite to avoid this, but I was wondering if there is a parameter I can set at the session or at the database level where the database itself can convert this kind of query into one with bind variables.
    Thanks,
    Tom
    Edited by: Thomas Morgan on May 3, 2013 8:21 PM

    Thomas Morgan wrote:
    Basically I have an XML document.
    The document has ELEMENTS.
    ELEMENTS can have attributes.
    There is a many to many relationship between ELEMENT and ATTRIBUTES so I have a XREF table to represent this relationship.
    When I receive a new document, I need to determine if a group of ATTRIBUTES already exist together in the XREF table so I have to find their common ELEMENT_ID or NULL in which case I would create a new ELEMENT and associate the new set of attributes to the new ELEMENT.
    Since the number of attributes can vary from 1 to around 15 for now, I had to dynamically build the query that find the common ID(intersect) if it exists.
    Here is some DDL and inserts:
    CREATE TABLE ELEMENT(ELEMENT_ID NUMBER NOT NULL);
    CREATE TABLE ELEMENT_ELEMENT_ATTRIBUTE_XREF(Element_Id NUMBER NOT NULL, Element_Attribute_Id NUMBER NOT NULL);
    ALTER TABLE ELEMENT_ELEMENT_ATTRIBUTE_XREF ADD CONSTRAINT ELEMENT_ATTR_MANY_2_MANY_PK PRIMARY KEY(Element_Id, Element_Attribute_Id);
    ALTER TABLE ELEMENT ADD CONSTRAINT ELEMENT_PK PRIMARY KEY(Element_Id);
    INSERT INTO ELEMENT VALUES(1);
    INSERT INTO ELEMENT VALUES(2);
    INSERT INTO ELEMENT VALUES(3);
    INSERT INTO ELEMENT VALUES(4);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(1, 1);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(1, 2);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(2, 1);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 1);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 3);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 4);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(3, 5);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(4, 6);
    INSERT INTO ELEMENT_ELEMENT_ATTRIBUTE_XREF VALUES(4, 7);
    So for instance if I passed an array (Attribute ID Tab) containing ELEMENT_ATTRIBUTE_ID list 6 and 7 I would get 4 as the answer.
    Hope this helps,
    Thanks,
    TomAwesome, thanks!
    I'm not sure this works 100% for what you need, but I thought I'd give it a shot. I've used a built in array (sys.odcinumberlist) that you should have access to on your installation (assuming you have a relatively recent version of Oracle).
    I left out the part where you would loop through the array you are currently passing in to your procedure to build up this new array that you can use in a SQL statement.
    Cheers,
    create or replace procedure maybe_this
       in_list           sys.odcinumberlist
    is
       l_commonality     number;
    begin
       begin
          select
             distinct
                xref.element_id
          into
             l_commonality
          from
                table(cast(in_list as sys.odcinumberlist))  list
            ,  element_element_attribute_xref   xref
          where
             xref.element_attribute_id = list.column_value;
          dbms_output.put_line('match on element_id = ' || l_commonality);
       exception
          when too_many_rows or no_data_found
          then
             dbms_output.put_line('no match');
       end;
    end;
    ME_TUBBZ?exec maybe_this(sys.odcinumberlist(1,2));
    no match
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    ME_TUBBZ?exec maybe_this(sys.odcinumberlist(6,7));
    match on element_id = 4
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01

  • Null check for a bind variable in view criteria

    Hi, Greetings.
    I am using Jdeveloper 11.1.2.0.
    I have a view object, LocationsView, for locations table of the XE database.
    I want to apply a condition, ((:bind_var is null) or (:bind_var is not null and location_id = :bind_var), in this LocationsView.
    That is, I want to apply the condition only if the bind variable value is not null.
    How can I construct this condition using a declarative view criteria?
    Any help and hints on this regard is greatly appreciated.
    Regards,
    Guru K

    Hi,
    Thanks for the update and it is working perfectly fine.
    Now, how can I set the "ignore null values" option as checked if I am constructing the criteria programmatically using view criteria row and view criteria item at runtime.
    Thanks and regards,
    Guru K

  • How do I use the Session State to manage bind variables & download xml data

    I have a Report Query with more than 30 queries; many have bind variables in them. I'd like to create sample xml so that I can develop my word templates. When I try to download the XML data Source for Layout, it doesn't ask for the bind variable values.
    How can I download the XML data without replacing the bind variable values in each of the queries?
    Thank you.

    If you are using the Standalone version, then first of all make sure to UNCHECK (BIP10g 10.1.3.4.1)
    "AUTO RUN" (it is under General Settings when you select your Report Definition)
    Next, you should define the parameters in the corresponding parameter Section.
    Its simplest form is of "Text" type so you will have to enter values at runtime.
    Then these parameters can be used in your query as bind variables.
    When you run the report it will prompt for parameter values. Enter these values
    and you would get a sample of your XML data.
    This should work and you should not find any issues.
    regards
    Jorge

  • Bind variable is not defined

    Hi, it is my first attempt to modify a rdf file.
    I run into a problem while trying to add an additional user parameter in an existing rdf file. While I am successful in adding a new FREQUENCY user parameter and I am able to update the form to show this new parameter, I am not able to run the report.
    I have updated the SQL query in the report editor, under data view to use this new parameter :FREQUENCY. (select ... from table where frequency= :FREQUENCY) There was no error here.
    Whenever I run the report, I will always get an error saying:
              "REP-0730: The following bind variable is not defined: "(nothing behind this                                                             error message)
    The program will have a memory error and it exits itself.
    I had tried many methods trying to solve this problem to no avail.
    I am using Oracle 9i Reports Builder 9.0.2.0.3.
    I would appreciate any help given on this matter.
    Thank you :)
    Message was edited by:
    Leion

    In Object Navigator Under Layout ->User parameters are you able to see your bind variable FREQUENCY?

  • How to get binding variables from request

    We are trying to use html-db to develop an application which need to get values from user request to use in the queries, i.e. we will have pages depend on several binding variables and the value of these variables will be provided by the user through get/post request. Because the request will be initialed by another application so to use a form to collect the values is not an option.
    I am a html-db newbie. Does anyone here know how to do that?

    you're right in thinking this is a bit of a newbie html db question. it's a pretty straightforward matter to set up a report in html db that runs off of bind variables that can be set from a URL. you can see a pretty simple example on the first page of our "Sample Application" that's available to install into your workspace. try taking a look at that to see what i mean. you can install the Sample Application by clicking the "Review Demonstration Applications" link that's available right after logging into htmldb.oracle.com. that resulting screen lets you create (or re-create) the Sample App in your workspace. once it's installed, take a look at how the report on page 1 calls the first report on page 201. that report on 201 is dependent on a bind variable, :P202_CATEGORY, that's set from the URL. this particular URL is generated from the report on page 1, but it could just as easily have been generated from your other application. when you look at this example, the two key points to pay attention to are the 1) syntax used in the URL to set the bind variable (which is explained in our online help at http://htmldb.oracle.com/i/doc/mvl_fund005.htm#sthref357) and 2)the way in which that bind variable is referenced in the first sql query region on page 201. take a look at those when you get a chance, and let us know if you have further questions.
    thanks,
    raj

  • Can viewObject get a parameter from sessionScope to binding variable?

    hello,
    using Jdev11g ADF Fusion application
    Can viewObject get a parameter from sessionScope and assign into binding variable ? without using executeWithParameter
    Thanks
    greenApple

    A. Safwat,
    As I said before, I was not trying to be offensive, but simply to explain some of the shortcomings of one solution over another. One of the reasons people give such short answers is that many questions (including this one) have been asked and answered many many many times before on the forum. As to my reasons:
    1). Overkill - overkill because you are writing code to do what the framework already provides for you.
    2). Not bind-variable friendly - you are gluing in literals into a SQL statement. That means that Oracle will have to hard parse the query for each new value of the filter clause, yielding to poor performance, particularly in a multiuser environment. It should ideally be done using bind variables.
    3). Insecure (think about what happens if you put "'xyz' or 1=1" into the filterValue there) - not using bind variables is a security hole. Think through what happens if a filter criteria comes through like the one I mentioned.
    4). Inflexible - because you are overriding executeQueryForCollection, this VO becomes inflexible and can only be used in this particular place. Using the declarative approach outlined by Timo is more flexible
    5). Bad (ok, that's my opinion there) - OK, perhaps this was a bit offensive ;)
    Please don't take a critique of a post as offensive, as I assure you it was not intended to be in that spirit. As I mentioned, I greatly appreciate when people point out issues/problems/etc with my ideas, as that is the best way for me to learn. I have in the past written applications that were not bind-variable friendly, and I learned the downsides the hard way (system was horribly non-performant) - I wish someone had reviewed my approach and told me "bad idea" before the application made it into production.
    Respectfully,
    John

  • Apex listener installed no test and set bind variables buttons

    I have installed Apex listener and while creating restful service module i dont see test and set bind variables buttons in the source region.
    I went through the many posts. Installed apex listener successfully.
    getting http://localhost:8080/ords/ started message when i start the listener.
    and using Apex URL as http://localhost:7780/pls/htmldb.
    What are the possibilities for this issues?
    Please help me on this.
    Thanks
    Chandran

    Apex listener version is 2.0.9
    Apex version is 4.2

  • Report Using Bind Variables

    Hey Everyone,
    I'm having a bit of trouble creating a report. I need the FROM part of the code to use bind variables. I have come up with this peice of code below but im getting the following error:
    failed to parse SQL query:
    ORA-06550: line 1, column 8:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
    begin function package pragma procedure subtype type use
    form
    current cursor
    The symbol "" was ignored.
    ORA-06550: line 2, column 24:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
    begin function package pragma procedure subtype type use
    form
    current
    Can anyone see where im going wrong?
    Thanks in advance,
    -N.S.N.O.
    Code*
    DECLARE
    x VARCHAR2 (4000);
    BEGIN
    x := x || 'select *';
    x := x || 'from ';
    x := x || :p13_schema;
    x := x || '.ddl_log@';
    x := x || :p13_db_name;
    x := x || '_DBAAPEX.TNTEWW.COM';
    RETURN (x);
    END;

    Hey Roel and Daylocks,
    After getting frustrated for a while i deleted the page and started again. I put in the exact same code and it worked just how i wanted in the first place :S
    The only thing i did different is when i was creating the report region the first time around i used a normal SQL query, For Example:
    select sysdate from dual;
    Then i modified it to
    DECLARE
    x VARCHAR2 (4000);
    BEGIN
    x := x || 'select ';*
    x := x || 'from ';
    x := x || :p14_schema;
    x := x || '.ddl_log@';
    x := x || :p14_db_name;
    x := x || '_DBAAPEX.TNTEWW.COM';
    RETURN (x);
    END;
    Whereas on the second attempt i used the peice of code in question straight away. Its been a bit of a frustrating morning because i used a similar peice of code for a different application, nevermind tho :)
    Thanks for your replys, much appreciated.
    -N.S.N.O.

Maybe you are looking for