sgs1970
asked on
Sql Query for generic search - Look for search string followed by atleast one alphanumeric character
Hi,
I am developing a vb.net GIS application with oracle backend . I need to make a generic query for the house numbers. (House_No is a column of string type)
The query is to return any house_no starting with search string followed by atleast one alphanumeric character
For example a query for house_no like 21 should return 21,21-1,21/1
but should not return 211 or 211-1 etc
That is, return any house_no starting with 21 followed by atleast one alphanumeric character
Thanking you,
Sam
I am developing a vb.net GIS application with oracle backend . I need to make a generic query for the house numbers. (House_No is a column of string type)
The query is to return any house_no starting with search string followed by atleast one alphanumeric character
For example a query for house_no like 21 should return 21,21-1,21/1
but should not return 211 or 211-1 etc
That is, return any house_no starting with 21 followed by atleast one alphanumeric character
Thanking you,
Sam
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
WHERE REGEXP_INSTR (house_no, '[[^[:digit:]]]{3}$') will return values where the third digit is not numeric, based upon your example.
See: http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/rischert_regexp_pt1.html
See: http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/rischert_regexp_pt1.html
ASKER
Hi Guys,
I apologize on the misleading "alphanumeric " part of the question . Infact, what I intented was non-numeric . Thanks to jinesh_kamdar for pointing out this.
ASKER
Hi,
Regarding the answer, unfortunately I couldn't figure out one yet among the given.
Answet given by dvz doesn't help me because the search could be for house no for 2 and it should return 2,2/1,2/2,2-1 etc... . Also search for 121 should return 121,121-1 etc...
Thanking you,
Sam
Regarding the answer, unfortunately I couldn't figure out one yet among the given.
Answet given by dvz doesn't help me because the search could be for house no for 2 and it should return 2,2/1,2/2,2-1 etc... . Also search for 121 should return 121,121-1 etc...
Thanking you,
Sam
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Acc. to the above stmt., your required result could also contain 211, 211-1, etc. since the 1 followed by the 21 IS an alpha-NUMERIC char. Pls be more specific in ur exact requirements.