How to write statement using LIKE statement in jsp
hi
I am new to jsp. I would like to retrive the data from database using like command. But my query dosen't work well. Can you help me in this topic.
String name = request.getParameter("username");
int i = st.executeQuery("select * from emp where empname LIKE '%name%'");
Plase help me..
Thanking you
sure...
Using LIKE :
==========
The following SQL statement will return persons with first names that start with an 'O':
SELECT * FROM Persons
WHERE FirstName LIKE 'O%'
The following SQL statement will return persons with first names that contain the pattern 'la':
SELECT * FROM Persons
WHERE FirstName LIKE '%la%'
Hope this might have helped you
REGARDS,
RaHuL
Similar Messages
-
How to Insert Character using Prepared statement
Hi All,
Can anyone let me know how can I insert character using prepared statement.
Thanks
SameerIn the future JDBC related questions should be posted into the JDBC forum.
Can you please provide some more information about what you are trying to do? It isn't clear to me. Are you trying to update a CHAR field? -
How to validate date using case statement.
I have date like 022212. I split month,date,year using STUFF Function. Now, i have to validate month in range 01-12 and date in range 01-31. Can some one help me with the query.
Thanks, Shyam Reddy.That is not date; it is apparently a string (we have no DDL because you are so rude). Any competent SQL programmer will use DATE. You want help with a query, but there is no query.
CAST ('20' + SUBSTRING (crap_string_date, 5,2)+'-' + SUBSTRING (crap_string_date, 1,2) + '-' + SUBSTRING (crap_string_date, 3,2) AS DATE) AS redddy_screwed_up_date
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
SQL Statement using LIKE and Subquery?
Hi,
I have two tables, one table is called "Restricted_Words", the other table is called "Content" . I have a field called "short_desc" in the Content table and a field called "word" in the Restricted Words
table.
I want to write a query that will compare all the words in the restricted words table against the short_desc field in the content table and just return all the records in the content table that contain 1 or more of these words.
I started with this:
SELECT short_desc
FROM Content
WHERE short_desc LIKE ( SELECT word FROM Restricted_Words )
I know the above isn't valid and won't work, but that's what I'm trying to do.
Any help appreciated...Sorry cannot test it right now...
SELECT short_desc
FROM Content
WHERE short_desc LIKE ( SELECT word FROM Restricted_Words where
word like '%'+short_desc
+'%' )
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to manipulate arrays using case statements and boolean conditions?
In the vi that is attached I am trying to compare two values in two different arrays and delete the value that is equal to zero. The values of each array are rounded to the closest integer. Then I attempted to apply the ">0" boolean as the condition for my case statement, but I am getting an error. Any tips on manipulating arrays with case statements?
Attachments:
Patient Movement Monitoring.vi 141 KBThank you!!! that was a huge help. I don't think I need the case structures at all. The next part of the code compares the 4 values in the array.
If columns 0 and 1 are both positive -> output 1
If column 0 is negative and 1 is positive -> output 2
If columns 0 and 1 are both negative -> output 3
If column 0 is positive and 1 is negative -> output 4
(0 is x-axis value, 1 is y-axis value.....outputs are assigning quadrants to the combination)
Only one of the "AND" booleans will return true for each index. Is there a way to initialize another array of outputs 1-4 depending on which AND returns true?
Attachments:
Patient Movement Monitoring.vi 144 KB -
How to write the following CASE statement
I need to calculate Retainer amount. The derivation of it is as follows:
"A fixed value of 10000 per month for employees who have served for less than 2 years and 15000 for more than 2 years. This increment will be affected in two cycles a year, in the January or July."
The years of service can be calculated using date_of_joining.Use this logic
SELECT DECODE(SIGN(SYSDATE - ADD_MONTHS(HIREDATE,24)),-1,10000,1,15000) from <table_name>Is this you need
In every Jan/July month employee get a Sal+Fixed allownce (10000 if less than 2 years in company/15000 if more than 2 years). In other month they get just the salary
SELECT CASE WHEN TO_CHAR(SYSDATE,'MM') IN ('01','07') THEN
CASE WHEN SYSDATE- ADD_MONTHS(HIREDATE,24)> 0 THEN
SAL+15000
ELSE
SAL+10000
END
ELSE
SAL
END SAL
FROM EMP
/Edited by: Lokanath Giri on १७ सितंबर, २०१० ४:५६ अपराह्न -
Update Statement using SELECT statement
The following select query return 1 record to me
[code]
select deptno , dname, empno , max_date, max(v_num)
from (select d.deptno , d.dname , e.empno ,max (ver_date) over(partition by d.id ,d.no) max_date ,v_num
from emp e ,dept d
where e.deptno=d.deptno and e.dname = d.dname and e.empno=1 and d.deptno =3 )
group by deptno , dname, empno , max_date
[/code]
Now I need to update the above value to the emp table itself
In emp table for the empno=1 I need to update the columns mx_Date and v_num columns with the above last 2 columns in the select statement (max_date, max(v_num) )
How can I write the update statement for this.
Thank YouSomething like this
merge into emp e1
using (
select deptno
, dname
, empno
, max_date
, max(v_num) v_num
from (
select d.deptno
, d.dname
, e.empno
, max (ver_date) over(partition by d.id , d.no) max_date
, v_num
from emp e
, dept d
where e.deptno = d.deptno
and e.dname = d.dname
and e.empno = 1
and d.deptno = 3
group
by deptno
, dname
, empno
, max_date
) e2
on (
e1.empno = e2.empno
when matched then
update set e1.mx_date = e2.max_date,
e1.v_num = e2.v_num -
How to write SDO_GEOMETRY using PreparedStatements ?
Hi there,
I use JDBC and JDK 1.3+
Currently I'm writing geometries into Spatial by using Strings and
I meet some limitations for very huge geometries.
That's why I need to use PreparedStatements and parameters to get
rid of this limitation.
My question is how can I write Object types by using JDBC. All
the sample codes I found use oracle.sql and oracle.jdbc packages.
My problem is that my code can be used by people that may not
have an Oracle jdbc driver like "thin" for instance.
thanks for your help,
ALIJustin,
I have a PL/SQL package that contains several functions. One of them does selection and filtering of spatial features based on a user's location and preferences. For this purpose a web-application runs this function.
I would like this function to do the following:
1. the function is called, user parameters are passed in
2. a call to a java-stored-procedure is made. This java procedure creates a polygon based on the user's location and preferences.
3. the polygon is returned to the PL/SQL function
4. the funtion uses the returned polygon to query spatial features that intersect, etc.
I can do the call to the java-stored-procedure but where I get stuck is how to get the polygon from java to pl/sql. I can return a String or a number from java but how can I return the polygon (e.g., STRUCT, java object)?
The current solution uses a work-around by storing the polygon in a temporary table. I would like to change this because once the function has run, the polygon is not needed anymore so I would like to do without having to store the polygon.
Markus -
How to write - Perform using variable changing tables
hi Gurus,
I am facing an issue while writing a perform statement in my code.
PERFORM get_pricing(zvbeln) USING nast-objky
CHANGING gt_komv
gt_vbap
gt_komp
gt_komk.
in program zvbeln :-
FORM get_pricing USING p_nast_objky TYPE nast-objky
tables p_gt_komv type table komv
p_gt_vbap type table vbapvb
p_gt_komp type table komp
p_gt_komk type table komk.
BREAK-POINT.
DATA: lv_vbeln TYPE vbak-vbeln.
MOVE : p_nast_objky TO lv_vbeln.
CALL FUNCTION '/SAPHT/DRM_ORDER_PRC_READ'
EXPORTING
iv_vbeln = lv_vbeln
TABLES
et_komv = p_gt_komv
et_vbap = p_gt_vbap
et_komp = p_gt_komp
et_komk = p_gt_komk.
ENDFORM. " GET_PRICING
But its giving an error . please let me know how i can solve this .Hi,
Please incorporate these changes and try.
perform get_pricing(zvbeln) TABLES gt_komv gt_vbap gt_komp gt_komk
USING nast-obky.
in program zvblen.
Form get_pricing TABLES p_gt_komv type table komv
p_gt_vbap type table vbapvb
p_gt_komp type table komp
p_gt_komk type table komk
USING p_nast_objky TYPE nast-objky.
REST OF THE CODE SAME.
End form.
Note : Please check lv_vbeln after the move statement.
Hope this will help you.
Regards,
Smart Varghese -
How to write DVD using disk utility
I have ripped a dvd to my harddrive to make a backup copy of my dvd. Toast Titanium is giving me error while writing to dvd drive. How can i use disk utility to write this dvd.
-
How to write notes using 3rd party plugins ipad
Hi,
Basically im trying to write the notes in garage bad from imini. But all i can do is record it using audiobus.
Is there anyway to write the notes in garageband using the imini.
Kind regards
MartynTry Goodreader in the App Store. It should do the job for you.
-
Hi there!
Sorry if this has been answered before, but the forum search ignores '%' so I could not find anything relevant. I'm completely at a loss here guys so any help will be really appreciated.
I've got a database adapter that executes a "pure SQL" query:
select * from supplier t
WHERE t.idsupplier = #idSupplierParam OR #idSupplierParam2 IS NULL
AND t.name like '%' || #nameParam || '%' OR #nameParam2 IS NULL
AND t.address like '%' || #addressParam || '%' OR #addressParam2 IS NULL
AND t.description like '%' || #descParam || '%' OR #descParam2 IS NULL
I've got a single record in my DB with name= 'supplier1'
When I execute my bpel passing 'sup' as nameParam and nameParam2, everything is right and I get my supplier1 in the results.
BUT if I pass 'asdfghj' as name, I still get my 'supplier1' in the results ¿¿¿???
¿Is this a bug? ¿Am I doing something wrong? Thanks in advance!!No, but thanks for trying. Iif you had read my post you'd had found that I wrote
+When I execute my bpel passing 'sup' as nameParam and nameParam2+
But I double checked against that just in case. I made a test query
select * from supplier t WHERE t.name like '%' || #nameParam || '%'
And no matter what I pass as nameParam, I always GET ALL THE RECORDS in my table. ¿Any idea what's going on? It's like param is being ignored and the query that is executed is select * from supplier t WHERE t.name like '%%' which would of course return everything in the DB. :(
Help plz!! -
How to write a use time function in elsif
Hai All
I have generated an attendance form and my problem is while i am using elsif insert operation there and there is no updation.
My need is
this is my table structure
EMPCODE NUMBER
EMPNAME VARCHAR2(25)
BARCODE VARCHAR2(25)
INTIME VARCHAR2(25)
OUTTIME VARCHAR2(25)
INTRTIMEIN VARCHAR2(25)
INTROUTTIME VARCHAR2(25)
ATTEND_DATE
when timing between 0145 and 0630 then update in outtime
and 0630 to 1000 then insert in intime column
and 1100 to 1300 then insert in intime column or
update in outtime column and
then 1600 to 1730 then to insert into intime column or else
when intime is not null then update in outtime column
I have tried and only insert id doing opver there Pls tell what wrong i have made
declare
t_in varchar2(25) := :bartime;
t_out varchar2(25) := :bartime;
-- t_date dail_att.attend_date%type;
Begin
go_block('TEST_SRI');
FIRST_RECORD;
LOOP
if :bartime between 0145 and 0615 and t_out is null and t_in is not null then
update dail_att set outtime = :bartime where barcode= :barcode
and ATTEND_DATE = :BARDATE-1 ;
elsif :bartime between 0630 and 1000 and t_in is null then
insert into dail_att(barcode,intime,attend_date)
values(:barcode,:bartime,:bardate);
elsif :bartime between 0630 and 1000 and t_in is null then
update dail_att set outtime = :bartime where barcode= :barcode
and ATTEND_DATE = :BARDATE-1 ;
elsif:bartime between 1130 and 1330 and t_in is null then
insert into dail_att(barcode,intime,attend_date)
values(:barcode,:bartime,:bardate);
elsif :bartime between 1130 and 1330 and t_in is not null then
insert into dail_att(barcode,intrtimein,attend_date)
values(:barcode,:bartime,:bardate);
elsif :bartime between 1615 and 1815 and t_in is null then
insert into dail_att(barcode,intime,attend_date)
values(:barcode,:bartime,:bardate);
elsif :bartime between 1645 and 2000 and t_in is not null and t_out is null then
update dail_att set outtime = :bartime
where barcode= :barcode and outtime is null and ATTEND_DATE = :BARDATE-1;
elsif :bartime between 2000 and 2200 and t_in is not null and t_out is null then
update dail_att set outtime = :bartime
where barcode= :barcode and outtime is null and ATTEND_DATE = :BARDATE;
EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE' OR :BARCODE IS NULL;
end if;
NEXT_RECORD;
--message('hai');
END LOOP;
delete from dail_att cascade;
forms_ddl('commit');
forms_ddl('truncate');
exception
when others then
forms_ddl('rollback');
message(sqlerrm||dbms_error_Text);
message(sqlerrm||dbms_error_Text);
End;
Regards
Srikkanth.MI got it by converting by date time function
Edited by: Srikkanth.M on Apr 10, 2010 2:19 PM -
How to write $ sign using some class
hi i think i need to use some of format class
but i m not sure..
and i m not sure which method i need to use as well.....
please help mepublic class SomeClass {
public static void main(String[] args) {
System.out.println("$");
kind regards,
Jos -
How to write mail using stylus
HI,
Ca anyone help me guide through the process of writing mails & notes through stylusYou cannot use a stylus with the built-in mail and notes apps. You would need third-party apps that support handwriting, and for mail at least an app that has handwriting recognition built in. I'm not aware of any mail app that does, but there are a number of notes apps available in the iTunes Store that do.
Regards.
Maybe you are looking for
-
All of a sudden I cannot import
Aperture will not import photos. When I try and do it from the card reader, it imports nothing even though I select all. I tried copying the photos to a folder and importing from there but that does not work. I get a message that aperture imported wi
-
Is it necessary to have a light black installed if not printing photos on a 7525 phitosmart
Is it necessary to have a light black cartridge installed if you are not printing photos? Keep getting low ink message and it is the only one showing low.
-
LMS 3.2 Notification problem
Hi, we have some routers with poor bandwith, and lot of HighUtilizaton SYSLOG messages. I create new event set for them in DFM, I unchecked the HighUtilizaton message, but I still got the HighUtilization messages. What could be the problem? Thanks fo
-
Read email adress from a text file then check the validity of them
a text file has three lines, each line contains one email adress: [email protected] qwe@@ws.com wer//@we.net read the email address from a text file, then check which one is invalid, output the invalid email adress in the console.
-
Can I playback in both channels with my audio interface?
From what I've found so far I'm afraid the answer is already "no" but I have to ask for myself. When I record into QuickTime movie (not Pro) using my Alesis IO|14 Firewire interface, it only plays back on the left channel. Is there ANY way to get it