How to compare strings ignoring accents?
Hi all,
I'd like to know, how can I compare 2 strings, ignoring accents.
i.e.: caf? should be come before cafo, and caf? should be considered the same word as cafe
Message was edited by:
Valeriano
hint: strength
import java.text.*;
import java.util.*;
public class CollatorExample {
public static void main(String[] args) {
test(Collator.PRIMARY, "PRIMARY");
test(Collator.SECONDARY, "SECONDARY");
test(Collator.TERTIARY, "TERTIARY");
test(Collator.IDENTICAL, "IDENTICAL");
static void test(int strength, String strengthName) {
Collator c = Collator.getInstance(Locale.FRENCH);
c.setStrength(strength);
System.out.println(strengthName + " : " + c.compare("caf?", "cafe"));
}
Similar Messages
-
How to compare string in a case-insensitive manner using JavaScript?
Hello everyone,
Now I have a javascript to compare checkbox's value with user's input, but now seems it only can compare case-sensitively, does some one know if there is a function in javascript that it can compare string case-insensitively ?
Here is my script :
function findOffice(field)
var name;
name=prompt("What is the office name?");
var l = field.length;
for(var i = 0; i < l; i++)
if(field.value==name)
field[i].checked=true;
field[i].focus();
field[i].select();
break;
<input type="button" name="Find" value="Find And Select" onClick="findOffice(form1) >
Thanks in advance !
RachelThank you so much, I already solved the problem with your advice.
You really have a beautiful mind, :-).
I appreciate your help !
Rachel -
Newbie Question: Rules: Functions: How to compare String based type?
I have some XML facts in my rules dictionary defined by the following schema (fragments shown)
<xs:simpleType name="VarType">
<xs:restriction base="xs:string">
<xs:enumeration value="Foo"/>
<xs:enumeration value="Bar"/>
<xs:enumeration value="Baz"/>
<xs:enumeration value="Qux"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="ProgType">
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
<xs:element name="var" type="VarType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
Which means that a Prog of ProgType has an ID and a "list" of "var" strings restricted to bounds specified by VarType.
The issue comes when I try to create a Rules Function operating on these types.
Function-> boolean containsVar(ProgType prog,VarType var) (built using the Functions tab of the Rules editor)
for (String v : prog.var ){
if (v == var){
return true
return false
The problem we run into here is typing. If v is declared a String, as here, then v == var is invalid because types don't match. But I can't declare v a VarType due to
RUL-05583: a primitive type or fact type is expected, but neither can be found.
This problem may stem from the fact the Java's String is declared final and can't be subclassed, so the JAXB translation to Java may have to wrap it, futzing ==/equals() in the process.
SO... How do I create this method and compare these values?
TIA
Edited by: wylderbeast on Mar 10, 2011 9:15 AM - typos
Edited by: wylderbeast on Mar 10, 2011 9:18 AMAnd here's the answer.
var.value() seems to return the String value of the type
so the comparison becomes
(v == var.value())
Live and learn.... -
How to compare string in a table reg
Hi all,
I need a solution of this requirement.
i have Table reqtab
Code sql:
sql>select * FROM reqtab;
REID EMAILADDRESS
72 [email][email protected][email]
72 [email][email protected][email]
75 [email][email protected][email]
75 [email][email protected][email]
now the requirement is:
---> i have to create a procedure which should takes 72, 75 as in parameter
and these procedure should compare emailaddress of 72, 75 and if this emailaddresses are not matching ,should update with unique mailids
for 72
i need the table should be updated in the following way
result should be
Code sql:
REID EMAILADDRESS
72 [email][email protected][email]
72 [email][email protected][email]
72 [email][email protected][email]
Thanks n Regards
LaxmanLAX_ORA wrote:
Hi all,
I need a solution of this requirement.
i have Table reqtab
Code sql:
sql>select * FROM reqtab;
REID EMAILADDRESS
72 [email][email protected][email]
72 [email][email protected][email]
75 [email][email protected][email]
75 [email][email protected][email]
now the requirement is:
---> i have to create a procedure which should takes 72, 75 as in parameter
and these procedure should compare emailaddress of 72, 75 and if this emailaddresses are not matching ,should update with unique mailids
for 72
i need the table should be updated in the following way
result should be
Code sql:
REID EMAILADDRESS
72 [email][email protected][email]
72 [email][email protected][email]
72 [email][email protected][email]
Thanks n Regards
LaxmanYou're talking of a combination of updates and deletes to your table.
You can define a query that can determine what action needs to be taken for each record e.g.
SQL> ed
Wrote file afiedt.buf
1 with t as (select 72 as reid, '[email][email protected][/email]' as emailaddress from dual union all
2 select 72, '[email][email protected][/email]' from dual union all
3 select 75, '[email][email protected][/email]' from dual union all
4 select 75, '[email][email protected][/email]' from dual)
5 --
6 -- END OF TEST DATA
7 --
8 ,req as (select 72 as reid from dual union all
9 select 75 from dual)
10 ,mreq as (select min(reid) as reid from req)
11 --
12 select t.reid, t.emailaddress, case when mreq.reid = t.reid then 'No Action'
13 when mreq.reid < t.reid and row_number() over (partition by t.emailaddress order by t.reid) =1 then 'Update to '||mreq.reid
14 else 'Delete'
15 end as action
16 from t join req on (t.reid = req.reid)
17 cross join mreq
18* order by 2
SQL> /
REID EMAILADDRESS ACTION
72 [email][email protected][/email] No Action
75 [email][email protected][/email] Delete
72 [email][email protected][/email] No Action
75 [email][email protected][/email] Update to 72
SQL>... and then action each of those as required.
Doing it in this way, having your required REID values in a table (temporary table or whatever) will allow the query to work for any number of such values e.g. here's an example with 3 of them...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 72 as reid, '[email][email protected][/email]' as emailaddress from dual union all
2 select 72, '[email][email protected][/email]' from dual union all
3 select 75, '[email][email protected][/email]' from dual union all
4 select 75, '[email][email protected][/email]' from dual union all
5 select 77, '[email][email protected][/email]' from dual union all
6 select 77, '[email][email protected][/email]' from dual)
7 --
8 -- END OF TEST DATA
9 --
10 ,req as (select 72 as reid from dual union all
11 select 75 from dual union all
12 select 77 from dual)
13 ,mreq as (select min(reid) as reid from req)
14 --
15 select t.reid, t.emailaddress, case when mreq.reid = t.reid then 'No Action'
16 when mreq.reid < t.reid and row_number() over (partition by t.emailaddress order by t.reid) =1 then 'Update to '||mreq.reid
17 else 'Delete'
18 end as action
19 from t join req on (t.reid = req.reid)
20 cross join mreq
21* order by 2
SQL> /
REID EMAILADDRESS ACTION
72 [email][email protected][/email] No Action
75 [email][email protected][/email] Delete
77 [email][email protected][/email] Delete
72 [email][email protected][/email] No Action
75 [email][email protected][/email] Update to 72
77 [email][email protected][/email] Update to 72
6 rows selected.
SQL> -
I attempted to compare two strings whether they are equal or not. They should return true if both are equal.
One string is based on Taxonomy's Term (i.e. Term.Name) whereas other string is based on String object.
The problem is that both strings which seem equal return false instead of true. Both string values have different special characters though their special characters are & and &
Snapshot of different design & same symbols:
Is it due to different culture or language?
How to compare two strings whether both are equal while ignoring the difference in special characters (& vs &)?Hi Jerioon,
If you have a list of possible ambiguous characters the job is going to be easy and if (& vs &) are the only charracters in concern awesome.
You can use the below solution.
Before comparing pass the variables through a replace function to standarize the char set.
$Var = Replace($Var,"&","&")
This is going to make sure you don't end up with ambiguous characters failing the comparison and all the char are "&" in this case.
Similar technique is used to ignore Character Cases 'a' vs. 'A'
Regards,
Satyajit
Please “Vote As Helpful”
if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you. -
How to compare Date/time string
I read from datalog file including Date/time string ,and want to query the special Date/time string span ,how to compare the data/time string ?
Hello Joshua,
To compare date/time you have to extract the different components (day, month, year, hour, minute, second) anyway. Why not "convert to seconds"? I think it's easier to compare one number (where you also can do other math, like calc the difference and so on) than to compare seven (?) parameters with some exceptions... If the dates are read from excel (there was a similar thread some days ago), why not convert to seconds in excel (just a format change)?
Best regards,
GerdW
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
How to compare the value of a specied attribute to a string
I am looking for an example of how to compare the value of an attribute to a string. (I think)
I have been trying to:
if (attrs.get("title")== "Vampire") -- you already know this did not work.
How can I check to see if the title="Vampire"?
The code below will get me the title of admin (which should be Vampire)
import javax.naming.Context;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.DirContext;
import javax.naming.directory.Attributes;
import javax.naming.NamingException;
import java.util.Hashtable;
class Giles {
public static void main(String[] args) {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://192.168.1.55:389/o=sunnydale");
try {
DirContext ctx = new InitialDirContext(env);
Attributes attrs = ctx.getAttributes("cn=admin");
System.out.println("Title: " + attrs.get("title").get());
ctx.close();
} catch (NamingException e) {
System.err.println("Problem getting attribute: " + e);
Thank you!!
SteveI guess, you are looking for searching for attributes of an user object.
Here is the sample code to list all the attributes of an 'user' objectclass.
Tell me if it helps or not.
import java.util.Hashtable;
import javax.naming.ldap.*;
import javax.naming.directory.*;
import javax.naming.*;
public class GetAttributes
public static void main (String[] args)
Hashtable env = new Hashtable();
//Must use either the userPrincipalName or samAccountName,
//Cannot use the distinguished name
String adminName = "cn=abcd,cn=Users,dc=ssotest,dc=com";
String adminPassword = "DEF1234";
String ldapURL = "ldap://pni3w067:389";
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,adminName);
env.put(Context.SECURITY_CREDENTIALS,adminPassword);
//connect to my domain controller
env.put(Context.PROVIDER_URL,ldapURL);
try {
// Create the initial directory context
DirContext ctx = new InitialLdapContext(env,null);
// Create the search controls
SearchControls searchCtls = new SearchControls();
//Specify the search scope
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user))";
//Specify the Base for the search
//cn=policygroup,ou=policyusers,ou=ssoanay,;
//String searchBase = "ou=policyusers,ou=ssoanay,dc=ssotest,dc=com";
String searchBase = "cn=abcd,cn=users,dc=ssotest,dc=com";
//initialize counter to total the results
int totalResults = 0;
// Search for objects using the filter
NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
//Loop through the search results
while (answer.hasMoreElements()) {
SearchResult sr = (SearchResult)answer.next();
totalResults++;
System.out.println("\nName of Object : " + sr.getName());
// Print out some of the attributes, catch the exception if the attributes have no values
Attributes attrs = sr.getAttributes();
//System.out.println("6");
if (attrs != null) {
try {
/*NamingEnumeration enum = attrs.getIDs();
while(enum.hasMore()) {
System.out.println("IDs:"+enum.next().toString());
NamingEnumeration enum2 = attrs.getAll();
while(enum2.hasMore()) {
System.out.println("Attribute - "+enum2.next().toString());
catch (Exception e) {
System.out.println("Exception:" +e.getMessage());
else {
System.out.println("attribute is null");
System.out.println("Total results: " + totalResults);
ctx.close();
catch (NamingException e) {
System.err.println("Problem searching directory: " + e);
//return 0;
} -
How come the JRE uses == to compare Strings?
I was looking through the source of javax.swing.plaf.basic.BasicComboBoxUI and came across this: public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
JComboBox comboBox = (JComboBox)e.getSource();
if ( propertyName == "model" ) {
else if ( propertyName == "editor" && comboBox.isEditable() ) {
else if ( propertyName == "editable" ) {
else if ( propertyName == "enabled" ) {
else if ( propertyName == "focusable" ) {
else if ( propertyName == "maximumRowCount" ) {
else if ( propertyName == "font" ) {
else if ( propertyName == JComponent.TOOL_TIP_TEXT_KEY ) {
else if ( propertyName == BasicComboBoxUI.IS_TABLE_CELL_EDITOR ) {
else if (propertyName == "prototypeDisplayValue") {
else if (propertyName == "renderer") {
}So
1) Is there a valid reason for the developer to have used == instead of .equals(...) to compare Strings?
2) How does the code work consistently with this anomaly?
Similar use of == and not .equals(...) is seen in many other swing classes.
Doesn't affect me, but I would be interested to know if anyone can throw some light on this.
Thanks, DarrylDarryl.Burke wrote:
DeltaGeek, thank you for your response.
Paul, I think I understand what you are saying, but the String reference propertyNamein this case comes from e.getPropertyName() from the PropertyChangeEvent class, not from within the BasicComboBoxUI class.
I gather that all loaded classes share the same String pool, and that's how this works correctly. But in that case any comparison of a String variable to a literal String using == should also work.
Then why the brouhaha about never using == to compare Strings?The key thing here is that the String returned by getPropertyName() must have come from a String literal. For example, in javax.swing.JComboBox:
firePropertyChange( "maximumRowCount", oldCount, maximumRowCount );This string literal will be the same instance as the string literal in the code you posted.
If they had instead done something like
String s = "RowCount";
boolean isMaximum = true;
firePropertyChange((isMaximum ? "maximum" : "minimum") + s, oldCount, maximumRowCount );In this case, the String literal "maximumRowCount" is not used, but rather created from a concatenation at runtime, so it's likely that the comparison would fail.
Note that the following would be the same String literal because this concatenation would be done at compile-time, not runtime:
"maximum" + "RowCount"As for why, I agree with DeltaGeek: performance. -
How to compare result from sql query with data writen in html input tag?
how to compare result
from sql query with data
writen in html input tag?
I need to compare
user and password in html form
with all user and password in database
how to do this?
or put the resulr from sql query
in array
please help me?Hi dejani
first get the user name and password enter by the user
using
String sUsername=request.getParameter("name of the textfield");
String sPassword=request.getParameter("name of the textfield");
after executeQuery() statement
int exist=0;
while(rs.next())
String sUserId= rs.getString("username");
String sPass_wd= rs.getString("password");
if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
exist=1;
if(exist==1)
out.println("user exist");
else
out.println("not exist"); -
Compare String in a table and insert the common values into a New table
Hi all,
Anyone has idea on how to compare a string value in a table.
I have a Students Table with Student_id and Student_Subject_list columns as below.
create table Students( Student_id number,
Student_Subject_list varchar2(2000)
INSERT INTO Students VALUES (1,'Math,Science,Arts,Music,Computers,Law,Business,Social,Language arts,History');
INSERT INTO Students VALUES (2,'Math,Law,Business,Social,Language arts,History,Biotechnology,communication');
INSERT INTO Students VALUES (3,'History,Spanish,French,Langage arts');
INSERT INTO Students VALUES (4,'History,Maths,Science,Chemistry,English,Reading');
INSERT INTO Students VALUES (5,'Math,Science,Arts,Music,Computer Programming,Language arts,History');
INSERT INTO Students VALUES (6,'Finance,Stocks');
output
Student_id Student_Subject_list
1 Math,Science,Arts,Music,Computers,Law,Business,Social,Language arts,History
2 Math,Law,Business,Social,Language arts,History,Biotechnology,communication
3 History,Spanish,French,Langage arts
4 History,Maths,Science,Chemistry,English,Reading
5 Math,Science,Arts,Music,Computer Programming,Language arts,History
6 Finance,Stocks
I need help or some suggestion in write a query which can compare each row string value of Student_Subject_list columns and insert the
common subjects into a new table(Matched_Subjects).The second table should have the below colums and data.
create table Matched_Subjects(Student_id number,
Matching_studesnt_id Number,
Matched_Student_Subject varchar2(2000)
INSERT INTO Matched_Subjects VALUES (1,2,'Math,Law,Business,Social,Language arts,History');
INSERT INTO Matched_Subjects VALUES (1,3,'History,Langage arts');
INSERT INTO Matched_Subjects VALUES (1,4,'History,Maths,Science');
INSERT INTO Matched_Subjects VALUES (1,5,'Math,Science,Arts,Music,Language arts,History');
INSERT INTO Matched_Subjects VALUES (2,3,'History,Langage arts');
INSERT INTO Matched_Subjects VALUES (2,4,'History,Maths');
INSERT INTO Matched_Subjects VALUES (2,5,'Math,Language arts,History');
INSERT INTO Matched_Subjects VALUES (3,4,'History');
INSERT INTO Matched_Subjects VALUES (3,5,'Language arts,History');
INSERT INTO Matched_Subjects VALUES (4,5,'Math,Science');
output:
Student_id Match_Student_id Matched_Student_Subject
1 2 Math,Law,Business,Social,Language arts,History
1 3 History,Langage arts
1 4 History,Maths,Science
1 5 Math,Science,Arts,Music,Language arts,History
2 3 History,Langage arts
2 4 History,Maths
2 5 Math,Language arts,History
3 4 History
3 5 Language arts,History
4 5 Math,Science
any help will be appreciated.
Thanks.
Edited by: user7988 on Sep 25, 2011 8:45 AMuser7988 wrote:
Is there an alternate approach to this without using xmlagg/xmlelement What Oracle version are you using? In 11.2 you can use LISTAGG:
insert
into Matched_Subjects
with t as (
select student_id,
column_value l,
regexp_substr(student_subject_list,'[^,]+',1,column_value) subject
from students,
table(
cast(
multiset(
select level
from dual
connect by level <= length(regexp_replace(student_subject_list || ',','[^,]'))
as sys.OdciNumberList
select t1.student_id,
t2.student_id,
listagg(t1.subject,',') within group(order by t1.l)
from t t1,
t t2
where t1.student_id < t2.student_id
and t1.subject = t2.subject
group by t1.student_id,
t2.student_id
STUDENT_ID MATCHING_STUDESNT_ID MATCHED_STUDENT_SUBJECT
1 2 Math,Law,Business,Social,Language arts,History
1 3 Language arts,History
1 4 Science,History
1 5 Math,Science,Arts,Music,Language arts,History
2 3 Language arts,History
2 4 History
2 5 Math,Language arts,History
3 4 History
3 5 History,Language arts
4 5 History,Science
10 rows selected.
SQL> Prior to 11.2 you can create your own string aggregation function STRAGG - there are plenty of example on this forum. Or use hierarchical query:
insert
into Matched_Subjects
with t1 as (
select student_id,
column_value l,
regexp_substr(student_subject_list,'[^,]+',1,column_value) subject
from students,
table(
cast(
multiset(
select level
from dual
connect by level <= length(regexp_replace(student_subject_list || ',','[^,]'))
as sys.OdciNumberList
t2 as (
select t1.student_id student_id1,
t2.student_id student_id2,
t1.subject,
row_number() over(partition by t1.student_id,t2.student_id order by t1.l) rn
from t1,
t1 t2
where t1.student_id < t2.student_id
and t1.subject = t2.subject
select student_id1,
student_id2,
ltrim(sys_connect_by_path(subject,','),',') MATCHED_STUDENT_SUBJECT
from t2
where connect_by_isleaf = 1
start with rn = 1
connect by student_id1 = prior student_id1
and student_id2 = prior student_id2
and rn = prior rn + 1
STUDENT_ID MATCHING_STUDESNT_ID MATCHED_STUDENT_SUBJECT
1 2 Math,Law,Business,Social,Language arts,History
1 3 Language arts,History
1 4 Science,History
1 5 Math,Science,Arts,Music,Language arts,History
2 3 Language arts,History
2 4 History
2 5 Math,Language arts,History
3 4 History
3 5 History,Language arts
4 5 History,Science
10 rows selected.SY. -
How to compare two excel files in java ?
how do i compare two excel files in java.?
I have two excel files stored on my computer in d: drive.
Ex:
D:\\file a
D:\\file b
How to compare the contents of these two files and print " files are equal " or "files not equal "Javamastermahe wrote:
I mean i want to print on the console "files are equal " or any message like " both the files match "If this is your requirement, this program satisfies it...
import java.util.Random;
public class SuperExcelTester {
public static void main(String[] args) {
Random rnd = new Random();
String[] messages = {
"files are equal",
"files are not equal",
"unexpected error"
int index = rnd.nextInt(messages.length);
System.out.println(messages[index]);
} -
How to compare table's date field with dropdown year field
Hi All,
I have one requirement to display the selected rows from a database table based on the selection of drop down.
Here, I have one dropdown of year(like 2009,2010,....) and I have one database table which contains one field with "DATE".
Now, I want to compare table's DATE field with my dropdown field.
Problem is that table's DATE field is of type "DATS" and dropdown is of type INTEGER(or) STRING ...
How to compare this fields?
Can any one please give me solution for this...!
Thanks in Advance!Hi sreelakshmi.B,
try the following:
DATA lt_dats TYPE TABLE OF dats.
DATA l_dat_i TYPE i.
DATA l_dat_c_4(4) TYPE c.
DATA l_dat_c_12(12) TYPE c.
DATA l_dats_from TYPE dats.
DATA l_dats_to TYPE dats.
*Move Date from Integer to Char
l_dat_c_4 = l_dat_i = 2005.
*Create Date From use in WHERE-Clause
CONCATENATE '01.01.' l_dat_c_4 INTO l_dat_c_12.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = l_dat_c_12
IMPORTING
date_internal = l_dats_from
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*Create Date To use in WHERE-Clause
CONCATENATE '31.12.' l_dat_c_4 INTO l_dat_c_12.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = l_dat_c_12
IMPORTING
date_internal = l_dats_to
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
* Select records in range
SELECT *
FROM [DBTAB]
INTO TABLE [ITAB]
WHERE [DATE] BETWEEN l_dats_from
AND l_dats_to.
Regards
REA -
How to compare date which is greatest date
iam new to sql
how to compare date which date is greatest date with example
can i use to_char to compare date
SELECT eno, ename, GREATEST (TBLE.MAX1, TBLE.MAX2) recent_date "
FROM (SELECT TBLA.eno, TBLA.ename, "
MAX (TO_CHAR (TBL.date1, 'MM/DD/YYYY HH24:MI') "
) MAX1, "
MAX (TO_CHAR (TBL.date2, 'MM/DD/YYYY HH24:MI') "
) MAX2 "
FROM dual TBL, dual2 TBLA
in above query if any one of the date having null value then recent_date is showing 'null'
and also it showing wrong value
example
date1='08-22-2009' and date2='01-23-2010' then it showing wrong recent_datel ike='08-22-2009'
as according my knowledge it is comparing with month it sholud not be like this wat i have to do pls explain with example my o/p should come for recent_date like =''01-23-2010''
Edited by: user9112274 on Aug 27, 2010 5:31 AMHi,
there are numerous ways to compare dates, i give you some examples:
with data_Sample as
(select to_date('01-jan-2001','dd-mon-yyyy') d1, to_date('01-mar-2002','dd-mon-yyyy') d2, to_date('03-feb-2002','dd-mon-yyyy') d3 from dual)
select greatest(d1,d2,d3) from data_Sample
GREATEST(D1,D2,D3)
3/1/2002
with data_Sample as
(select to_date('01-jan-2001','dd-mon-yyyy') d1 from dual union all
select to_date('01-mar-2002','dd-mon-yyyy') from dual union all
select to_date('03-feb-2002','dd-mon-yyyy') from dual)
select max(d1) from data_Sample
MAX(D1)
3/1/2002
declare
d1 date :=to_date('01-jan-2001','dd-mon-yyyy');
d2 date :=to_date('01-jan-2001','dd-mon-yyyy');
begin
if d1>d2 then
dbms_output.PUT_LINE('d1 greater than d2');
else
dbms_output.PUT_LINE('d1 less or equql than d2');
end if;
end;
output:
d1 less or equal than d2now concerning your question:
>
can i use to_char to compare date
>
If you have date data types : don't convert them.
if you have no choice, use something like:
if to_char(d1,'YYYYMMDD') > to_char(d2,'YYYYMMDD') then
else
end if;Take care when you convert a date into a char format it becomes string comparison (with all it implies) (It's the reason why i've use an explicit mask format). -
How to compare two files in java & uncommon text should print in text file.
Hi,
Can any one help me to write Core java program for this.
How to compare two files in java & uncommon text should print in other text file.
thanks
SamHi All,
i m comparing two HTML file.. thats why i am getting problem..
import java.io.BufferedReader;
import java.io.FileReader;
public class textmatch{
public static void main(String[] argv)
throws Exception{
BufferedReader fh =new BufferedReader(new FileReader("internal.html"),1024);
BufferedReader sh = new BufferedReader(new FileReader("external.html"),1024);
String s;
String y;
while ((s=fh.readLine())!=null)
if ( s.equals(y=sh.readLine()) ){
System.out.println(s + " " + y); //REMOVE THIS PRINTLN STATEMENT IF YOU JUST WANT TO SHOW THE SIMILARITIES
sh.close();
fh.close(); }
thanks
Sam -
How to compare two files in Java & uncommon text should print in Diff text
Hi All,
can any one help me to write a java program..
How to compare two files in Java & uncommon text should print in Diff text file..
Thanks
SamHi All,
i m comparing two HTML file.. thats why i am getting problem..
import java.io.BufferedReader;
import java.io.FileReader;
public class textmatch{
public static void main(String[] argv)
throws Exception{
BufferedReader fh =new BufferedReader(new FileReader("internal.html"),1024);
BufferedReader sh = new BufferedReader(new FileReader("external.html"),1024);
String s;
String y;
while ((s=fh.readLine())!=null)
if ( s.equals(y=sh.readLine()) ){
System.out.println(s + " " + y); //REMOVE THIS PRINTLN STATEMENT IF YOU JUST WANT TO SHOW THE SIMILARITIES
sh.close();
fh.close(); }
thanks
Sam
Maybe you are looking for
-
I'm looking over the flex dev guide http://livedocs.adobe.com/blazeds/1/blazeds_devguide/ but I really don't see the details of this covered. I have a single amf channel endpoint defined as such in my services-config.xml: <channel-definition id="emp-
-
Can't add row to sorted tabular form
I have a very basic tabular form created using the wizard. The only significant change I made was to the sort order. When I click on the add row button, the new blank row is created at the top of the table. When the number of rows in the table grew b
-
Custom Forms Event Handling in Service Manager
Hi geeks im trying to get the value of a TextBox in a custom form. This should be done automatically when the form has finished loading. The code works fine but just one time! If I close the form and reopen it, it will not assign the content of the T
-
Hello - I have a 20" imac - running leopard with everything up to date. I just got a canon sd750 digi camera and my 1st import to i photo of 7 pics resulted in 7 thumbs that looked like tv static and when I tried to display the pics, only 4 would sho
-
How do I show iCloud in dock?
Is there a way to display iCloud icon in the dock, without having to open Settings first?