Use of bind variable in repository
All,
Our customer has a requirement that they need This year sales Vs Last year Sales by passing the year as a prompt.
I can not use BI built in function to get Last year start or this year start date as our calendar dates are not standard. So i have to query date dim table to see for ex. for 2010 whats is the start date and so on...
For this I have created a repository variables to hold these values using a SQL. What I would like to know is can I use a bind variable to this SQL so that when user passes year i can feed that year to this SQL and it will provide me correct start and end date for this year and last year.
Many thanks in advance
Yes. We can pass a value what user is selecting from the prompt. For doing that you have create a session variable with "Enable any User to set Value". So in prompt properties for the year column select "Request Variable" for Set a Variable. Then in the content filter use year = 'valueof(NQ_SESSION.myVariable).
Let me know if this worked.
Regards,
Jay
Similar Messages
-
How to use the bind variable in custom.pll
Hi,
How to use the bind variable in custom.pll.Its through error.
any one gem me.
very urgent.
M.Soundrapandian.Hello,
Please, ask this kind of questions in the e-business forum.
Francois -
How to use a bind variable in an IN clause
I am trying to use a bind variable in an IN clause where the column is a varchar2 type. Something like:
select *
from test
where test_column in (:bindVariable)I have tried assigning the bind variable comma separated strings (eg. test,test,test) and comma separated strings with quotes (eg. 'test','test','test'). Neither of these work. Does anyone know the correct way to do this?
Thanks in advance.http://tkyte.blogspot.com/2006/06/varying-in-lists.html
Presents many options. -
How to use a bind variable in a table-validated flexfield
Hi,
I want to prepare a table-validated descriptive flexfield, which uses as source a select statement.
So, in the form "Validation table information" I use as table name the statement:
(SELECT my_procedure('test_value') FROM DUAL)
Up to here it works fine.
But instead of 'test_value' I want to use the value of a field in the form or a value of another flex (using $FLEX$ bind variables).
Please advice if it is possible to perform this in "table name" statement. I use it in "where/order by" clauses and it works fine.
Thank you.Hi,
I have posted in the place where you did advise,
https://forums.oracle.com/thread/2560192
but they reply there that this is an EBS question, with no much relation to dev tools in general.
Please, can I continue in this place with this question?
Thank you. -
How to find out if a SQL is using a bind variable or not?
In order to make a SQL use consistent execution plan, I want to create a profile for a SQL. But I need to know if a SQL is using bind variable or not to create a profile for all the same SQLs except the literal value. How can I do that?
Thanks in advanceYou can tell if an SQL statement uses a bind variable by looking at the SQL statement.
If you look in the program that submits the SQL statement you can see how it constructs, prepares, and executes the statement.
If you are just looking at the SQL in the shared pool then depending on how the statement is written and the setting of database parameters like cursor sharing then it can be more difficult but if you see a constant (actual value) that is a constant. A bind variable would appear as a name in the where clause where that name does not exist any of the tables referenced in the query. Note it is technically possible to create pl/sql variables with the same name as columns in the query but that is poor coding and leads to issues.
Note - To Oracle two versions of the otherwise same query where one has a constant and the other has a bind variable are not the same query and often produce different plans. This is a common error made by developers new to Oracle when using explain plan. To explain a query that uses bind variables place a ":" in front of the variable name in the SQL submitted to explain plan.
HTH -- Mark D Powell -- -
Functionality loss when 'Using Query Bind Variables in Advanced Search
Regarding: 'Using Query Bind Variables in Quick or Advanced Search'
The functionality to do the following is lost when I use bind variables in the Advanced Search:
"Result matches all conditions"
"Result matches any condition"
"Case Sensitive?"
Is there a way to Search with Detail groups but to keep the above functionality?Hi,
Your application module impl java class extends the JHeadstart class JhsApplicationModuleImpl. THe latter declares a method:
public void advancedSearch(String viewObjectUsage,java.util.ArrayList arguments,Boolean allConditionsMet).
In your application module impl java override the advancedSearch method where you can include your own custom code before invoking the super method:
super.advancedSearch(viewObjectUsage,arguments,allConditionsMet);
The 'arguments' parameter is an arraylist of QueryCondition objects. You can set several properties for QueryCondition objects such as case-sensitity, operators etc.
Regards,
Ibrahim -
How to use a bind variable in XE for accessing data from different sources
Hi,
I am new to XE and trying to create an application like this:
(region source)
Select * from v$session@:P1_DATABASE ;
My intention is to give the name of the database at runtime to fetch the relevant data.
But I am getting error like this
1 error has occurred
Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-01729: database link name expected
Doesn't work even when I check the "Generic Columns" and run the query at the run time (same error).
Can some one please help!
Regards,
Santosh LokeHi,
There are rules using names in SQL. I think you could use dynamic SQL to achieve the goal in your case. It is not clear for me what are you going to do. Moreover bind variable are difficult to use some times.
You could start with something simple as a report and a form.
Konstantin -
Use of Bind Variable in the Query of view object giving null pointer excep
I am using this code in the backing bean of my page to set the value of the bind variable 'cmdID' in the view object.
String AM = "model.UnixCommandsAppMod";
String CF = "UnixCommandsAppModLocal";
ApplicationModule am = Configuration.createRootApplicationModule(AM, CF);
ViewObject vo = am.findViewObject("Command_options_view");
vo.setNamedWhereClauseParam("cmdID", 1);
vo.executeQuery();
On the fifth line it is giving NullPointer exception.
I am not being able to figure out the reason.User,
a). Don't keep posting new questions in the same thread. It really does decrease the usability of the forum. Now, if someone searches for "INFO: ADF Faces is running with time-stamp checking enabled," they will find a post about null pointer exception in a bind variable and think, "oh, that doesn't apply to me." If your question is answered, mark the answer as correct. New questions go into a new thread. Kind of funny that the thread I pointed you to with the answer to your question also has this same admonishment.. ;)
b). I'll relent and answer your new question. Ignore that INFO message. It is not an error. It will ALWAYS ALWAYS appear when you run your application in the embedded OC4J with JDeveloper. Had you searched the forum for "INFO: ADF Faces is running with time-stamp checking enabled" you would find that the first hit (among some others) has this same answer
John -
Using collections / Bind variables with a PL/SQL functio returning a query
I have this code, which is supposed to assign collection variables as column names
FOR i in 1 .. Collection_count -1
LOOP
SELECT c002 into :P341_M1 FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=i;
SELECT c002 into varholder FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=i;
vQuery:= vQuery || 'SUM(decode(label, ''Aware'', product_'|| i || ', ''Expert'', product_' || i || ', ''Proficient'', product_' || i || ', ''Advanced(Demo)'', product_' || i || ' )) as ';
vQuery:=vQuery || varholder || ', ' ;
END LOOP;
I've tried &P341_M1. , :P341_M1, ':P341_M1', varholder
When I try '&P341_M1' it returns the whole SUM(decode... line as the label
Basically Im having a hard time using bind variables with the PL/SQL returning a query...anybody?Ok so working through this problem more I have realized that the problem is using the for loop i as an index value
This will get a value:
SELECT c002 into :P341_M1 FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=2;
But this won't
SELECT c002 into :P341_M1 FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=i;
I'm in the for loop, and use the i variable in other places within this loop...Is there a reason why I can't compare seq_id to i?
My new code as follows:
FOR i in 1 .. Collection_count -1 --apex_application.g_f01.COUNT - 1
LOOP
varholder:=i;
SELECT c002 into :P341_M1 FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=2;
SELECT c002 into varholder FROM APEX_collections WHERE collection_name = 'MA_SKILLS' AND seq_id=4;
vQuery:= vQuery || 'SUM(decode(label, ''Aware'', product_'|| i || ', ''Expert'', product_' || i || ', ''Proficient'', product_' || i || ', ''Advanced(Demo)'', product_' || i || ' )) as f';
vQuery:=vQuery || :P341_M1 ||i||', ' ;
END LOOP; -
Use of Bind variables on Transparent Gateway
Are there any known issues of using bind variables with queries using the Transparent Gateway? I've included two queries that access data from V_PERSON (alias r) which is a SQL Server 2000 table. We're using TG for MSQL 9.0.1 and calling from an Oracle 8.1.7.4 database.
All help appreciated.
- Scott
SELECT r.lastname,r.email_addr1,MGM_.PHONESTR (r.hmph_ac,r.hmph_number, r.hmph_xten,r.hmph_input),r.hmph_ac,r.hmph_number,r.hmph_xten,r.maiden_name
FROM V_PERSON r WHERE r.vmn_person_id=184468;
213 msecs
SELECT r.lastname,r.email_addr1,MGM_.PHONESTR (r.hmph_ac,r.hmph_number, r.hmph_xten,r.hmph_input),r.hmph_ac,r.hmph_number,r.hmph_xten,r.maiden_name
FROM V_PERSON r WHERE r.vmn_person_id=:1;
:1 = 184468
23 secsScott,
We are not aware of any issues with bind variables. The time is takes to execute the query depends on the query that is sent over to the non-Oracle system. -
Use of bind variables with the oracle db - to improve library cache perform
Dear Friends,
We are using oracle 9.0.1.1.1 db server - the performance of the db was pathetic and upon investigation it was revealed that the library cache was over loaded with sql hard parses generated by not using bind variables. We are using vb as a front end with oracle and our connection object in vb is created using ole db for oracle provided by oracle (installed from oracle client custom - programmer option).
I would appreciate if any body can tell how can we use bind variables in vb to connect to oracle such that the hard parses can be changed into soft parses.
Your effort to bring some peace in my life is worth comendable and I would be very obliged for your time and help.
Thanks a lot.
Bye
Take care.
qjGenerally, you would use bind variables by changing statements that are written like this
select * from emp where empno=6678 and ename='Jones'
so that they're written like
select * from emp where empno=? and ename=?
How you then bind these question marks to the particular values you want depends on the API you're using (ADO? OLE DB directly?, etc). If you have a support contract, there are plenty of examples for any API on metalink.oracle.com
Justin -
Use of bind variables in 'IN' operator
how to use bind variable in the select stmt with 'in' operator?. like
select * from table_name where col in (:id_list);
I know we could use it for single value but how do i use bind variable for a list of values
ThanksThe IN clause and Stored Procs
-
Problem Using a Bind Variable on a SelectOneChoice List VO
Hi everyone,
I have a List View Object on my application that contains the lookup values for some combos. The underlying table has three columns: LOOKUP_TYPE, LOOKUP_CODE and DESCRIPTION. It is used like this: when i want to find out which are the possible values for the "Customer Status" field on a form, i need to execute this VO with LOOKUP_TYPE = "CUST_STATUS". when i want to find the Supplier status, i execute it with "SUPP_STATUS". Then i compare the value of LOOKUP_CODE with the customer_status or supplier_status codes to get its description.
The problem is, i have to use this VO as the Dynamic List of values for a SelectOneChoice. I have correctly mapped it, but the VO query is like this:
SELECT lookup_code, description FROM tab_lookup_codes WHERE lookup_type = :lkpType
So i need to set the bind variable dinamically, as i would do with ExecuteWithParams, but for a SelectOneChoice list. How can i do such thing? is there a way to define a value for this parameter before ADF executes the List VO on the page definition, or even programatically?
If you didn't understand my requirement, please let me know.
Thank you very much for your time!
Thiago SouzaHi Thiago,
If i understand you problem you can try to insert a invokeAction to your page definition with refresh property equals prepareModel that call a method that sets your Where param propertly. In this way your method will be executed before prepareModel.
I haven't test this, its only a possible idea.
Best Regards
Hi everyone,
I have a List View Object on my application that
contains the lookup values for some combos. The
underlying table has three columns: LOOKUP_TYPE,
LOOKUP_CODE and DESCRIPTION. It is used like this:
when i want to find out which are the possible values
for the "Customer Status" field on a form, i need to
execute this VO with LOOKUP_TYPE = "CUST_STATUS".
when i want to find the Supplier status, i execute it
with "SUPP_STATUS". Then i compare the value of
LOOKUP_CODE with the customer_status or
supplier_status codes to get its description.
The problem is, i have to use this VO as the Dynamic
List of values for a SelectOneChoice. I have
correctly mapped it, but the VO query is like this:
SELECT lookup_code, description FROM tab_lookup_codes
WHERE lookup_type = :lkpType
So i need to set the bind variable dinamically, as i
would do with ExecuteWithParams, but for a
SelectOneChoice list. How can i do such thing? is
there a way to define a value for this parameter
before ADF executes the List VO on the page
definition, or even programatically?
If you didn't understand my requirement, please let
me know.
Thank you very much for your time!
Thiago Souza -
Using a Bind Variable in the FROM part of a SQL Statement?
Hello Everyone,
I have a problem, I am trying to run an SQL statement. However I need the FROM part of the SQL statement to be a bind variable. This is because the end user will need to select between 2 database views.
I have tried this:
select CON_ID from :P23_DB_NAME where CON_LEGACY_ID=:P23_CONLEG_NO
I had no luck. The error i got was,
"+Query cannot be parsed within the Builder. If you believe your query is
syntactically correct, check the ''generic columns'' checkbox below the
region source to proceed without parsing.
ORA-00903: invalid table name+"
Which makes sence, but now I am a bit stuck.
Does anyone have any ideas as to get around this problem?
Thanks in Advance.
-N.S.N.O.The example I gave you is quite simple. You need to take some time to study it to see where you need be carefull what you put where. Now, your example of course doesn't work becaues you have several errors. This will work for you:
DECLARE
x VARCHAR2 (4000);
BEGIN
x := x || 'SELECT CON_ID FROM ';
x := x || :p23_db_name;
x := x || ' WHERE CON_LEGACY_ID = ' || :p23_conleg_no;
RETURN (x);
END;Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Using same bind variable multiple times in Dynamic sql
Hi;
I have a query which uses same variable multiple times, is there a way I could use only one time that variable and it will take multiple times.
Query is;
execute immediate 'SELECT count(*) FROM x WHERE MONTH_ID = :VOMNTH_ID
UNION
SELECT count(*) FROM Y WHERE MONTH_ID = :VOMNTH_ID
union
SELECT count(*) FROM z WHERE MONTH_ID = :VOMNTH_ID ' using month1,month1,month1
What I want Just supply month1 only once.
Your help is appreciated.
VKMthe way suggested by Nigel worksI'm not sure what you intend to use the resultset for but remember that UNION will remove duplicates from the result set and could possibly sort it too. Even if that were not the case (for example if you used UNION ALL) Oracle does not specifically guarantee the order of resultsets.
If you are expecting the first row to contain the first count (and so on) then you might not get the answer you are expecting.
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> SELECT 3 n
2 FROM dual
3 UNION
4 SELECT 2 n
5 FROM dual
6 UNION
7 SELECT 1 n
8 FROM dual;
N
1
2
3
SQL> SELECT 1 n
2 FROM dual
3 UNION
4 SELECT 2 n
5 FROM dual
6 UNION
7 SELECT 2 n
8 FROM dual;
N
1
2
SQL>
Maybe you are looking for
-
Search Not Working for Several Users
We are running GW 7.0.1, several users have lost the ability to search. GWCheck was run on the user and message database, but this did not resolve the issue. Any help would be greatly appreciated. thanks ed
-
Since the upgrade to IOS 7, I can't open PDF FILES. They download all right, but I only see like a pic. I can't open, can't save to pdf, can't see it. Can't nothing. Any help?
-
Trouble with Databases and putting data into them
I have been working on this application for about three days and choose the tool because I thought database connectivity was super simple. Provided I didn't need to anything but get data or add data I could use the WYSIWG editor to drag and drop item
-
Error whilst trying to Sync a new iPod
I have put all my audio books, teachings and prayers on the new iPod but it was getting low on space an now it won't sync with an unknown error 13019? Does anybody know what this means and how to get around it? Thanks Batch108
-
The new updates sound great. Anyone got any documentation on the "Provides new capability with PT Bridge to connect real network equipment to the Packet Tracer environment" bit? Rich