Search for a space within a text field
Hi All
I am trying to search for a sapce within a text field but sofar not being very successful. I have used:
FIND search_str
IN text_str
MATCH COUNT lv_mcnt
MATCH OFFSET lv_moff.
where search_str = TYPE c VALUE ' '.
I am looking a way of searching a character within the string using ABAP (like INSTRING in other languages). If you have similiar codes - Could you please post me a copy - Thanks
HI
Check this..
DATA string7(30) TYPE c VALUE 'This is a little sentence.'.
WRITE: / 'Searched', 'SY-SUBRC', 'SY-FDPOS'.
ULINE /1(26).
SEARCH string7 FOR 'X'.
WRITE: / 'X', sy-subrc UNDER 'SY-SUBRC',
sy-fdpos UNDER 'SY-FDPOS'.
SEARCH string7 FOR 'itt '.
WRITE: / 'itt ', sy-subrc UNDER 'SY-SUBRC',
sy-fdpos UNDER 'SY-FDPOS'.
SEARCH string7 FOR '.e .'.
WRITE: / '.e .', sy-subrc UNDER 'SY-SUBRC',
sy-fdpos UNDER 'SY-FDPOS'.
SEARCH string7 FOR '*e'.
WRITE: / '*e ', sy-subrc UNDER 'SY-SUBRC',
sy-fdpos UNDER 'SY-FDPOS'.
SEARCH string7 FOR 's*'.
WRITE: / 's* ', sy-subrc UNDER 'SY-SUBRC',
sy-fdpos UNDER 'SY-FDPOS'.
Thanks ,
Praveen
Similar Messages
-
Searching for numeric values in a text field / SQL Server
Hi all,
here's a problem that I've been trying to solve for several days: I try to select rows from an MS SQL Server via JDBC that contain a certain numeric value at a certain position in a long varchar field.
I'm using queries like
select * from table where substring(field_1, 37, 7) like '1011234';Those queries always return an empty ResultSet. If I use the same queries in WinSQL, I get correct results (several rows).
The application code is working in principle; if I search for a text instead of a numeric value, for example select * from table where substring(field_1, 4, 5) like 'Paper'; , I get a complete ResultSet.
I've tried many variations (= instead of like, search in the entire field (without substring but with like '%1011234%'), with or without ', and more), but that didn't change anything.
It's also most probably not caused by the JDBC driver; I have tried JTDS first, and then the MS driver (newest versions) - no difference.
One idea was that the sort order is not correct, tried some COLLATE settings, but that didn't help so far. In this context I'd like to know how to determine the collation sequence of a certain column.
Another thing I tried was using CAST, for example SELECT * FROM table WHERE CAST(SUBSTRING(field_1, 37, 7) as bigint) = CAST('1011234' as bigint); or SELECT * FROM table WHERE CAST(SUBSTRING(field_1, 37, 7) as bigint) = CAST(1011234 as bigint);, but that didn't help either.
Some facts:
Server: Microsoft SQL Server, version 09.00.2047
Driver in WinSQL: SQLSRV32.DLL, version 03.85.1117
JDBC-Driver:
- JTDS, version 1.2
- Microsoft SQL Server 2005 JDBC Driver, Version 1.2
JVM: jre1.5.0_11
I didn't find anything on Google, or in this forum, or other forums. I really hope someone here can help me. Thanks in advance!
Best regards,
UicaYour note suggests to me that this is a coding problem, not a JDBC or SQL problem unless you are hitting a bug in the SQL Server JDBC driver. Others may have ideas from what you have written, but I think it would be helpful to see the actual code that you are executing that does not bring back the results that you are expecting (don't forgot to use code tags to format your code correctly).
It might also be helpful to execute a query (from within your Java code) to ensure that you are connecting to the right database, accessing the correct table and that your substring is using the correct offset. The query would look something like this (and then of course display the list of results):
SELECT substring(field_1, 37, 7) from table -
Search for multiple items in one text field
Hi all,
I am new to ApEx, I have a request from one of our users to ask if there is a way we can allow them to enter more than one search items delimited by a comma. For instance, we have a text item field for user to enter some values as emp names, when he key in like PETER,SMITH,ALLEN,WARD, once he submit the page he will see the result as:
select t.empno, t.ename, t.job, t.mgr, t.hiredate, t.sal
from scott.emp t
where t.ename in('PETER','SMITH','ALLEN','WARD')
Many thanks.
Message was edited by:
lcpxYou can create a multiselect list named P1_REPORT_SEARCH based on a List of Values (LOV) with those employee names and use this code.
select t.empno, t.ename, t.job, t.mgr, t.hiredate, t.sal
from emp t
where
(instr(':'||:P1_REPORT_SEARCH ||':',':'||ENAME||':') > 0 or :P1_REPORT_SEARCH is null) /**for multiselect**/
) -
Search for White space within strings
create table emp_dtl
(empname varchar2(23));
Insert into emp_dtl values ('WAYNE');
Insert into emp_dtl values ('JOSEPH KRUPP'); --------- has white space
Insert into emp_dtl values ('YING ZONG LEE'); --------- has white space
Insert into emp_dtl values ('COHEN');
Insert into emp_dtl values ('MARIE');How can i search for empnames which has White space in it? From other OTN threads, I gathered that this has something to do with
chr(32)But i don't know how to put this in LIKE operator.Hi,
SELECT *
FROM emp_dtl
WHERE REGEXP_LIKE (empname, '\s')
;will look for any kind of whitespace (including spaces, which are CHR (32)).
It may be more efficient to specifically list all the different whitespace characters, and see if the string changes when you remove all of them:
SELECT *
FROM emp_dtl
WHERE empname != TRANSLATE ( empname
, 'x ' || CHR (9) -- CHR (9) = <tab>
|| CHR (10) -- CHR (10) = <newline>
|| CHR (13) -- CHR (13) = <return>
, 'x'
;Edited by: Frank Kulash on Jul 12, 2010 8:47 AM -
Remove blank spaces in a text field?
How can I remove blank spaces in a text field? Some text fields have a lot of blank fields that need to be removed so that I can report only on the text.
CRXI
Edited by: Burton Roger on Feb 10, 2009 5:48 PMEx:
"Hi,
I have a need for monthly service desk reporting.
Please provide data on single sheet.
Thank you"
I would like to shrink it down to -
Hi, I have a need for monthly service desk reporting. Please provide data on single sheet. Thank you" -
Search for a String within a document (Word, txt, doc) using JSP, JAVA
Hi
I have created a little application that uses combination of JSP and HTML. Users of this application can upload documents which are then stored on the server. I need to develop functionality where I can allows users to search for a string within a document. More precisely, user would type in some string in a text box and application will search all uploaded documents for that string and return the downloadable links to those documents that contains that string. I have never done this before. I was wondering if someone could get me started on this or point me to some thread where this idea is already discussed. Any Jave code exists for searching through documents??
Thanks for your help
Rizhttp://www.ibm.com/developerworks/java/library/j-text-searching.html
http://en.wikipedia.org/wiki/Full_text_search
Type these parameter in yahoo:+efficient text search
you will need something like openoffice library to read microsoft word document. -
How do I search for a word within a web page
I would like to be able to do a search for a pecific within the page currenly viewed in the browser. Is there a way to do that in Firefox?
Hi JossefPerl,
Searching on a page is actually really easy. You can just hit ''CTRL + F'' to use the search feature. You should take a look at the Knowledge Base article on [[Searching within a page]] for more information.
Hopefully this helps! -
Searching for a substring within a string
can someone reccomend a simple way to search for a substring within a string and count the number occurences of that substring.
The substring and the string will be provided as command line parameters.
Thanks
ggA simple way would be to use the indexOf methods in String:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
Not sure what this has to do with event handling though :-P -
Search for a song within a playlist in iTunes 11
I just want to know how do I search for a song within a playlist. I don't want to search the entire music library just one single playlist.
Got it. I have to deslect the Search Entire Library in the search field
-
How can I use SQL to search for a pattern within a field?
Hello, Frank, Solomon, ect
I am now faced with this particular scenario, I've got the SQL to search through a field to find text within the field, but I have to know what it is before it can look for it.
What I have to do is this:
Search through a field, for a pattern, and I won't know what the data is I am looking for. Can this be done in SQL?
For instance, Here is my SQL this far, I was helped allot in order to get to this point.
select table_name,
column_name,
:search_string search_string,
result
from (select column_name,
table_name,
'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
from cols
where table_name in ('TABLE1', 'TABLE2')),
xmltable (str columns result varchar2(10) path '.')
When you execute the above SQL, you have to pass in a value. What I really need is to alter the above SQL, to make it search for a pattern that exist's within the text of the field itself.
Like for instance, lets say the pattern I am looking for is this" xx-xxxxx-xxxx" and it's somewhere in a field.
I need to alter this SQL to take this pattern and search through all the schemas and tables to look for this pattern match.
Can be done?When you use something dynamically within a function or procedure, roles do not apply and privileges must be granted directly. So, you need to grant select on dba_tab_cols directly. If you want to do pattern matching then you should use regular expressions. The following example grants the proper privileges and uses regexp_instr to find all values containing the pattern xxx-xxxx-xxxx, where /S is used for any non-space character. I limited the tables in order to save time and output for the test, but you can eliminate that where clause.
SYS@orcl> CREATE USER test IDENTIFIED BY test
2 /
User created.
SYS@orcl> ALTER USER test QUOTA UNLIMITED ON USERS
2 /
User altered.
SYS@orcl> GRANT CREATE SESSION, CREATE TABLE TO test
2 /
Grant succeeded.
SYS@orcl> GRANT SELECT ON dba_tab_cols TO test
2 /
Grant succeeded.
SYS@orcl> CONNECT test/test
Connected.
TEST@orcl> SET LINESIZE 90
TEST@orcl> CREATE TABLE table1
2 (tab1_col1 VARCHAR2(60))
3 /
Table created.
TEST@orcl> INSERT ALL
2 INTO table1 (tab1_col1) VALUES ('xxx-xxxx-xxxx')
3 INTO table1 (tab1_col1) VALUES ('matching abc-defg-hijk data')
4 INTO table1 (tab1_col1) VALUES ('other data')
5 SELECT * FROM DUAL
6 /
3 rows created.
TEST@orcl> CREATE TABLE table2
2 (tab2_col2 VARCHAR2(30))
3 /
Table created.
TEST@orcl> INSERT ALL
2 INTO table2 (tab2_col2) VALUES ('this BCD-EFGH-IJKL too')
3 INTO table2 (tab2_col2) VALUES ('something else')
4 SELECT * FROM DUAL
5 /
2 rows created.
TEST@orcl> VAR search_string VARCHAR2(24)
TEST@orcl> EXEC :search_string := '\S\S\S-\S\S\S\S-\S\S\S\S'
PL/SQL procedure successfully completed.
TEST@orcl> COLUMN "Searchword" FORMAT A24
TEST@orcl> COLUMN "Table" FORMAT A6
TEST@orcl> COLUMN "Column/Value" FORMAT A50
TEST@orcl> SELECT DISTINCT SUBSTR (:search_string, 1, 24) "Searchword",
2 SUBSTR (table_name, 1, 14) "Table",
3 SUBSTR (t.column_value.getstringval (), 1, 50) "Column/Value"
4 FROM dba_tab_cols,
5 TABLE
6 (XMLSEQUENCE
7 (DBMS_XMLGEN.GETXMLTYPE
8 ( 'SELECT ' || column_name ||
9 ' FROM ' || table_name ||
10 ' WHERE REGEXP_INSTR
11 (UPPER (' || column_name || '),''' ||
12 UPPER (:search_string) || ''') > 0'
13 ).extract ('ROWSET/ROW/*'))) t
14 WHERE table_name IN ('TABLE1', 'TABLE2')
15 ORDER BY "Table"
16 /
Searchword Table Column/Value
\S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>matching abc-defg-hijk data</TAB1_COL1>
\S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>xxx-xxxx-xxxx</TAB1_COL1>
\S\S\S-\S\S\S\S-\S\S\S\S TABLE2 <TAB2_COL2>this BCD-EFGH-IJKL too</TAB2_COL2>
3 rows selected. -
Search for certain Characters within set of Characters - in a field
Hello -
I know a search can be made within a field for a word, but I am not to sure, or I don't know how to accomplish this...To do a search in a field for certain characters within a larger set of charcters.
For example: I would search, in the Call Description field, for DXXXX within CA0001DXXXXYYY or search for LXXXX within CA0001LXXXXYYY, the X is numeric characters and the Y's are Alpha characters. Can crystal accomplish this....
Thanks for your gracious help....
G.Like I said earlier, this code:
If instr({database_field}, 'DXXXX') > 0 then "String Found" else "Not Found"
cannot be used in a Record Selection formula.
The following code can be used in the Record Selection formula:
Instr({database field}, "string") > 0
If you wish to search for 'D4444' in the field and return records where a match is found, you would use:
Instr({database field}, "D4444") > 0
-Abhilash -
How to search for a word in a text editor
Hi,
I have created a custom container and added some text to it. Is there any method to search for words in this?Lilan,
To search a character field for a particular pattern, use the SEARCH statement as follows:
SEARCH <c> FOR <str> <options>.
The statement searches the field <c> for <str> starting at position <n1>. If successful, the return code value of SY-SUBRC is set to 0 and SY-FDPOS is set to the offset of the string in the field <c>. Otherwise, SY-SUBRC is set to 4.
The search string <str> can have one of the following forms.
<str>
Function
<pattern>
Searches for <pattern> (any sequence of characters). Trailing blanks are ignored.
.<pattern>.
Searches for <pattern>. Trailing blanks are not ignored.
*<pattern>
A word ending with <pattern> is sought.
<pattern>*
Searches for a word starting with <pattern>.
Words are separated by blanks, commas, periods, semicolons, colons, question marks, exclamation marks, parentheses, slashes, plus signs, and equal signs.
<option> in the SEARCH FOR statement can be any of the following:
ABBREVIATED
Searches the field <c> for a word containing the string in <str>. The characters can be separated by other characters. The first letter of the word and the string <str> must be the same.
STARTING AT <n1>
Searches the field <c> for <str> starting at position <n1>. The result SY-FDPOS refers to the offset relative to <n1> and not to the start of the field.
ENDING AT <n2>
Searches the field <c> for <str> up to position <n2>.
AND MARK
If the search string is found, all the characters in the search string (and all the characters in between when using ABBREVIATED) are converted to upper case.
Pls. Mark -
Searching for a string in given text file
Hi,
I have two strings and i need to search the entire file for the strings and highlight the lines between the strings
say, for example,
hi this is xyz
i am a begineer in java
can i have some help in this issue please
i gave 'hi' and 'can' i need the three lines to be highlighted
can you give me an idea about this.
how to proceed
thanks all in advance
Edited by: anub on Feb 6, 2009 3:24 AMHere's an idea. Find a link to the java API. Create a utility class with a method to read a file and a method to write a file. Look in java.io for this. That should keep you busy for a while and give you something specific to ask questions about. Next, create a GUI class and put a button on it. Figure out how to make a button click open a "FileChooser" or "JFileChooser" (Look in the api for that) Imagine that these need to talk to each other so figure out what parameters are needed. After you've done that then figure out how the user is going to enter the two search criteria (something that acts like a text field). Choose a GUI class that supports text highlighting. Display all the information that the user would like to know e.g. The name of the file selected to parse, the name of the file to write, and whether the strings were found successfully.
kr
walker -
Searching for XML tags using Oracle Text
I am using full text search to find documents based on a search text. It works fine for pdf, word documents, etc. However for XML documents, searching for a particular tag name does not find anything. Searching for text within tags works fine. Any thoughts?
Edited by: miyer on Feb 21, 2011 6:25 PMHi
Try adding the following variable to ucm config.cfg and then see if a new xml checkin returns the result for FT search :
TextIndexerFilterFormats=xml
Save the file , restart UCM and then test .
If the new checkin gets the results as expected then execute Collection Rebuild cycle to have the existing contents as well FT indexed to be searchable (for XML).
Thanks
Srinath -
Spaces within access db field name
I am trying to use data which was extracted to a excel file
then imported into a access database.
During the import access database used the first roll to be
the field name and some names has space within.
When I try to access those field inside CF and i will get a
error message since the CF won's understand any field names with
space inside the name.
Is there a work around? Since change the field name each time
will take lots of time beacuse the db will be exported every day.
ThanksIs there a work around? Since change the field name each time
will take
lots of time because the db will be exported every day.
Thanks
Yup, two of 'em even.
The first is in the SQL language, you can alias the columns
with the AS
command. This one is probably preferred by most developers.
SELECT ['Column With Spaces'] AS NoSpaces
FROM aTable
Secondly you can use the array notation ability of ColdFusion
to
reference variables with bad names. For queries that would be
queryName[columnName][row].
<cfoutput query="aBadQuery">
#aBadQuery["Column With Spaces"][currentRow]#
</cfoutput>
Maybe you are looking for
-
WLS 8.1:SP2:Sample Portal not ruuning in HP-UX 11.23 (Intanium)
Hello all, The sample portal is not running in HP_UX 11.23 ( Itanium ). Following steps are followed to install WLS. 1. Installed the JDK: "java version "1.4.2.01"" 1. java -jar itanium_HP_pj_platform812_generic.jar 2. Applied the patch: jar -xvf wls
-
I bought Ebey NEW Boxed (NEVER OPENED) 16GB Black Iphone 5 Virgin Mobile (USA) NO CONTRACT, want to use it in Europe, particularly in Ukraine, but for some reason now my phone does not see the Ukrainian GSM sim card. Please help to solve this problem
-
MBP Retina Windows 7 x64 drivers will not load
I knew nothing about Mac or OSX and got my MBP running in July. Then later I realised I shoudl take advantage of the Solidworks capacity to run 64bit so I removed partition, got the ISO, made the Flash USB, installed Windows 7 x64 and it is now insta
-
RECOVER DATABASE AUTOMATIC UNTIL SCN
Hi, in 10gR2 on Win 2003, I receive the following error : RECOVER DATABASE AUTOMATIC UNTIL SCN 584413; ORA-00905Unfortunately documentation site is not available : Gateway Timeout The proxy server did not receive a timely response from the upstream s
-
Does anyone else have a "*" show up in front of old files once you upgrade to CS6??
When I open files from an older version of InDesign, the files now have a strange "*" on the front of them? What is this? and why does it happen?