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.
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 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 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 -
How to use a lexical variable in a WHERE clause and as a function argument.
Hello,
My report has a lexical variable which has values like 'and id in (1,3,4)'. I want to use this variable in two separate queries. In the first, it is used in the WHERE clause, something like:
.. where date is not null &var;
In the second query, the variable is used in a function call, something like:
select * from table (my_function(&var));
The trouble is that the first query works when the value of the variable is unquoted, but for the second query the value should be quoted.
Does anyone have an idea how I could solve this problem?
Thanks in advance,
Frans
Message was edited by:
fransiehttp://tkyte.blogspot.com/2006/06/varying-in-lists.html
Presents many options. -
How to properly set bind variables
Dear All,
I am currently confused about how to properly set my Bind Variables
I have this view using HR standard schema
Select *
from Employees
where EMPLOYEE_ID = :EMP_IDI somehow see three options on how to use this bind variable in an application module.
Option 1:
ViewObjectImpl view = this.getEmployeesView();
VariableValueManager vm = view.ensureVariableManager();
vm.setVariableValue("EMP_ID", value);
view.executeQuery();Option 2:
ViewObjectImpl view = this.getEmployeesView();
view.setNamedWhereClauseParam("EMP_ID", value);
view.executeQuery();Option 3:
EmployeeViewImpl empView =this.getEmployeesView();
RowSetIterator it = empView.createRowSetIterator(null);
empView.setEmployeeId(value);
empView.executeQuery();Question is which is which and what should I use?
JDEV 11G PS3I use is this
DCIteratorBinding iteratorStatus = Util.getIterator("NameIterator");
operationBinding.execute();
Util is reserved in a class.
public static DCIteratorBinding getIterator(String iteratorName){
return getDCBindings().findIteratorBinding(iteratorName);
} -
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 -- -
How to have the BIND variables value using the TKPROF utility.
WE have a JAVA application and Oracle 9i database.We need to figure out what all select/update/insert sql staements are firing if i am doing one complete processing in my JAVA front application.
Initally I have planned for using TKPROF utility after makeing AUTO_TRCE=TRUE in the database.But the problem is that all select/insert/update sql statements are using the BIND variables in the JAVA code and same is coming/printing on the trace file also.
can we print out the BIND variables values also,while making the TRACE ON?
eg: trace is generaitng the all insert statements like below.
insert into TEST(Column1,Column2) values(:1,:2);
I want to know the value of :1 and :2 bind variables.
If you have any cluse about it please let me know.
Mitesh ShahThanks Guys,
I got the BIND variable values in the TRACE file.Previously i was searching on the OUtputfile.
I am pasting the same trce file format.Can you please verify it.Is i am looking the correct file and corect location.
PARSING IN CURSOR #2 len=1571 dep=0 uid=66 oct=3 lid=66 tim=18446744071740803342 hv=1462188955 ad='123434f0'
SELECT PARENTIDKEY,CONTRACTKEY,COMPANYKEY,BACKENDKEY,DATAREP,BANKHOLDINGID,BANKID,CARRIERPARTYID,PRODUCTID,ID,PREMIUMINDEXRATE,ILLUSTRATEDMATURITYLOW,ILLUSTRATEDMATURITYHIGH,SPECIALHANDLING,CARRIERCOMMCODE,MONEYTRANSFERTYPE,FIRSTBILLSKIPMONTH,CONTESTABILITYENDDATE,DEDUCTIONDATE,MARKETVALADJUSTIND,FREEAVAILABLEAMT,ADVANCINGREJECTEDIND,RATEDIND,OTHERINSUREDIND,ENDORSEMENTIND,BENEFICIARYIND,CASECONTROLNUMBERASSUMING,OWNERLEGALNAME,STAMPDUTY,COMMISSIONANNUALIZEDIND,NONSTDCOMMTAKEN,LAPSETAXABLEGAIN,GOVTALLOTMENTSUSPENSEACCTAMT,LASTNOGOODCHECKREASON,LASTNOGOODCHECKDATE,LASTCOIDATE,LASTDEDUCTEDEXPENSECHARGES,LASTDEDUCTEDCOICHARGES,STATEMENTBASIS,LASTNOTICETYPE,LASTNOTICEDATE,PAYMENTDUEDATE,LASTBANKCHANGEDATE,EFTENDDATE,BANKBRANCHNAME,BANKNAME,PAYMENTDRAFTDAY,BANKACCTTYPE,CREDITCARDTYPE,CREDITCARDEXPDATE,ACCTHOLDERNAME,ROUTINGNUMBER,ACCOUNTNUMBER,PAYMENTMETHOD,ANNUALPAYMENTAMT,PAYMENTAMT,PAYMENTMODE,LASTCOIANNIVDATE,BILLINGSTOPDATE,BILLEDTODATE,FINALPAYMENTDATE,GRACEPERIODENDDATE,PAIDTODATE,STATUSCHANGEDATE,REINSTATEMENTDATE,TERMDATE,ISSUEDATE,EFFDATE,DOWNLOADDATE,DURATION,POLFEE,POLICYVALUE,COMMISSIONROLLOVERPCT,COMMISSIONOPTIONSELECTED,REPLACEMENTTYPE,CUSIPNUM,CONVERTTOPRIVATEIND,PORTABILITYIND,REINSURANCEIND,BILLNUMBER,JURISDICTION,ISSUETYPE,ISSUENATION,STATUSREASON,PRIORPOLICYSTATUS,POLICYSTATUS,SHORTNAME,ADMINISTERINGCARRIERCODE,PLANNAME,FILEDFORMNUMBER,FORMNO,CARRIERCODE,PRODUCTCODE,PRODUCTTYPE,LINEOFBUSINESS,CERTIFICATENO,POLNUMBER,CARRIERADMINSYSTEM FROM "POLICY" WHERE PARENTIDKEY = :1 AND CONTRACTKEY = :2 AND COMPANYKEY = :3 AND BACKENDKEY = :4
END OF STMT
PARSE #2:c=0,e=1298,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=0,tim=18446744071740803336
BINDS #2:
bind 0: dty=1 mxl=4000(4000) mal=00 scl=00 pre=00 oacflg=01 oacfl2=0 size=4000 offset=0
bfp=082a5a9c bln=4000 avl=09 flg=05
value="Holding_1"
bind 1: dty=1 mxl=4000(4000) mal=00 scl=00 pre=00 oacflg=01 oacfl2=0 size=4000 offset=0
bfp=082a4af0 bln=4000 avl=10 flg=05
value="DUL001138U"
bind 2: dty=1 mxl=4000(4000) mal=00 scl=00 pre=00 oacflg=01 oacfl2=0 size=4000 offset=0
bfp=069bb890 bln=4000 avl=02 flg=05
value="00"
bind 3: dty=1 mxl=4000(4000) mal=00 scl=00 pre=00 oacflg=01 oacfl2=0 size=4000 offset=0
bfp=069ba8e4 bln=4000 avl=04 flg=05
value="CLIF"
********************************************************************************** -
How to declare a bind variable with 'date' data type in command prompt?
how to declare a bind variable with 'date' data type in command prompt?
sql>variable q date;
when i execute it show list of datatypesHi,
As Lokanath said, there are no DATE bind variables.
You can use a VARCHAR2 bind variable, and convert it to a DATE in your SQL statment.
If you're using SQL*Plus, consider a substitution variable. It won't be as efficient as a bind variable, but it will be as convenient.
For example:
DEFINE first_entrry_date = "DATE '2010-06-20''
SELECT ...
WHERE entry_date >= &first_entry_date
{code} -
How to set the bind variable on page load and execute query ?
Hi All,
I am using Jdeveloper 11.1.1.5
I have a table called "Employee"
Columns :- id , name , location
Data :- 1, ,james , chicago
2 ,Raj ,capetown
Now i have another webservice(created as a webservice dataControl) which sends me the "id" on each time my page loads.Now the id which has been returned by webservice should be incorporated in my VO Query as in where clause to fetch the data for the respective "id" in that "Employee" table and should be rendered on form.
Eg :- Id "2" has been sent by the webservice then the record should be fetched from database should be "2","raj","capetown".
I know that there would be necessity of bind variable , but how do i set the bind variable on page load ?
How can i use the bind variable appropriately ??
Please suggest !!!!
Thanks.Hi,
Check
http://www.orastudy.com/oradoc/selfstu/fusion/web.1111/b31974/web_services.htm#CJADCDBG
http://thepeninsulasedge.com/frank_nimphius/2011/02/18/adf-code-corner-sample-73-released-hands-on-creating-a-search-form-using-a-pojo-ws-and-the-web-service-data-control/
-Suresh -
How can i create "bind variable"
How can i create "bind variable" in my DB to support any procedure in my DB.
Thank you very much.In SQL*PLUS we can defined bind variable
SQL>var x varchar2(250); -- Is x bind variable or i'm misunderstand ?
and ... in my procedure i can used ' &x ' to pass valued of 'x' from sql prompt to my procedure.
but i'm not sure variable x is still remain in DB because i need to pass variable
" v_stmt := 'and employee_id between ..... ' " from FORM to PROCEDURE in DB
how can i do -
How to use a presentation variable in filter conditions
Hi,
I have set a presentation variable "day" on my dashboard prompt containing a date column. I now need to use this presentation variable in the filter clause to restrict the dates between "day" and sysdate.
So i apply the following SQL filter:
where day between '{@variables.day}' and current_date
But I end up in getting the following error:
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1861, message: ORA-01861: literal does not match format string at OCI call OCIStmtExecute. [nQSError: 17011] SQL statement execution failed. (HY000)
I even tried casting the presentation variable to date, but to no avail. Can someone let me know how to specify the date format for the presentation variable.If you're a member of ODTUG (or even if not, you can sign up for an associate membership for free) you can download Glenn's presentation from 2009 Kaliedoscope "Little Used Features of Essbase (Like Data Mining and Triggers)" -- there is a section in that presentation on substitution variables -- he does a really good job in showing how this works.
Go to: www.odtug.com, then Tech Resources, then Essbase/Hyperion, and search for Schwartzberg. Currently it's the ninth presentation on the list -- I think this changes based on popularity of downloads.
Regards,
Cameron Lackpour -
Script logic - how to use a selection variable within an allocation logic
Hi,
I want to implement a simple top-down distribution to distribute values from a yearly budget (Y20xx.TOTAL) to a quarter budget (Q20xx.Q1, ... Q20xx.Q4) using the actuals of the previous year as reference.
If we hard code the members it works fine:
*RUNALLOCATION
*FACTOR=USING/TOTAL
*DIM ACCOUNT WHAT=ACC_NOT_ASSIGNED; WHERE=BAS(FIN); USING=<<<; TOTAL=<<<
*DIM TIME WHAT=Y2009.TOTAL; WHERE=BAS(Q2009.TOTAL); USING=BAS(Q2008.TOTAL); TOTAL=<<<
*DIM CATEGORY WHAT=SBO; WHERE=<<<; USING=ACTUAL; TOTAL=<<<
*ENDALLOCATION
Of course, we want to make this dynamic, using the values inputted in the selection screen of the package: time, entity and category.
So if we start with write the following logic, it does not work anymore:
*RUNALLOCATION
*FACTOR=USING/TOTAL
*DIM ACCOUNT WHAT=ACC_NOT_ASSIGNED; WHERE=BAS(FIN); USING=<<<; TOTAL=<<<
*DIM TIME WHAT=%TIME_DIM%; WHERE=BAS(Q2009.TOTAL); USING=BAS(Q2008.TOTAL); TOTAL=<<<
*DIM CATEGORY WHAT=%CATEGORY_DIM%; WHERE=<<<; USING=ACTUAL; TOTAL=<<<
*ENDALLOCATION
So, how to use the selection variables in this allocation logic? %TIME%, %CATEGORY% also did not work ...
regards
Dries
solved it ...
Edited by: Dries Paesmans on Feb 22, 2009 8:31 PMHi Dries,
Looks like you solved this, but if I can just add a small point -- when you use syntax like this:
*DIM ACCOUNT WHAT=ACC_NOT_ASSIGNED; WHERE=BAS(FIN);
*DIM TIME WHAT=Y2009.TOTAL; WHERE=BAS(Q2009.TOTAL);
each time the logic runs, it will scan through the dimension from the FIN and Q2009.TOTAL members, one level at a time, until it reaches the base members (where calc = 'n'). This may happen very quickly, if the dimension has very few levels, but could take a bit of extra time if it's a particularly deep dimension. (By which I mean many levels of hierarchy -- not some 1970's Pink Floyd musical reference.)
You may speed things up by using a member property instead of the BAS(xyz). Flag all the base members using a specific property value, and that way the logic engine can pick up the complete list of members in the WHERE clause, in a single query.
*DIM Account What=ACC_NOT_ASSIGNED; Where=[FloydProperty]="DarkSideOfTheMoon"; ...
This adds some maitenance work in the dimension, which may be problematic if your admins are changing it regularly (and will cause problems if they forget to update this particular property).
I can't predict how much time this will save you (maybe not much at all), but anyway I figure you'd want to know exactly what work you're asking the system to perform.
Regards,
Tim -
How to use attributes in variable substitution???:(
Hi all,
Could you please help me out in how to use attributes in variable substitution....
Regards,
SundarHi,
Use Adapter Specific Identifiers , instead of Variable Name substitution.
Sender File adapter --> Adapter Specific Attributes --> Select File Name
Reciver File Adapter -->Adapter Specific Attributes --> Select File Name
In the mapping , use this code in an UDF to change the filename to what you want,
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String filename="YOURFILENAME";
String rSourceFileName = conf.put(key,filename);
Regards,
Bhavesh -
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
Maybe you are looking for
-
Is it possible to import .mpg or MPEG files into iMovie '08? I can open and view the files in Quicktime. If it's not possible to import into iMovie, is there a way to burn a DVD of the video in Quicktime? Thanks!
-
CMB accessing remote OC4J problem
I create a CMBean from table, before using this CMB accesses remote OC4J,all are right (deploy is ok,testing in embedded oc4j is ok,even using session bean accessing remote OC4J is ok) the client code is: try Hashtable env = new Hashtable(); env.put(
-
I erase my mac book pro to factory setting and cannot re-install the software. I received a message saying my Apple ID has not yet used with the App store. Please review your account information. Could anyone help please. I need to re-install my os.
-
Hi I have written the following function to create my own ACL and effect the same on the groups and a particular folder.Though the ACL object gets createdand gets listed in the web browser view , when i click it, i am not able to view the details,but
-
I am DISGUSTED and EXTREMELY HACKED OFF. I have suffered repeatedly SUBSTANDARD SERVICE from Sky. I can't get through to speak to anyone during the hours you say you are available on the phone - NO ONE ANSWERS. There is NO OBVIOUS EMAIL ADDRESS to