How to compare time values
Friends
Could some one help me with Time values...
I would like to compare two time values one of which is stored as a string. so i would like to how to compare the system time with another column which has a string stored in time format..
i mean Sysdate - 10:30:00
Thanks in advance..
select 'Y' from dual
where to_char(sysdate, 'HH24:MI:SS') = '10:30:00'
SQL> ed
Wrote file afiedt.buf
1 select 'Y' from dual
2* where to_char(to_date('10-02-2006 10:30:00', 'DD-MM-YYYY HH24:MI:SS'), 'HH24:MI:SS') = '10:30:0
SQL> /
Y
SQL> Cheers
Sarma.
Message was edited by:
Radhakrishna Sarma
Similar Messages
-
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 to compare the values stored in the list
Hi,
I am having the requirement that i want to compare the values stored in the list.How to store the values in the list and compare the list values stored inside it.
Regards,
Ahamadhttp://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#sort(java.util.List)
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#sort(java.util.List,%20java.util.Comparator)
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Comparator.html
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Comparable.html -
How to compare, current value in :block.text_item with the database value
Hi
Could you please tell me
How to compare the current value in :block.text_item with the corresponding database column value.
I am using forms 10g
There is block and there is an text Item in that block.
When I run the form and query the block (tabular), the :block.text_item shows me, whatever value there in the database.
Now I add some value in the :block.text_item to the existing value.
now
the :block.text_item contains old+ new added value
whereas
the database table contains 'old' value
Now on a button click , I want to find out what is the value that I have added
Could you please tell me, is it possible without writing a select query?Hello,
Now on a button click , I want to find out what is the value that I have addedSo you mean always user will add value in the existing value. Because this way will fail in one case. Let say
Value in Database is = ABCD
User opened the form and he removed the D and write E and now value is ABCE and length is still same 4. So, there is no addition.
Anyway you can know the database value at runtime there is one property for item called DATABASE_VALUE. It gives the value which is in database while you are running the form before save. and you can use like this..
Trigger = WHEN-MOUSE-DOUBLE-CLICK on item level
DECLARE
vItemValue DATATYPE; -- Set the data type according to your desired field.
vValueAdded DATATYPE; -- Set the data type according to your desired field.
BEGIN
vItemValue:=GET_ITEM_PROPERTY('ITEM_NAME',DATABASE_VALUE); -- It will return you the database value in vItemValue variable.
IF LENGTH(vItemValue)>LENGTH(:FORM_ITEM_NAME) THEN -- It mean something change or added
vValueAdded:=SUBSTR(:FORM_ITEM_NAME,LENGTH(vItemValue)+1);
MESSAGE('Added value is : '||vValueAdded); -- It will show you the added value.
END IF;
-- now suppose you want to show the old and new value in message not the added one
-- Then no need of IF condition. You can just use message like this
-- And i would prefer to use like this way
MESSAGE('Old Value : '||vItemValue||' New Value - '||:FORM_ITEM_NAME);
MESSAGE('Old Value : '||vItemValue||' New Value - '||:FORM_ITEM_NAME);
END;Hope it is clear.
-Ammad -
How to use time values from graph or chart for other calculations
iam generating an ultrasonic signal of frequency 500k. In the equation i need the values of time axis of the graph or chart for calculationg the envelope of the graph. please help me how to use the x-axis time values.I have tried by writing in spread sheeet or by using arrays. here iam not able to get only 1 dim time values.
AshwiniPUse a property node
-
How to compare single value with multiple values
In my query I have something like this:
A.SOR_CD=B.SOR_CODE where A and B are 2 different tables. This condition is in the where clause. The column in table A has single values but some values in table B have multiple comma separated values (822, 869, 811, ..). I want to match this single
value on the left side with each of the comma separated values. Please let me know how will I be able to do it. The number of comma separated values on the right side may vary.Hi MadRad123,
According to your description, you want to compare single value with multiple values in your query. Right?
In this scenario, the table B has comma separated values, however those comma separated values are concatenated into a string. So we can use charindex() function to return the index of the table A value. And use this index as condition in
your where clause. See the sample below:
CREATE TABLE #temp1(
ID nvarchar(50),
Name nvarchar(50))
INSERT INTO #temp1 VALUES
('1','A'),
('2','A'),
('3','A'),
('4','A'),
('5','A')
CREATE TABLE #temp2(
ID nvarchar(50),
Name nvarchar(50))
INSERT INTO #temp2 VALUES
('1','a,A'),
('2','A,B'),
('3','c'),
('4','A,C'),
('5','d')
select * from #temp1 a inner join #temp2 b on a.ID=b.ID
where CHARINDEX(a.Name,b.Name)>0
The result looks like below:
Reference:
CHARINDEX (Transact-SQL)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
How to compare previouse value in pl/sql array
DECLARE
CURSOR stg_raw_cur IS
SELECT RAW_STG_ID,
DEVICE_CD,
MODEL_VERSION,
PLATFORM_CD,
PROFILE_COOKIE,
LOCATION_CD,
SAMPLE_RATE,
EVENT_TYPE_CD,
to_char(to_date(to_date(substr(EVENT_DATE_TIME,1,8),'yyyymmdd')-1 ||
'T' ||
substr(EVENT_DATE_TIME,10,8)
|| 'Z','DD-MON-RR"T"HH24:MI:SS"Z"'), 'YYYYMMDDYY"T"HH24:MI:SS"Z"' ) EVENT_DATE_TIME,
EVENT_SPECIFIC,
BATCH_ID,
DWH_ARVL_DT,
DWH_ARVL_DT_ID,
DWH_CREATE_DT from dwh_stg.stg_raw where batch_id >= 200
order by batch_id asc;
TYPE stgrawarr IS TABLE OF stg_raw_cur%ROWTYPE;
stg_raw_rec stgrawarr;
l_batch_id NUMBER :=0 ;
v_ctr NUMBER :=0;
l_temp_batch_id number :=0;
BEGIN
OPEN stg_raw_cur;
LOOP
FETCH stg_raw_cur BULK COLLECT INTO stg_raw_rec LIMIT 100;
EXIT
WHEN stg_raw_cur%NOTFOUND;
END LOOP;
CLOSE stg_raw_cur;
for i in stg_raw_rec.first..stg_raw_rec.last
loop
dbms_output.put_line('batch id is '|| stg_raw_rec(i).batch_id );
IF l_batch_id != stg_raw_rec(i).batch_id
then
dbms_output.put_line('Different');
end if;
l_temp_batch_id := stg_raw_rec(i).batch_id;
commit;
end loop;
END;
I want to compare previous value of stg_raw_rec(i).batch_id if differnet then increament the value
else leave the same.
thanks.Try this,
FOR i IN stg_raw_rec.FIRST .. stg_raw_rec.LAST
LOOP
IF l_temp_batch_id != stg_raw_rec (i).batch_id
THEN
--increment
l_temp_batch_id := l_temp_batch_id + 1;
END IF;
DBMS_OUTPUT.PUT_LINE ('batch id is ' || stg_raw_rec (i).batch_id||' unique batch id is '||l_temp_batch_id);
-- DBMS_OUTPUT.PUT_LINE ('batch id is ' || stg_raw_rec (i).batch_id);
-- IF l_batch_id != stg_raw_rec (i).batch_id
-- THEN
-- DBMS_OUTPUT.PUT_LINE ('Different');
-- END IF;
l_temp_batch_id := stg_raw_rec (i).batch_id;
COMMIT;
END LOOP; -
How to sum time values sorted by month/year?
I would like to sum time values that are sorted by month/year. (Concept is based on a pilot's logbook)
In Table 1, Column A is a date; Column B is the associated time value (duration).
In Table 2, I would like to Sum the time value of Table 1 Column B by month an year.
TABLE 1
Date
Time
Header 3
Jan 1, 2013
2:30
Jan 3, 2013
4:15
Jan 9, 2013
3:55
Feb 2, 2013
5:01
Feb 10, 2013
1:33
March 3, 2013
5:55
TABLE 2
Month/YR
Total Time
Header 3
Jan-13
10:40
Feb-13
6:34
Mar-13
5:55
Apr-13smash,
Here's an example of what can be done:
The formula in the Total column of Summary is:
=SUMIFS(Log :: B, Log :: A, ">="&A, Log :: A, "<"&EOMONTH(A, 0)+1)
The Month column of Summary is filled with a series of dates that can be formatted as Jan-13, etc, if you wish.
I used the 0h 0m format for the Durations to distinguish it from times.
Jerry -
I have a table with a column for duration of activities; boxes contain hours:minutes times such as 0:30, 1:45, 2:20 etc.
I'd like to be able to sum the column, giving the total time spent on each activity - the three numbers listed should sum to 4:35.
Advice would be welcome,
Thanks,
MikeQuestion asked and responded several times.
Why not search in the existing threads ?
In cells of column C the formula is:
=TIMEVALUE(B)
In D7 it is:
=TIME(0, 0, SUM(C3:C6)24*6060)
CAUTION, a time value can't be greater than 23:59:59 !
Yvan KOENIG (VALLAURIS, France) mercredi 30 septembre 2009 12:11:08 -
How to compare the value of a cell before changing and after changing.
Hey there,
Now I want to implement a JTable. And the requirement is that users can edit a cell in the Table only once. I think there are two possible ways. One is that after user edited a cell, I will set this cell read only. Another way is to compare the vaule before and after the changing. If it is different, then write back the previous value.
But I did not know how to implement in Java. Can anybody help me?
Thanks alot!
Shellyinevitably, you will have to save a before copy of
the data, what this many times amounts to is that you
will need to have 2 identical data structures before
you start or some type of locking mechanism for each
piece of data.Why is this inevitable? I don't see it as inevitable at all. In fact, it's quite simple to implement a TableModel that returns false when isEditable(int, int) is invoked for any cell that has already had setValueAt(Object, int, int) inovked on it, for example. Depending on the requirements and implementation a different methodology may be needed for determining when the edit has taken place, such as a custom editor that notifies the TableModel when stopCellEditing() is invoked. Heck, overriding editingStopped() in JTable to do it might even work.
So, create a TableModel that returns isEditabe(int, int) as true only if the cell hasn't been edited yet. The only problem to solve from there is how you know when it's been edited. I've already given you a few leads on that, it's not particularly hard but depending on your exact implementation it may require different solutions. -
How to compare 3 values in array
Hi all
This is my first post so please be tolerant
I need to find "bad values" in array, it will be easier to explain it using example so:
I have array like this: 0 0 0 0 0 0 0 0 5 0 0 0 0 <- so "5" is the bad value, my method is to check two of nearby values so x(i-1) = 0, x(i)=5 x(i+1)=0, and if checked value is more than 25% bigger or smaller it should be replaced by average of neighborhood.
next example: 0 1 2 3 4 9 6 7 8 <- bad value is 9, and result of my filter should be (4+6)/2 = 5
I've done it using formula node (not 20% and not average, but the point is the same) and it's working but now I want to do it without C and I had lots of problems with memory cause the size of array is 10000.
I attached vi and signal thah you can check that it's working fine
Thanks
Mike
Solved!
Go to Solution.
Attachments:
vi+signal.zip 62 KBMeeHow wrote:
next example: 0 1 2 3 4 9 6 7 8 <- bad value is 9, and result of my filter should be (4+6)/2 = 5
Shouldn't e.g. the value 4 be outside too, because the average of 3 and 9 (=5.5) is more that 25% different to 4?
Here is a quick draft comparing three versions (LabVIEW 8.2):
Your formula node version
the same algorithm in G
Something along the lines you are proposing here.
As you can see, the new idea is not quite satisfactory. It needs more thought. Still, these drafts should give you some ideas how to do it. Modify as needed.
Also your data is similar to a square wave and has these large step functions where the value changes dramatically. These should probably be ignored. Maybe you should look at the first derivative and replace parts where a large positive slope is immediately followed by a negative slope of similar size, for example.
You should also look at absolute steps instead of percentages. If you use percentages and the value is zero, everything is outside, because even 5000% of zero is still zero, right?
LabVIEW Champion . Do more with less code and in less time .
Attachments:
filter testMOD.vi 41 KB -
i want find out what value iam getting in run time , whether it is char or numewric ?
how to find out ?
Regards,
panduHi,
if typ = c then
dont display it.
possible values of type is given below
Identification Data Type
b Elementary type b
C Elementary type c
D Elementary type d
F Elementary type f
g Elementary type string
h Internal table
i Elementary type i
l Data reference
N Elementary type n
P Elementary type p
r Object reference
s Elementary type s
T Elementary type t
U Flat structure
v Deep structure
X Elementary type x
y Elementary type xstring
For more help press f1 on describe in se38 editor.
Regards
Sandipan -
How to show time values in a chart item of WAD 7.0?
Hi experts,
i have a keyfigure in time format hh:mm:ss. In the analyze item it is no problem to show the query results in this format. But in a chart for example line type the chart designer cannot resolve the values and all lines are down. In the chart wizard i can only choose between text, label and percent.
Have anyone an idea that can help?
take care
LeoHi Leo,
You can use Time Scatter Chart for this purpose.
Regards
Erwin -
How to compare the value node of a for-each-group with other for-each-group
Hello!
I have a report in Oracle BI Publisher (10.1.3.2) with several data set. My XML schema is something like
<DATA>
<PARAMETERS>
<MY_PARAMETERS>
<A_ID>12345</A_ID>
<DESCRIPTION>ABC</DESCRIPTION>
<VALUE>111111</VALUE>
</MY_PARAMETERS>
<MY_PARAMETERS>
<A_ID>12345</A_ID>
<DESCRIPTION>DEF</DESCRIPTION>
<VALUE>222222</VALUE>
</MY_PARAMETERS>
<MY_PARAMETERS>
<A_ID>67890</A_ID>
<DESCRIPTION>ABC</DESCRIPTION>
<VALUE>333333</VALUE>
</MY_PARAMETERS>
</PARAMETERS>
<NAMES>
<MY_NAMES>
<A_ID>12345</A_ID>
<NAME>ASDF</NAME>
</MY_NAMES>
<MY_NAMES>
<A_ID>67890</A_ID>
<NAME>EFGH</NAME>
</MY_NAMES>
</NAMES>
<VALUES>
<MY_VALUES>
<A_ID>12345<A_ID>
<VALUE>10987</VALUE>
<DESCRIPTION>ASDFG</DESCRIPTION>
</MY_VALUES>
<MY_VALUES>
<A_ID>12345<A_ID>
<VALUE>26385</VALUE>
<DESCRIPTION>EFGHI</DESCRIPTION>
</MY_VALUES>
<MY_VALUES>
<A_ID>67890<A_ID>
<VALUE>24355</VALUE>
<DESCRIPTION>ASDFG</DESCRIPTION>
</MY_VALUES>
</VALUES>
</DATA>
I'm trying to build a rtf template in Word using this XML schema. The "A_ID" nodes in each group in my data have the same value. I want for each "A_ID" take the respective values in /DATA/VALUES/MY_VALUES.
<?for-each-group:MY_PARAMETERS;./A_ID?>
<?for-each:current-group()?>
<?choose:?><?when: DESCRIPTION='ABC'?>
<?VALUE?>
<?end when?><?end choose?>
<?end for-each?>
<?for-each:current-group()?>
<?choose:?><?when: DESCRIPTION='DEF'?>
<?VALUE?>
<?end when?><?end choose?>
<?end for-each?>
<?/DATA/NAMES/MY_NAMES/VALUE?>
<?for-each-group:/DATA/VALUES/MY_VALUES;./A_ID?>
<?for-each:current-group()?>
<?choose:?><?when: DESCRIPTION='ASDFG'?>
<?VALUE?> <---------------- I obtain for this node the '24355' and '10987' values
<?end when?><?end choose?>
I want to know how to obtain only '24355' value, this is, the value for A_ID (/DATA/VALUES/MY_VALUES) = A_ID (/DATA/PARAMETERS/MY_PARAMETERS).
Can someone help me?CREATE OR REPLACE TRIGGER "TEST_TRG"
BEFORE UPDATE OF "STATUS"
ON "TABLE1"
FOR EACH ROW
BEGIN
IF (:NEW.status = 'HOLD')
THEN
INSERT INTO table2
(status
VALUES (:NEW.status
END IF;
END;You should learn how to write PL/SQL code.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.apress.com/9781430235125
http://apex.oracle.com/pls/apex/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
------------------------------------------------------------------- -
Hi All,
I have two tables - TABLE1 & TABLE2 and both the tables are having STATUS column. The requirement is like if the STATUS column of TABLE1 is updated as "HOLD" then the same value has to be updated to the STATUS column of TABLE2.
create or replace trigger "TEST_TRG"
BEFORE
update of "STATUS" on "TABLE1"
for each row
begin
if(:new.STATUS ='HOLD')then
insert into TABLE2 (STATUS)
value (:new.STATUS);
end if;
end;
COMPILATION ERROR:
Compilation failed, line 3 (02:40:14) The line numbers associated with compilation errors are relative to the first BEGIN statement. This only affects the compilation of database triggers.
PLS-00103: Encountered the symbol "{" when expecting one of the following: ( begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge The symbol "{" was ignored. Compilation failed, line 7 (02:40:14) The line numbers associated with compilation errors are relative to the first BEGIN statement. This only affects the compilation of database triggers.
PLS-00103: Encountered the symbol "}" when expecting one of the following: ( begin case declare else elsif end exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge The symbol "}" was ignored.
I am getting the compilation errors as above when the trigger is compiled. Can anyone please help me to correct it.
Thanks and Regards,
SuhasCREATE OR REPLACE TRIGGER "TEST_TRG"
BEFORE UPDATE OF "STATUS"
ON "TABLE1"
FOR EACH ROW
BEGIN
IF (:NEW.status = 'HOLD')
THEN
INSERT INTO table2
(status
VALUES (:NEW.status
END IF;
END;You should learn how to write PL/SQL code.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.apress.com/9781430235125
http://apex.oracle.com/pls/apex/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
-------------------------------------------------------------------
Maybe you are looking for
-
Report using either query or direct value
Hi, I'm using Reports 6i. I'm having a report in which most of the content is static text. only 1 or 2 values i'm fetching from database to fill up the content. I have a requirement like, if the user directly supply this value, then i have to run thi
-
SAX Parser throws NullPointerException
Hi. I'm using WLS6.1 SP1 built-in XML SAX parser. The code is like, SAXParserFactory factory = SAXParserFactory.newInstance(); XMLReader parser = factory.newSAXParser().getXMLReader(); // Add a error handler eh = new MyErrorHandler(); parser.setError
-
Hi each time i use my 4S phone a dial from the contact list, the phone will not select a communication mode, either normal speaker or handsfree (car), I have to force the phone into speaker mode and the back to normal mode before I can speak to or li
-
Single date dimension while creating Aggregate tables
hi Guys , I have single date dimension(D1-D) with key as date_id and granularity is day-level. I have fact table(F1-D) which gives daily transactions . Now i created three aggregate tables with F2-M(aggregated to monthly),F3-Q(Aggregated to quarterly
-
Also, when upgrading from Leopard to Snow Leopard, will I lose all the data that is currently on my hard drive?