Vo based on where like clause
Hi All,
In my Vo the query is:-
select empno,ename from emp where ename like :1
now i am setting the variable in VO as follows:-
setWhereClauseParams(null);
setWhereClauseParam(0, empNameKey);
executeQuery();
But i am getting an error :-
SQL error during statement preparation. Statement: select empno,ename from emp where ename like :1
Please Help me in solving this problem.
Thanks,
Vikram
Exception Details.
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: select empno,ename from emp
where ename IS NOT NULL and
ename like :1
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1064)
at oracle.apps.fnd.framework.webui.OAPageBean.renderDocument(OAPageBean.java:2651)
at oracle.apps.fnd.framework.webui.OAPageBean.renderDocument(OAPageBean.java:2459)
at OA.jspService(OA.jsp:48)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
## Detail 0 ##
java.sql.SQLException: ORA-01008: not all variables bound
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:583)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol
Similar Messages
-
Performance on searching a name field with the like clause
Hi. We run 2012 std and I suspect we'll be running into challenges as my user has expressed an interest in searching data based on a like clause across a contact name column that is varchar(80). The like clause is shown below. The
question is whether or not an index on this column will (if we make one) even be used when a like clause is introduced? And any other advice the community may offer. I'll ask my user if they could limit the search to patterns that match starting
in position 1 but suspect they'll say no. Currently the table has 1.5 million rows , one pk, and is approx 1100 bytes wide if varchars are fully used.
where ltrim(rtrim(e.[ContactName])) like '%' +IsNull(@contactName1,'') + '%'Hi. We run 2012 std and I suspect we'll be running into challenges as my user has expressed an interest in searching data based on a like clause across a contact name column that is varchar(80). The like clause is shown below. The
question is whether or not an index on this column will (if we make one) even be used when a like clause is introduced? And any other advice the community may offer. I'll ask my user if they could limit the search to patterns that match starting
in position 1 but suspect they'll say no. Currently the table has 1.5 million rows , one pk, and is approx 1100 bytes wide if varchars are fully used.
where ltrim(rtrim(e.[ContactName])) like '%' +IsNull(@contactName1,'') + '%'
Hi db042190,
>> The question is whether or not an index on this column will (if we make one) even be used when a like clause is introduced?
A simple index use an exact value in order to compare it (it orer the tree according to the value). For most cases it will not be a good solution for filtering by "like" (in some cases it can help you use "index scan", but it will not
be able to use "index seek"). There are several options that can help in this issue dapending on your interface and the way you use the data:
(1) Full Text Index as Olaf mentioned
(2) Another option, which is very useful in some cases, based on using an external table, which store list of searching words (if the user try a new search then you can scan the original table, which this is one-time-job for each new word). This is actually
work on the same idea of using FTS, but it is more flexible and give you direct control if you need to use word searching and not phrase/free-text searching. This table is indexed and the search is done on this table, and not the original table. Those two
tables have relations many-to-many, and you use a simple JOIN to get the results
>> limit the search to patterns
This can be a game changer!
There is a simple solution that might help you in this case which is very useful! you can create a computed column that store the value according to your patterns, and then create index on that
column. For example if the your pattern is filter by "starting with 10 specific char" then you can use simple LEFT function like in this code:
CREATE TABLE t (LongText nvarchar(MAX), MyPatSearch as convert(nvarchar(10),LEFT(LongText,10)));
GO
CREATE NONCLUSTERED INDEX IX_MyPatSearch ON t (MyPatSearch);
GO
* using computed column with string like in this example, you have to use CONVERT since Data type is requirements for index computed column.
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
Create Index to use Like Clause
Hi All,
I want one of my query to use a index which runs with a LIKE Clause. I have not done that before but i have heard and seen through forums that its possible to create indexes for a column with Like Clause using function based index.
Function
Request the forum users to achieve my objective. Let me list down what i have done.
Function
CREATE OR REPLACE FUNCTION RND_LIKE(P_NO IN VARCHAR2)
RETURN VARCHAR2 IS
RESULT VARCHAR2(240);
BEGIN
RETURN P_NO||'%';
END RND_LIKE;
SELECT ENAME FROM EMP WHERE ENAME LIKE RND_LIKE('A')
Here based on this function i want to create a function based index and force the same to my query. Request the forum users to help me out in this.
Thanks
Edited by: ramarun on Dec 18, 2009 9:26 PMIn the case you had there , Oracle would use an index on ename in a query if you were to type A% in the ename item on a Form. You wouldn't need a function index for that.
Here's the link to the documentation to create a function based index http://download-uk.oracle.com/docs/cd/B28359_01/server.111/b28310/indexes003.htm#i1006674 -
I have a very simple apex application. App has a text box(:usr_name) where user can enter comma separated names. The value/parameter is passed to region sql in the where clause. My Sql look like
Select col1, col2, col3,... from views where col1 in (:usr_name);
I understand that values from text box are passed like 'Name1, Name2, Name3' hence where in clause fails.
I used replace function replace(''':usr_name''',',',''',''') which converted the input to 'Name1','Name2','Name3'. But the where is treating replaced output as string and not as values to returning no records.
There is similar thread (Insert statement with requirement related to record insertion. And the provided solution works as values were passed one by one in a loop.
But in my case I want all 'names' to be passed at once.Switch your region from a type of "SQL Query" to "SQL Query(PL/SQL function returning SQL query) and build your SELECT statement on the fly based on the user's input. In the "Region Source" field put:
RETURN('Select col1, col2, col3,... from views where col1 in ('''||replace(:usr_name,',',''',''')||''')');
Mike -
On my iPhone 4, people cant hear me when I make and / or receive normal (GSM) phone calls. But when I make/receive calls using internet-based / native apps like viber or skype, people can hear me just fine. I have tried recording my voice using voice memos - this works. And have already tried different SIM cards but the problem persists.
I have taken my phone to an authorized Apple service center, where they restored my phone to factory settings, but still facing the same issue. They service center directed me to Apple Customer Care Hotline, where I have now spent 3+ hours explaining my issue and yet no one can resolve it. The easy answer if to replace the phone - and since it is out of warranty, I am expected to pay for it.
Additionally, the customer service has been so rude and confrontational that it has completely changed my view of Apple and its customer focus. I am a disappointed and angry customer today - people would be surprised to hear just how rude customer service was including making statements such as "Apple doesnt make infallible products, that's why warranty is needed for our products" and that "every product undergoes a problem at some stage, so do ours!" There goes whatever confidence I had...
My concern is simple - if no one at Apple and / or its CS hotline is able to address my issue comprhensively and keep telling me that they have never encountered a precedent before, then with what right can they expect me to pay for a replacement?! I am NOT here to fund Apple's research into their product faults and manufacturing.
And even though a customer is out of warranty, is it too much to expect an Apple product to work well for at least a 'reasonable' period of time. My phone is less than 18 months old and has been facing this issue for the past 2 months - surely the longevity of Apple products is more than 18 months!
Just a sad sad day for an Apple customer, compounded by unjustifiably rude and aggressive staff. And still no resolution to my problem.I am having the same issue - with my last 2 iPhone 4's. My first handset each time I was on a call wether it was up to my ear or on loud speaker, the call would automatically mute even though the mute button wouldn't show up as highlighted. Pressing the mute button on and off during the call doesn't fix it either. I rang Apple and asked what some of their trouble shooting solutions were. I got told that it might be a software issue and to install the latest software update. This failed. I then got told to uninstall the software on the phone and do a complete restore. This also failed. After trying the troubleshooting suggestions, I took the phone into my provider and they sent me out a new phone within a week under warranty claiming it was a hardware issue and probably just a "glitch" with that particular phone. This was not the case....
After receiving my second iPhone 4, I was hopeful that it would work. For the first couple of days, making/receiving calls was not an issue. Until after about a week, the same problem started again. In one instance I had to hang up and call back 4 times and the call would still automatically mute after about 5 seconds. Also on the second handset, the main camera located on the back of the phone has red and blue lines running through it and can't take a decent picture. So back to the store I go to get another replacement - Again.
For a phone that is rated highly and as a keen Apple product purchaser, I am a bit disappointed with the experience I have had with the iPhone 4. Let's hope they find a fix sometime soon because this is becoming a bit beyond a joke.....!! -
Using a Text Area for a Where In () Clause
Hi Everyone!
It has been awhile since I have done any Oracle ApEx development. This is because I work on the BI team and have been doing more ETL and Teradata development to support MicroStrategy reports.
Having said that, I am attempting to upgrade an existing application with a bit of new functionality. I am trying to allow the user to enter a comma separated list of values (i.e: 12345, 67890, 112233, 44455566) into a text area on one page and have the report on the following page accept that input and use it to filter an interactive report.
I am aware that users can filter an interactive report with the functionality built into the report itself, but some users have requested additional filtering as mentioned above before they actually see the report. My text area is called P10_TXT_ITMS. The code in the SQL for the interactive report is:
AND (ITM_NUM IN :P12_HID_ITMLIST)
When I enter a single number, it works beautifully. Unfortunately, however, entering a comma separated list 'breaks' the report. It says that the value entered into the text area is not a number. To combat this, I tried using to_char() on the column in the table in the comparison. Of course, this also did not work. I would have thought that the variable would have converted into a comma separated list and the where in clause would be totally valid, but it does not seem to behave that way.
Does anyone have any thoughts or suggestions? Any help would be very much appreciated!
Edited by: tgeorge on Jan 21, 2010 9:47 AMHi,
It treats it as one large string. Even with to_char it would be like:
'12345' IN ('12345, 67890, 112233, 44455566'); as opposed to:
'12345' IN ('12345', '67890', '112233', '44455566');
You need to split the string up somehow.
Edit: Possibly with the use of regexp_substr?
Mike
Edited by: Dird on Jan 21, 2010 3:53 PM -
Error bind variable with "like %" clause ?
Hello everybody;
I would like to know how to do a like clause to bind variables, with this code i obtain 'ORA-00933: SQL command not properly ended' error
v_query:= 'UPDATE ' || collection(i) ||' SET REF_PLAN=:quatre_champ WHERE FAM_SIM like ''%'':prem_champ''%'' AND PRISE_V1P like ''%'':deux_champ''%'' AND BROCHE_V1P like ''%:trois_champ%''';
EXECUTE IMMEDIATE v_query USING quatre_champ,prem_champ,deux_champ,trois_champ;Maybe my " ' " are in a bad positions ?
Thanks for your help, regards.Hi,
try this
v_query :=
'UPDATE '
|| collection (i)
|| ' SET REF_PLAN =:quatre_champ WHERE FAM_SIM like'|| '''%:prem_champ%'''
|| ' AND PRISE_V1P like' || ''' %:deux_champ%'''
|| ' AND BROCHE_V1P like'||''' %:trois_champ%;'''
Of course not tested
Any efforts to give sample data and help us recreated the problem will be appreciated.
Cheers!!!
Bhushan -
SQL error with LIKE clause in statement
Can anyone explain how an SQL statement with a LIKE clause is executed properly?
Seems like it ought to be cut and dried, no pun intended!
When I run the following and set the requestor name = ?, and correctly type in the entire name, a result set (albeit abbreviated) will return.
But if I try to set the request param to LIKE I get an error of some kind, either invalid cursor state or NullPointer exception.
Here's my code.
Statement selstmt = connection.createStatement();
String preparedQuery = "SELECT DISTINCT AID, ACTIVE, REQUESTOR_NAME,REQUESTOR_EMAIL" +
" FROM CHANGE_CONTROL_USER, CHANGE_CONTROL_ADMIN " +
" WHERE REQUESTOR_NAME LIKE '%?%';";
String reqName = request.getParameter("requestor_name");
PreparedStatement prepstmt = connection.prepareStatement(preparedQuery);
prepstmt.setString(1, reqName);
ResultSet rslts = prepstmt.executeQuery();
rslts.next();
int aidn = rslts.getInt(1);
int actbox = rslts.getInt(2);
String reqname = rslts.getString(3);
String reqemails = rslts.getString(4);It's also returning only 1 record for some reason, as I have the following:
<% while (rslts.next()) { %>
<tr class="style17">
<td><%=reqname%></td>
<td><%=reqemails%></td>
<td><%=actbox %></td>
<td><%=aidn %></td>
</tr>
<%
rslts.close();
selstmt.close();
%>If I use
" FROM CHANGE_CONTROL_USER, CHANGE_CONTROL_ADMIN " +
" WHERE REQUESTOR_NAME = ?;";it will actually spit out the name and corresponding email properly, albeit just one record like I said.
Is there some kind of escape sequence I should be using that I'm not?
And why just the one record?
Any help or direction is appreciated!
Thanks.I have working code for LIKE in PreparedStatement, and its equivalent in your case is something like this:Statement selstmt = connection.createStatement();
String preparedQuery = "SELECT DISTINCT AID, ACTIVE, REQUESTOR_NAME,REQUESTOR_EMAIL" +
" FROM CHANGE_CONTROL_USER, CHANGE_CONTROL_ADMIN " +
" WHERE REQUESTOR_NAME LIKE ?";
String reqName = request.getParameter("requestor_name");
PreparedStatement prepstmt = connection.prepareStatement(preparedQuery);
prepstmt.setString(1, "%" + reqName.trim() + "%");
ResultSet rslts = prepstmt.executeQuery();
rslts.next();
int aidn = rslts.getInt(1);
int actbox = rslts.getInt(2);
String reqname = rslts.getString(3);
String reqemails = rslts.getString(4); -
Using Like Clause in Prepared Statement
Hi,
I want to use LIKE clause in prepared statement. This is not returning any record.
This is the query. Please help me in this.
SELECT EMPLYR_GRP,EMPLYR_GRP_NAME FROM EMPLOYER_GROUP WHERE EMPLYR_GRP_NAME LIKE ? AND EMPLYR_GRP = ?
This is giving Oracle SQL Error.
SELECT EMPLYR_GRP,EMPLYR_GRP_NAME FROM EMPLOYER_GROUP WHERE EMPLYR_GRP_NAME LIKE %?% AND EMPLYR_GRP = ?The first variant should work just fine as long as you use stmt.setString(1, '%' + pattern + '%') to set the parameter. The second query is just plain wrong.
Alin. -
XSQL Using bind params with sql LIKE clause
I am unable to use a bind-param with the LIKE clause in a SELECT statement.
eg call .../temp.xsql?name=N
XSQL query is this:
<xsql:query max-rows="-1" bind-params="name">
SELECT last_name
FROM emp
WHERE last_name LIKE '?%'
</xsql:query>
I have tried a few combinations so far with no success eg:
WHERE last_name LIKE '{@name}%'
WHERE last_name LIKE ?||%
Any ideas?I highly recommend using XSQL's real bind variable feature wherever you can. You can read about it in the XSQL Online Documentation (Search for the "Using Bind Variables" section).
Using this feature is more performant and more secure than using textual substitution variables.
Here's what your page looks like using textual substitution:
<page connection="UTD4" xmlns:xsql="urn:oracle-xsql">
<xsql:query null-indicator="yes" >
SELECT * FROM TC_HL7_SEG WHERE SEGMENT_CODE LIKE '{@code}%'
</xsql:query>
</page> .
And here's what it would look like using real bind variables:
<page connection="UTD4" xmlns:xsql="urn:oracle-xsql">
<xsql:query null-indicator="yes" bind-params="code">
SELECT * FROM TC_HL7_SEG WHERE SEGMENT_CODE LIKE ?||'%'
</xsql:query>
</page> .
Using real bind variables allows the database to avoid reparsing the SQL statement everytime, which improves performance.
Steve Muench
JDeveloper/BC4J Development Team
Author, Building Oracle XML Applications -
Tunning query with LIKE clause
Hi, is there any chance to improve execution plan for SQL query which is using LIKE clause?
Query:
SELECT * FROM [TABLE_NAME] WHERE ADDRESS LIKE :1 ESCAPE '\';
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 112K| 18M| 11361 (1)| 00:02:17 |
|* 1 | TABLE ACCESS FULL| [TABLE_NAME] | 112K| 18M| 11361 (1)| 00:02:17 |
Execution plan is far from ideal. Table has several millions of records.
This query is used by application to seach using patterns...
Any ideas?
Thx in advance!This example isn't entirely realistic. Your table T has only 1 column which is also indexed. Apparently, for small enough tables of one column it will search the entire index for the wildcard value. But if I add a second column, or base the single column version on a larger table, the optimizer uses a full table scan:
SQL> drop table t;
Table dropped.
SQL> CREATE TABLE t AS SELECT DBMS_RANDOM.STRING('a',100) a
2 ,DBMS_RANDOM.STRING('a',100) b
3 FROM user_objects;
Table created.
SQL>
SQL> CREATE INDEX t_idx ON t (a) COMPUTE STATISTICS;
Index created.
SQL>
SQL> SET autotrace traceonly explain
SQL>
SQL> SELECT *
2 FROM t
3 WHERE a LIKE '%acb%';
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=100)
1 0 TABLE ACCESS (FULL) OF 'T' (Cost=2 Card=1 Bytes=100)
SQL> drop table t;
Table dropped.
SQL> CREATE TABLE t AS SELECT DBMS_RANDOM.STRING('a',100) a
2 -- ,DBMS_RANDOM.STRING('a',100) b
3 FROM all_objects;
Table created.
SQL>
SQL> CREATE INDEX t_idx ON t (a) COMPUTE STATISTICS;
Index created.
SQL>
SQL> SET autotrace traceonly explain
SQL>
SQL> SELECT *
2 FROM t
3 WHERE a LIKE '%acb%';
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=20 Card=399 Bytes=39900)
1 0 TABLE ACCESS (FULL) OF 'T' (Cost=20 Card=399 Bytes=39900) -
LIKE clause with special characters
Hi All,
I'm having problems with LIKE clause that contain special characters.
I'm doing something like
SELECT * FROM Table WHERE FieldName LIKE '%10' & Chr(37) & '%'
But it doesnt seem to recognize the pattern as 10%. Instead it is returning all the hits for 10?
Help much appreciated
Sudhahey..cud u get the problem solved?
-
Sending an array of values to Oracle procedure to use in WHERE IN clause
I have a stored procedure in Oracle as shown below:
<p><h5><font color=NAVY>CREATE PROCEDURE MY_TEST_PROC(
CUR OUT SYS_REFCURSOR,
PARAM_THAT_WILL_BE USEDINSIDE_WHERE_IN
AS
BEGIN
OPEN CUR FOR
SELECT *
FROM MY_TABLE
WHERE COL1 IN (here I want to put values received from C#)
END;</font></h5></p>
On the ASP.NET application side I have a select element with several options. I want to use these list items in my WHERE clause. I know that I can have a VARCHAR2 input parameter in my stored proc, make a comma separated string from the list items, send it to the procedure. There are two concerns with going this way:
1.I make my website vulnerable to SQL injections
2.In my stored proc I have to use EXECUTE ('SELECT ...') pattern which I would like to avoid.
How can I send these list items to the stored procedure and use them inside the WHERE IN clause? I'm using ODP.NET and have heard of UDT but don't know how to use it.Assuming a connection variable called conn and Java String array called myStringArray, here's the gist of it:
ArrayDescriptor descriptor1 = ArrayDescriptor.createDescriptor("STRING_ARRAY", conn);
ARRAY array1 = new ARRAY(descriptor1, conn, myStringArray);
OracleCallableStatement cs = (OracleCallableStatement) conn.prepareCall(sql);
cs.setARRAY(1, array1); -
Binding an array of integers using OCI for WHERE IN clause
Is it possible to bind lists of integers using OCIBindByPos(), for use with a WHERE IN clause?
In our application, we very often have statements like this:
SELECT ...
WHERE col1 IN (3, 54, 65, 76, 112, 232, 343)where the number of integers in the list is variable.
These lists sometimes can become very large (several thousands of entries); Oracle ADDM then indicates that these statements are hard to parse and recommends to use bind variables instead.
Is is possible to change the statement into something like
SELECT ...
WHERE col1 IN (:1)and to bind the integer list using OCIBindByPos()?
Or is there an even better way to do this? (Please note: the integer list is not the result of a previous SELECT statement, i.e. we cannot use joins or subqueries here.)
Regards
- FrankTurns out it's possible after all, albeit not quite written in the most obvious way.
See Re: Binding collection to right-hand-side of WHERE num_col in (:1) clause? for details. -
Difference between simple DAQ card and FPGA based DAQ card(like PCI 7831R)
Could any one tell me, where should i use simple DAQ card and where should i use FPGA based DAQ card ? if i can take data acquisition from simple DAQ card then why we go to the FPGA based DAQ cards(like PCI 7831R) ?
Hello,
The choice of card depends on the application that you develop. For example, you’d better use FPGA if you need a perfect synchronization of several acquisition chains as FPGA matrix will adapt in the way that your channels will be separated and will no use common resources. Another example of FPGA application can be acquisition of several chains of the data that demands very high sampling frequency (FPGA internal frequency can be up to 400MHz).
When using FPGA you have to program signal acquisition “from the beginning”, I mean that there are no standard tasks as, for example, “counting edges”. But due to this you can modify standard tasks of DAQ acquisition if you need it.
Maybe you are looking for
-
File does not exist: OA_HTML AppsLogin
Hi Iam able to login to Apps R12. While debugging for some issue I started Apache as root. I stopped and removed the errorlog and pid files and Iam able to start apache. Iam able to login to ascontrol but iam not able to login to apps. Is there files
-
Setting read-only property for a RTL inputtext.
HI, I am using JDeveloper version 11.1.2.2.0. In my fusion web application, in the af:inputtext field, if the language is, RTL or LTR the value is displaying according to that. Suppose, if it is English, the value is displaying left to right. If it i
-
Alerts configuration- getting the actual contents of the payload
Hi We are on XI 3.0 SP18 - My understanding so far - on alert category definitions has been that - we can create container variables - pull in - system variables as a part of the contents of the alert message - Now , if I want to grab the contents
-
How can I hide columns that has rows with merged cells?
I'm making a schedule on Numbers and there are couple of rows that are one cell (merged). Because of this reason when I select a column to hide, it's not just the column that is being selected but the column and the all the merged cells that goes acr
-
Customize SharePoint Page view for different roles
Hi, We have a SharePoint site for the project team. When a user logs into SharePoint we would like the user to see a page that is customized for his role in the project. The project roles are Developer, Tester, Business Analyst and Project Manager. E