aspose file tools*
The moose likes JDBC and the fly likes Query from oracle database for specific character Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Query from oracle database for specific character" Watch "Query from oracle database for specific character" New topic
Author

Query from oracle database for specific character

Albert Hopkins
Greenhorn

Joined: Jul 21, 2007
Posts: 21
Hi...
please assist me:

I want to query a name called "hello_sbm_007" from a field.

I used this code:



The code should query word that contains "_SBM_" . It didn't worked for me.

Pleas help
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Sorry, I don't see how the given information fits in each other and above all I also don't see how this is related to JSP.

Please elaborate your problem the smart way.
Albert Hopkins
Greenhorn

Joined: Jul 21, 2007
Posts: 21
Ok..this is another example



you can see this line.

It queries "RDBMS" from the database. I want that the script queries any word contains any "R _ _ _ S" . The result will come out.

In SQL, I understand we can use ( select dataSourceType from data where dataSourceType like 'r_ _ _s') .

I hope this helps.

thank you
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Albert Hopkins wrote:
you can see this line.

It queries "RDBMS" from the database.

This doesn't query "RDBMS" from the database at all. It just compares the string "RDBMS" with the string value as referenced by 'dataSourceType'.

I want that the script queries any word contains any "R _ _ _ S" . The result will come out.

In SQL, I understand we can use ( select dataSourceType from data where dataSourceType like 'r_ _ _s') .

I hope this helps.

thank you
This is database specific. Consult its documentation. In MySQL you could do so, but then without spaces.

This has still nothing to do with JSP at all. If you were writing this code in a JSP file, you should immediately stop this and moving it into a real Java class. Scriptlets are a bad practice.
Albert Hopkins
Greenhorn

Joined: Jul 21, 2007
Posts: 21
Thank you.
Albert Hopkins
Greenhorn

Joined: Jul 21, 2007
Posts: 21
ok...

the script compares string

"RDBMS" using .equals

How if i don't want to use equals, because I want the script to compare without using the whole "RDBMS". Just compare "R....S" ??

Can you suggest??
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



Check out this String.matches(). Create a regular expression something like "R[a-zA-Z]*S" this and match the result.

Note if you want to limit the charcters to 5, change it accordingly using Regex Pattern
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
It's sometimes very impressive how a question can be asked the bad way that it will be interpreted completely differently.

In the future please try to use the correct terminology and ask questions the smart way.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query from oracle database for specific character