How to find the difference between the two timestamp columns
Dear all,Please solve my problem,
I have Table name of the folder that has the following columns,
EmpID in the number column, timestamp dat
who has the following values
Expand | Select | Wrap | Line numbers
EmpID dat
====== ====
101 4/9/2012 09:48:54
101 4/9/2012 09:36:28
101 4/9/2012 18:16:28
101 4/10 / 2012 09:33:48
101 4/10 / 2012 12:36:28
101 4/10 / 2012 20:36:12
101 4/11 / 2012 09:36:28
101 4/11 / 2012 16:36:22
Here, I need to display the following columns
EmpID, min (DAT) as start, max (dat) as end and difference (max (dat) - min (dat) for each day,
for example,.
End difference EmpID Strart
101 4/9/2012 09:48:54 09/04/2012 18:16:28 8.28
Like this.
3 days different here is so it should return 3 discs with the mentioned columns above,
Please help me find it.
Thank you
Kind regards
Gurujothi
Published by: Gurujothi on April 25, 2012 04:45
Gurujothi wrote:
Dear Alex,
Thank you for your reply,
Depending on whether you are your quesy showing it in hour and minutes format its right but you mention all rows of the query
If the table has more than 3000 lines then how it is possible to write this much higher request,
my table with almost 3500 lines.You can make a few changes in the above query I posted the last I mentioned?
Thank you.
Published by: Gurujothi on April 25, 2012 23:18
Hello
You don't need to write whole records 3000 it... alex just wrote that for example have no table as your table...
so just use the under part of this query as in the previous post, alex:
select empid, trunc(dat),
min(dat) as start_dat, to_char(min(dat), 'hh24:mi:ss') as start_dat_part,
max(dat) as end_dat, to_char(max(dat), 'hh24:mi:ss') as end_dat_part,
max(dat)-min(dat) diff, to_char(max(dat)-min(dat), 'hh24:mi:ss') diff_part,
extract(day from max(dat)-min(dat)) || ' days'
|| ':' || extract(hour from max(dat)-min(dat)) || ' hours'
|| ':' || extract(minute from max(dat)-min(dat)) || ' mins'
|| ':' || extract(second from max(dat)-min(dat)) || ' sekas'
from trans
group by empid, trunc(dat)
hope this fixes your need
Tags: Database
Similar Questions
-
How to find the primary key columns in the tables in MS Access using SQL queries
How to find the primary key columns in the tables in MS Access using SQL queries
Hello
This is the forum for Windows Vista programs related issues.
For better assistance, please try instead the Forums in SQL Server .
Thank you! Vincenzo Di Russo - Microsoft MVP Windows Internet Explorer, Windows Desktop Experience & security - since 2003. ~ ~ ~ My MVP profile: https://mvp.support.microsoft.com/profile/Vincenzo
-
How to find the number of column under Basic forms
Hi all
There is the serial number in the pay_assignment_actions Table column
Through basic shapes where can I find the serial number column
Is someone can you please tell me what would be the navigation.
Thanks in advanceYou need to check the correct recording-
It would be visible only for those guys-Void Payment Ext/Manual payment Cheque writer Magnetic report
-
How to find the difference between standard edition and standard edition one
How to find the difference between oracle database standard edition and standard edition one 64 bit
(a) using sql
(b) using the configuration/installation filesHow to find the difference between oracle database standard edition and standard edition one 64 bit
(a) using sql
Select * the option of $ v;
(b) using the configuration/installation files
opatch lsinventory-details
-
How to find the relationship between the tables
Hello
I am working in Oracle R12
How to find the relationship between these tables INV_MIN_MAX_TEMP, po_requisition_lines_all and Per_all_people_f
These two tables, I joined with po_requisition_lines_all and Per_all_people_f To_person_id of PO and anyone HR table but I can't able to join this table with other tables INV_MIN_MAX_TEMP
concerning
Srikkanthsolved
-
How to find the ANGLE b/w two edges in Oracle Spatial
How to find the ANGLE b/w two edges on Oracle Spatial. I have two edge connected on the same node. I wanted to know the angle betwwn them. Can someone help me?Ok. My first example is an approximation. Further you get North or South of the Ecuador, gets the more vague.
This one should do the trick with some degree of precision.declare PI constant number := 3.14159265358979; g1 sdo_geometry; g2 sdo_geometry; g3 sdo_geometry; angle1 number; angle2 number; FUNCTION POINT(P_LAT IN number ,P_LONG IN number) RETURN MDSYS.SDO_GEOMETRY IS BEGIN -- we load both the ordinate array and the point type because some spatial functions show inconsistent behavior -- it is not important for this example, just something to be aware of return(mdsys.sdo_geometry(2001,8307 -- WGS84 ,mdsys.sdo_point_type(p_long,p_lat,null) ,mdsys.sdo_elem_info_array(1,2,1) ,mdsys.sdo_ordinate_array(p_long,p_lat))); END; begin -- For the example, project in WGS84 -- g1,g2,g3 could also come straight out of the database as sdo_geometry g1 := point(50, 7); -- Point A g2 := point(51, 7); -- Point B g3 := point(50,10); -- Point C angle1 := atan2(g2.sdo_point.x - g1.sdo_point.x, g2.sdo_point.y - g1.sdo_point.y); angle2 := atan2(g3.sdo_point.x - g1.sdo_point.x, g3.sdo_point.y - g1.sdo_point.y); -- depending on rotation and where we are on the planet, adjustments may be needed if angle1 < 0 then angle1 := angle1 + 2 * PI; end if; if angle2 < 0 then angle2 := angle2 + 2 * PI; end if; if angle2 < angle1 then angle2 := angle2 + 2 * PI; end if; dbms_output.put_line('Angle between the lines A-B and A-C: '|| round(sdo_util.convert_unit(angle2-angle1,'Radian','Degree'),1)); end;
Angle between the lines A-B and A-C: 90
-
What is the difference between these two series: ONE VIDEO and a VIDEO SN184?
Hello
Is anyone know the difference between these two serial numbers: A VIDEO and a VIDEO SN184?
Hi Lennart,
This might be useful: ONE VIDEO AND ONE NON-VIDEO
Kind regards
Sheena
-
What is the difference between these two triggers.
Hi guys,.
Can you please the difference between these two triggers:
A
VSCREATE OR REPLACE TRIGGER "T_CLIENT_STATUS_LOOKUP" before insert or update on "CLIENT_STATUS_LOOKUP" for each row begin if inserting and :new."CLIENT_STATUS_ID" is null then for c1 in (select "CLIENT_STATUS_LOOKUP_SEQ".nextval nv from dual) loop :new."CLIENT_STATUS_ID" := c1.nv; end loop; end if; end;
B
I created manually trigger B. But to trigger A, on APEX, we have created by APEX lookup table. Then, I got a relaxing by APEX. but I did not understand the difference.CREATE OR REPLACE TRIGGER "CLIENTS_TRG1" BEFORE INSERT ON ERP.CLIENTS FOR EACH ROW begin if :new.CLIENT_ID is null then select CLIENTS_seq.nextval into :new.CLIENT_ID from dual; end if; end;
Kind regards
FatehMy vote 2nd relaxation. Because in the first trigger you use ' before insert or update", but there is nothing so far...; Oracle must go in the PL/SQL engine for each update to the table without reason; There is nothing to update, you do not have to shoot. While in the 2nd you do something sensible; If client_id is null, it will go to search by sequence forward.
Concerning
Girish SharmaPublished by: Girish Sharma on June 9, 2012 13:06
Just paste your code into the code for easy reading tags:CREATE OR REPLACE TRIGGER "T_CLIENT_STATUS_LOOKUP" before insert or update on "CLIENT_STATUS_LOOKUP" for each row begin if inserting and :new."CLIENT_STATUS_ID" is null then for c1 in (select "CLIENT_STATUS_LOOKUP_SEQ".nextval nv from dual) loop :new."CLIENT_STATUS_ID" := c1.nv; end loop; end if; end; CREATE OR REPLACE TRIGGER "CLIENTS_TRG1" BEFORE INSERT ON ERP.CLIENTS FOR EACH ROW begin if :new.CLIENT_ID is null then select CLIENTS_seq.nextval into :new.CLIENT_ID from dual; end if; end;
-
What is the difference between these two JKM and when to use that one.
Please tell the difference between these two.
JKM Oracle compatible o JKM Oracle compatible (Date of update)Basic difference is in the obligation.
JKM Oracle compatible (Date of update) wants a DATE/TIMESTAMP column in the source tables (s) who will get inserted/updated updated by the source application. ODI will capture the data modified, based on the value of this column. Only the DELETION part requires a trigger to keep track of deletion happening at source one or more tables.
Where as JKM uniform Oracle does not require any which TIMESTAMP column in the tables of the source (s). It uses triggers to keep track of the INSERT/UPDATE/DELETE happening in the source.
Compatible JKM Oracle performance (Update Date) is preferable, because it will create a little over the head on your source system. SO if you have a DATE/TIMESTAMP column in the tables of the source (s) that gets inserted/updated by the source application, then go JKM Oracle compatible (Date of update).
Otherwise search JKM consistent Oracle.
Thank you
Fati -
How to find the point of intersection of the two geometry?
Hello
Could someone give some suggestions on how to find the point of intersection of the two geometry?
I need just point. (x, y, z)
Thank youCan you post the full result of geometry returned?
What you should have as a result:
MDSYS. SDO_GEOMETRY (2001, 1, NULL, MDSYS.) SDO_ELEM_INFO_ARRAY (1,1,1), MDSYS. SDO_ORDINATE_ARRAY (2.0,2.0))
Notice the sdo_intersection will use only the sdo_ordinate_array, even if the result is a point! (with the SDO_POINT is NULL.)
where do you find these x, y, z values of?
On your other question:
-using the operator space sdo_relate (with mask = ANYINTERACT) will return in pairs, the result of the intersection of each anyinteracting polygon, line combination.
-of course, these results will vary from point, multipoint, line or multiline even depending on how the interaction takes place.
-try to explain a bit more what do you mean 'I want only points to return' of nit.
Luke
-
Hi Member
I have download the LabVIEW Machine https://decibel.ni.com/content/docs/DOC-19328 learning package
I want to run the K average algorithm to group the image in a group of two or three or more
the problem is how to find the result I mean the image of clustred', the image that contain 2 or three threatened value only
or how aasign a 1 value for all the intesity who
belong to the cluster a and 255 for data that belongs to group 2
for the look of the image as binary image?
a my vi below
Best regards
my post before shows how to set the threshold manually using the slider of the graph.
Here is the version k-means automated help .vi box tools
Alex
-
question about how to combine the two scripts.
HelloI have a sql script that can display a table (or view) all the information, it works fine. I call it validate_table.sql, as below:
command prompt
accept invites owner "Enter table owner:
accept invites from TABLE_NAME "Enter object (table/View...) "name:"
column owner format a10 column 'owner '.
column format a30 topic 'Object name' object_name
column object_type format a15 direction "Type of object".
Status format a10 column titled "Status".
in the heading of column created format a20 "created."
the LAST_DDL_TIME format a20, heading 'LAST_DDL_TIME.
Select
owner
object_name
object_type
status
, to_char (created, "DD_MON_YY hh24:mi:ss") created
LAST_DDL_TIME,
Of
DBA_OBJECTS
where
object_name = upper ('& table_name') and owner = upper ('& owner');
command promptprompt -- ----------------------------------------------------------------------- ---
Guest - table/view structure-
prompt -- ----------------------------------------------------------------------- ---
command prompt
describe and owner... & table table_namecommand prompt
prompt -- ----------------------------------------------------------------------- ---
guest - list assigned user/subsidies-
prompt -- ----------------------------------------------------------------------- ---
command prompt
set pagesize 50000
set linesize 10000
set verify off
Set feedback off
column lvl format A4 direction "Lvl".
proprietary format of columns A14
format column in table_name A29
A38 dealer column format
column privilege A10 format
SELECT 'Role' lvl, t.table_name, t.grantee, t.owner, t.privilege
OF dba_tab_privs t
WHERE t.grantee IN (SELECT FROM dba_roles role WHERE = role t.grantee) and t.table_name = upper ('& table_name') and t.owner = upper ('& owner')
UNION
SELECT 'User' lvl t.table_name, t.grantee, t.owner, t.privilege
OF dba_tab_privs t
WHERE t.grantee IN (SELECT username FROM dba_users WHERE username = t.grantee) and t.table_name = upper ('& table_name') and t.owner = upper ('& owner')
UNION
SELECT 'Pub' lvl, t.table_name, t.grantee, t.owner, t.privilege
OF dba_tab_privs t
WHERE t.grantee = 'PUBLIC' and t.table_name = upper ('& table_name') and t.owner = upper ('& owner')
ORDER BY 1, 2, 3;command prompt
prompt -- ----------------------------------------------------------------------- ---
guest - list of synonyms created.
prompt -- ----------------------------------------------------------------------- ---
command prompt
proprietary format of columns A15
synonym_name A20 column format
A15 table_owner column format
format column in table_name A40
DB_link A40 column formatSelect the owner, synonym_name, table_owner, table_name, DB_link from DBA_synonyms where Table_name = upper ('& table_name') stopped by the owner;
command promptprompt -- ----------------------------------------------------------------------- ---
guest - list index created-
prompt -- ----------------------------------------------------------------------- ---
command prompt
Select
table-name
index_name
index_type
nom_tablespace
status
of DBA_indexes
WHERE table_name = upper ('& table_name') and owner = upper ('& owner')
order of table_name, index_name;
command promptprompt -- ----------------------------------------------------------------------- ---
guest - list of constraints-
prompt -- ----------------------------------------------------------------------- ---
command prompt
format column in table_name A15
format of column cons_type A15
cons_name A20 column format
check_cons A25 column format
VALIDATED A20 column format
column status A10 format
last_change A20 column formatSelect
table-name
(case constraint_type
When 'P', then 'Primary Key '.
When 'R' then 'Foreign Key'
When 'C' then 'check '.
When 'U' then 'single '.
When 'o' then 'read only display '.
When 'V' then 'check the view. "
When 'H' then 'Hash expression. "
When 'F' then 'REF column.
When the of ' then 'additional logging.
cons_type end)
constraint_name cons_name
condition_de_recherche check_cons
status
VALID
last_change
of dba_constraints
where owner = upper ('& owner')
and table_name = upper ('& table_name')
order of cons_type;I have another script that allows to display the newly created tables (table, table names) in the last 24 hours.
SET SERVEROUTPUT ON;
DECLARE
CURSOR tmp_cur IS
SELECT master, object_name
FROM dba_objects
WHERE object_type in ('TABLE', 'SEE') and the owner not in ('SYS', 'SYSTEM', 'GENERAL', "XDB", "OUTLN", "SYSMAN") and last_ddl_time > sysdate - 1;
tmp_rec tmp_cur % ROWTYPE;
BEGIN
FOR tmp_rec IN tmp_cur LOOP
DBMS_OUTPUT. PUT_LINE)
tmp_rec. Owner | ' ' || tmp_rec.object_name);
END LOOP;
END;
/
The gap of the first script (validate_table.sql) is that it can only check table one by one by manual entry, then how can I combine these two scripts, to make a scipt that can check all newly created tables (not a table) in the last 24 hours?
I thank very you much in advance!
Hello
If you already know how to find the owner and all the tables created table_name recently. One thing you can do is to change all the WHERE clauses in validate_table.sql, so instead of things like
where object_name = upper ('& table_name') and owner = upper('&owner');
you say
WHERE (owner, object_name) IN
(
SELECT master, object_name
FROM dba_objects
WHERE object_type in ('TABLE', 'SEE')
AND owner NOT IN ('SYS', 'SYSTEM', 'GENERAL', "XDB", "OUTLN", "SYSMAN")
AND last_ddl_time > SYSDATE - 1
)
;
Here is another approach:
Validate_table. SQL is quite handy as it is. You may want to run this script for tables, even when you know that they are not new. Divide into 2 scripts: one called ask_and_describe_table.sql, which looks like this:
-Ask_and_Describe_Table.sql
accept invites owner "Enter table owner:
accept invites from TABLE_NAME "Enter object (table/View...) "name:"
-You can use any name path instead of d:\some_dir below:
@d:\some_dir\describe_table & owner, table_name
and the other one called Describe_Table.sql, which starts like this:
-Describe_Table.sql
DEFINE owner = & 1
DEFINE table_name = & 2
column owner format a10 column 'owner '.
...
and continues with the same exact content as validate_table.sql.
Now, to write another script (I'll call it Describe_Recent_Tables.sql):
-Describe_Recent_Tables.sql - create and run Describe_Many_Tables.sql
-Turn OFF the devices designed to help people to read the output:
SET ECHO OFF
SET FEEDBACK OFF
SET PAGESIZE 0
VERRIFY OFF SET
-Create a Describe_Many_Tables.sql:
COIL d:\some_dir\describe_many_tables.sql
SELECT ' @d:\some_dir\describe_table '
|| owner
|| ' '
|| object_name
FROM dba_objects
WHERE object_type in ('TABLE', 'SEE')
AND owner NOT IN ('SYS', 'SYSTEM', 'GENERAL', "XDB", "OUTLN", "SYSMAN")
AND last_ddl_time > SYSDATE - 1;
SPOOL OFF
-Features lighting designed to help people to read the output:
SET ECHO ON
SET FEEDBACK ON
SET PAGESIZE 50
SET VERRIFY ON
-Describe_Many_Tables.sql performance
@d:\some_dir\describe_many_tables
I guess that all of your tables have standard names (for example, start with a letter, no spaces in the name,...), which don't require quotation marks. If they could, then the same basic approach will work, but the details are a little messier.
When you want to see the information on a single table or view, no matter how old it is, driven
Ask_and_Describe_Table
or, if you do not need to question the owner of the table and the name, something like
Describe_Table SCOTT EMP
(You can find that you really need not Ask_and_Describe_Table.sql).
When you want to do this for all the tables created in the last 24 hours:
Describe_Recent_Tables
-
Is it possible to find the two sentences into one pdf file? For example, I know the words 'Here' and 'the answer' occur more than once in my document, but only once on the same page. I'm looking for this page.
I tried to do this by using the search but it will find only them, if they occur as a long chain, that is to say "Here's the answer" rather than how they occur in the document it is to say "Here 's" a bunch of information that leads you to 'the answer'. The search feature so standard did not help.
Then I tried to do this by using the tool to delete (obviously not the application of writing!) because it allows me to search for multiple words or phrases, however it is not highlight what page both are found. I tried to turn on the preference to enable deletions of comments and even if it meant that I could then go through all the comments, it's still not faster than my document is more than 1,000 pages, which meant there were too many total comments for me to be able to easily identify which page had both.
Any ideas?
There is no built-in way to search for two strings and limited to show only the results that appear on the same page.
It can be done by using a custom script, however.
-
How to find the name of the Oracle database server?
People,
Hello. I installed Oracle Database 11 g 2 OS Oracle Linux 5. The installed directory is/home/user/OracleDB_Home and/home/user/OracleDB_Base.
Host name is "mylinux". Name of the database instance is PT853.
I use "mylinux" as the name of the database server, it does not work. I use another way to do as below:
Export ORACLE_HOME = / home/user/OracleDB_Home
Can I use "mylinux ORACLE_HOME" as the name of the database server, it does not work either.
My question is:How to find the name of the database server Oracle with Oracle Linux 5 OS?
Thank you.You must learn the basic of database Oracle.
Please don't regard it not same as SQL server in terms of configuration.
You never specify the database server name in Oracle.
You specify the host name in only two places, 1) Tnsnames.ora/JDBC/ODBC (or any client you want to connect) and listener.ora) 2.
There was nothing called specify the name of the Oracle database from an oracle database server.
Concerning
Anurag.
-
How to find the last pasted paragraphs FMP?
I'm sticking FMP several objects at once in a file (a file of changes to the sections containing the changebars) in the main text flow. I want a separator line to go at the end of each pasted section, so I try to insert one after the paste operation. But instead of a line between each section, all lines are added at the end of the file, after all the sections. So if there are 3 glued sections at the end of the file are three lines. My code is below, do you know how I could fix this?
Thank you, Mark
function copyPasteChanges (doc, chgRange) {}
Select the section with changebar and copy it.
doc. TextSelection = chgRange;
doc. Copy();
Prepare for the changes doc and paste there the modified section.
var firstChgPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;
var changesTloc = new TextLoc (firstChgPgf, Constants.FV_OBJ_END_OFFSET);
var changesTRange = new TextRange (changesTloc, changesTloc);
changesDoc.TextSelection = changesTRange;
changesDoc.Paste ();
To go at the end of the file again (I think)
var lastPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;
var dividerPgf = changesDoc.NewSeriesPgf (lastPgf);
var TLoc = new TextLoc (dividerPgf, 0);
changesDoc.AddText (TLoc, '_');
}
Hi Mark,
The problem is that the dough does not occur when you think. The dividing line is added at the end of the file, but are not your actions of dough. Actually, I think that maybe a little random where pasta is produced, because this line:
var changesTloc = new TextLoc (firstChgPgf, Constants.FV_OBJ_END_OFFSET);
.. .is does not create a valid text location. You can check this by abandoning the service after:
changesDoc.TextSelection = changesTRange;
.. and look at where's the insertion point. It will probably be everywhere where you left it last, because the call is not valid. I can't tell you exactly why, except that it has something to do with the fact that you are using the last paragraph in the stream. There is something weird to try to define a range of full-paragraph text with the last paragraph. I'm sure it's related to how the last TFP in a stream does not show a mark of FMP, but beyond that, I don't know how to do what you're trying to do with the last paragraph.
Having no knowledge of how do it right, any time I need to do this, I create a paragraph "dummy" at the end of the flow to fill that space strange 'last FMP", then do the work around it. In the end, I just want to remove fake TFP. I don't know if it's a good idea or not, but it's the only way I ever get it to work and it sorts the mirror how you could do this manually in the GUI.
With this, I modified your script as follows, and it seems to work better. Note that I also modified the logic of how to find the last paragraph of the flow by writing a separate function. Your call to the 'FirstTextFrameInFlow' is OK, unless your doc begins to span several pages and/or begins with several empty pages. The function I wrote ensures that you really the last TFP in the stream.
I hope this helps.
Russ
function copyPasteChanges (doc, chgRange) {}
Select the section with changebar and copy it.
doc. TextSelection = chgRange;
doc. Copy();
Prepare for the changes doc and paste there the modified section.
var lastPgf = getLastPgf (changesDoc);
var dummyPgf = changesDoc.NewSeriesPgf (lastPgf);
var changesTloc = new TextLoc (dummyPgf, 0);
var changesTRange = new TextRange (changesTloc, changesTloc);
changesDoc.TextSelection = changesTRange;
changesDoc.Paste ();
To go at the end of the file again (I think)
Don't forget that last TFP is now fake TFP
lastPgf = getLastPgf (changesDoc);
var dividerPgf = changesDoc.NewSeriesPgf (lastPgf.PrevPgfInFlow);
var TLoc = new TextLoc (dividerPgf, 0);
changesDoc.AddText (TLoc, '_');
dummyPgf.Delete ();
}
function getLastPgf (doc)
{
textFrame var is doc. MainFlowInDoc.LastTextFrameInFlow;
var lastPgf = textFrame.LastPgf;
While (! lastPgf.ObjectValid () & textFrame.ObjectValid ())
{
textFrame = textFrame.PrevTextFrameInFlow;
lastPgf = textFrame.LastPgf;
}
Return lastPgf;
}
Maybe you are looking for
-
The OE Mail recover after the damage caused by the virus.
My PC has just blown to bits by a virus.I hope to be able to save the data files, including those that define the accounts rules, for example, and contain emails.How can I restore my EYE as much as possible in its original configuration and emails us
-
T500 swtichable fuzzy on external monitor
Hello I have a T500 and graphics switchable, updating all the drivers. I'm using a samsung syncmaster 931b monitor attached to a lenovo docking station. When I use graphics performance, it works fine. When I pass the energy-saving intel, everything b
-
Cannot open from Big Fish games
I was a member of Big fish for years, this is the first problem I've had. When I try to open a game, he appears in a box and said:drmactivator application does not, or127.0.0.1 port 4664 does not apply and at the same time myWindows Defender Update
-
Windows 7 not genuine message! How should I do?
I ran the diagnostic tool and really hoping you could help me? Diagnostic report (1.9.0027.0):-----------------------------------------Validation of Windows data--> Validation code: 50Validation caching Code online: n/a, hr = 0xc004f012Windows produc
-
On the function of Date selection?
Hello I've been looking for a while now, and I've not found anything. I have a DateField and I want to call a function when the user changes the date in this field (I want to update certain content in an ObjectChoiceField). Is there a good way to do