Getting the length between two points
Hi All,
I am trying to get the distance between two points and came across the SDO_LENGTH function in the manual - however there is no example on how to use it.
I was expecting the following statement to return me the value 9 but instead I am getting errors along the lines of SDO_GEOM.SDO_LENGTH must be declared etc.
=============================================
SDO_GEOM.SD0_LENGTH(
MDSYS.SDO_GEOMETRY(2
,NULL
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(1,1,10,10))
,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.0001)
,MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.0001))
============================================
what am I missing
any help appreciated
Brent Glover
I think I have found my answer
============================================
DECLARE
v_length NUMBER;
BEGIN
v_length := SDO_GEOM.SDO_LENGTH(
MDSYS.SDO_GEOMETRY(2
,NULL
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(1,1,10,10))
,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.0001)
,MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.0001))
DBMS_OUTPUT.put_line(v_length);
END;
=============================================
Similar Messages
-
How to get the difference between two columns in a column group
Hi All,
My first time here and really new to programming. I would like to get the difference between 2 columns that are inside
a column group.
Here is my sample table below: The Column Group is PeriodNumber and can only choose 2. like 1 and 2.. I would like to have a third row which will simply calculate the difference between the amounts in PeriodNumber 1 and 2.
PeriodNumber
Account 1 2
1) Cash 10,000 15,000
2) Receivables 12,000 11,500
3) Equipment 5,000 5,500
Total Assets 27,000 32,000Hi yabgestopa,
From your description, you want to get the difference between two columns in a column group. After testing it in my environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
Dim Shared Num1 As Integer
Dim shared Num2 As Integer
Public Function GetAmount(Amount as Integer, Type as String)
If Type = "1" Then
Num1=Amount
Else
Num2=Amount
End If
Return Amount
End Function
Public Function GetDif()
Return Num1-Num2
End function
Right-click the second column to insert a third column with Outside Group-Right.
Then use the expressions below in the matrix.
=Code.GetAmount(Fields!Amount.Value,Fields!PeriodNumber.Value)
=code.GetAmount(Sum(Fields!Amount.Value),Fields!PeriodNumber.Value)
=Code.GetDif()
The report looks like below.
If you have any questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Java code to get the difference between two dates in days
Hi ppl,
I need to write a user defined function to get the difference between two date nodes, in days.Please help me out
regards,
PrashanthHi,
have a look at those two:
(How do I calculate the difference between two dates?)
http://joda-time.sourceforge.net/faq.html
Calculating the Difference Between Two Datetime Stamps
http://www.xmission.com/~goodhill/dates/deltaDates.html
Get difference in days
http://javaalmanac.com/egs/java.util/CompDates.html
Regards,
michal -
Trying to Get the "Difference" Between Two Tracks
What I am trying to accomplish is this: I have an audio track of a voiceover with a music bed beneath it. I also have the bed music by itsself, without the voiceover. I want only the voice portion. Is there a way that I can "cancel out" the music portion or get the difference between the two tracks (just the voice portion)? It seems that there should be some means of doing this, but for the life of me I cannot figure out how to do it!
Any advice?If it's exactly the same music track, then as long as you line it up sample-accurate and the levels co-incide, you can do a simple subtractive process. You need both files available, trimmed to length. Open them both in Edit View, and copy one of them to the clipboard. Open the other, and select Mix-paste, and use the 'invert' option. That will effectively subtract one from the other, with the difference being your vocal.
Have to tell you though that the chances of getting this spot on are amazingly low... any errors at all leave you with bleed-through, about which you can do nothing. -
How do you find the average value of all the data between two points on a single channel
I am tring to calculate the average value of all the data points on a single plot between two seperate points
I have attahced an illustration.
Tim
Solved!
Go to Solution.
Attachments:
plot.jpg 173 KBHey smoothdurban,
I've seen Brad's code, and trust me, it's worth the effort to let him help you get it up and running - it's definitely the most ideal way to solve this problem. However, as Brad said, there are multiple ways to tackle this - both interactive and programmatic - so in the meantime, I'll take a second to detail one of the interactive and sure-fire ways to find the average of data between two points on a single channel.
We'll use"Flags." Set up your VIEW graph exactly as you did on your original screenshot, using Band Cursors to approximate the beginning and ending X-values representing the range you want to examine. Next:
1. Click the "Set Flags" button () that is a part of your 2D Axis System. Note that you can hold down the Shift button if you ever decide you want to do this on more than a single curve at one time.
2. Select the "Flags: Copy Data Points" button that enables after Flags are set.
3. This creates new channel(s) in the default (bold) group in the Data Portal that contains only the Flagged data.
4. Select DIAdem ANALYSIS.
5. Select Statistics » Descriptive Statistics.
6. In the Channels input, select the newly created channel containing your Flagged Y-Data.
7. Ensure that the Arithmetic Mean parameter is set. You can preview the data and the result in the dialog before pressing OK to execute the calculation.
You may have noticed that in the Descriptive Statistics calculation, one of the parameters that you can set is the range of channel rows to operate on - so, if you know the row numbers of your beginning and ending X-values, you could just simply run the Descriptive Statistics calculation and use this parameter to operate on a row subset of your original channel instead of the entire channel.
Derrick S.
Product Manager
NI DIAdem
National Instruments -
How to get the difference between two date
Hello,
I want to know how to write a code the tell me the difference between two date, I am using
oracle.jbo.domain.Date
i have a rent date and return date so my code is
Date rent=(Date)nr.getAttrbute("RentDate"),ret=(Date)nr.getAttrbute("ReturnDate");
is there a way to know the difference in days between those two dates ?
Thankshi,
try this.....
DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
Date date = (Date)formatter.parse(dateStr); //// dateStr <- from date value (that is string value)
Date dateto = (Date)formatter.parse(datetostr); //// datetostr <- to date value (to date getting from as a string)
Calendar cal = Calendar.getInstance();
cal.setTime(date);
Calendar calto = Calendar.getInstance();
calto.setTime(dateto);
fromDate = cal.get(Calendar.DATE) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR);
toDate = calto.get(Calendar.DATE) + "/" + (calto.get(Calendar.MONTH) + 1) + "/" + calto.get(Calendar.YEAR);
// System.out.println("from Date : " + fromDate);
if ((fromDate != null && toDate != null) && (date.compareTo(dateto) > -1) ) {
fc.addMessage("VacationQueryComponent", new FacesMessage(FacesMessage.SEVERITY_ERROR, "From Date cannot be lower than To Date", "From Date cannot be lower than To Date"));
fc.renderResponse();
thks. -
How to get the data between two dates?
Hi all,
I am facing a problem of getting the data betwwen two dates.
I have written a query as
"select * from table1 a where a.dt between trunc(sysdate) and trunc(sysdate)-30"
It is not showing any errors or warnings.But the data is not coming though the data is in the table1 between these two dates.
Regards,
KumarYour ordering is probably wrong:
SELECT *
FROM table1 a
WHERE a.dt BETWEEN TRUNC (SYSDATE) - 30 AND TRUNC (SYSDATE) -
How to get the difference between two HashMaps
i have two HashMaps
HashMap first = new HashMap<Integer,Object>();
HashMap second = new HashMap<Integer,Object>();
How to get the difference between one and two and put the result in the third
HashMap third = new HashMap<Integer,Object>();My bad, difference of course means removeAll():Map<Integer,Object> first = new HashMap<Integer,Object>();
Map<Integer,Object> second = new HashMap<Integer,Object>();
Map<Integer,Object> third = new HashMap<Integer, Object>(first);
third.keySet().removeAll(second.keySet());No loops needed. -
Function Module to get the difference between two times.
Hi All,
I want to know if there is any function module that gives me the difference between two specified times.
For Ex: Time 1: 12/01/2007 00:01 A.M
Time 2: Time 1 - 180 Seconds. This changes the time, also may even change the Date. (As in above situation, the Time 2 will be 11/30/2007 11:58 P.M)
Could some one please suggest if there is any function module for this case.
Thanks in Advance.Hi, You can use the following function module to calculate the diffrence between to dates in the unit that you want.
COPF_DETERMINE_DURATION calculates the difference between two dates and time in minutes and hours.
Parameters:
EXPORTING
I_START_DATE "The start date of the time interval
I_START_TIME "The start time of the time interval
I_END_DATE "The end date of the time interval
I_END_TIME "The end time of the time interval
I_UNIT_OF_DURATION "Time unit of the duration if not to be calculated in days.
Value ===== Meaning
' ' ===== Day (default)
D ===== Days
H ===== Hours
MIN ===== Minutes
MON ===== Months
S ===== Seconds
WK ===== Weeks
YR ===== Years
I_FACTORY_CALENDER "A factory calender if not using the Gregorian calender
IMPORTING
E_DURATION "Time difference in unit specified.
Message was edited by:
Rajesh Soman -
Need to get the difference between two period
Hi All,
I need to get the difference of two posting period like period is in format YYYYMM.
I need to subtract posting perid '200512' FROM '200601' how will be it possible.
Please suggest.
Thanks,
SandyHi,
YOu can also do like the following.
Determine you first day of first period and last day of second period.
data: first_day type datum,
last_day type datum,
days type i.
first_day = date from FM RKE_GET_FIRST_DAY_IN_PERIOD
last_day = date from FM RKE_GET_LAST_DAY_IN_PERIOD
days = last_day-first_day.
Thanks,
Ramakrishna -
How to get the dates between Two dates excluding Saturaday and Sunday
Dear All,
select to_date('25-04-2012', 'DD-MM-YYYY') + rownum -1 dt
from dual
connect by level <= to_date('05-05-2012', 'DD-MM-YYYY') - to_date('25-04-2012', 'DD-MM-YYYY') + 1;The above query returning the following output,
DT
DT
04/25/2012
04/26/2012
04/27/2012
04/28/2012
04/29/2012
04/30/2012
05/01/2012
05/02/2012
05/03/2012
05/04/2012
05/05/2012here I need to exclude the Dates which comes on 'saturday' and 'sunday' and also the common holiday
Here it is '01-May-2012' and I need the output like the following,
04/25/2012
04/26/2012
04/27/2012
04/30/2012
05/02/2012
05/03/2012
05/04/2012I need the common query to calculate between any two dates.
Can anyone suggest me?
Thank you,
Regsrds,
gurujothiHi Frank,
Sorry for my fault,
The following is my table description,
CREATE TABLE "DATES"
( "FROMDATE" DATE,
"TODATE" DATE,
"LEAVE_ID" Number(5)
Insert into dates values('05-02-2012','05-05-2012',1);
Create table holiday_dates(holidays date);
insert into holiday_dates values('01-05-2012');Now when I used this query,
select count(*) from (select dt
from(
select to_date(fromdate, 'DD-MM-YYYY') + rownum -1 dt
from dates
connect by level <= to_date(todate, 'DD-MM-YYYY') - to_date(fromdate, 'DD-MM-YYYY') + 1
where to_char(dt,'fmday') not in ('sunday','saturday') minus (select holidays from holiday_dates)) dual;
Count(*)
64
Insert into dates values('01/05/2012','05/05/2012',2);
/Now my table has 2 rows,
select * from dates;
FROMDATE TODATE LEAVE_ID
01/05/2012 05/05/2012 1
05/02/2012 05/05/2012 2Now when I used this query,
select count(*) from (select dt
from(
select to_date(fromdate, 'DD-MM-YYYY') + rownum -1 dt
from dates
connect by level <= to_date(todate, 'DD-MM-YYYY') - to_date(fromdate, 'DD-MM-YYYY') + 1
where to_char(dt,'fmday') not in ('sunday','saturday') minus (select holidays from holiday_dates)) dual;The output is ,
COUNT(*)
1987How to get the output using the max(leave_id) like the following,
select..........from... where leave_id=(select max(leave_id) from dates);where to add "WHERE" clause in the above query?
Thank you,
Regards,
Gurujothi.
Edited by: Gurujothi on May 3, 2012 8:43 PM
Edited by: Gurujothi on May 3, 2012 8:44 PM -
How to get the difference between two BufferedImages?
All the BufferedImage which is grabbed from AWT may be same each other,
i only want to get the different part of two continuous BufferedImages and send ti over internet.
I have compared two BufferedImages by RGB (int[]), but this process wastes 400~500ms,it's terrible,:)
who has any good idea about this?
thanks
Best Wishes
mauvespanthanks ! cary ,
I have a list contained some BufferedImages gotten from AWT component,and then these images
will be transfered to client and displayed in Internet explore ,actually there are only some difference
between two continuous BufferedImages,i don't want to transfer the WHOLE image to client,SO i
want to handler every image before sending to client , at last, the different part will only be sent to client.
All these ideas will be contained this method:
* Compare the specified two BufferedImages and return the different part between them.
* @param ref the specified first image
* @param gen the specified sencond image
* @return the different part between the specified two images.
public static void BufferedImage compareBufferedImage(BufferedImage ref,BufferedImage gen){
to finish this method ,do you have any good ideas?or sample code?
thanks
Best wishes
mauvespan -
How to get the 'link' between two tables
hi pple
i need to find out HOW two tables are related.
sample tables:
SHIPS ( HULL_ID [PK] , VESSEL_NAME, GROSS_TONNAGE )
EQUIPMENT ( E_ID [PK] , HULL_ID [FK frm SHIPS], DESC )
PARTS ( PART_ID [PK] , E_ID [PK, FK frm EQUIPMENT], MANUFACTURER_ID)
--> SHIPS and PARTS are some how related thro' EQUIPMENT.
i need to get this relationship:
Ships --> Equipment (E_ID) --> PARTS
currently, i can get the direct parent and child tables of a given table using:
SELECT lpad ( ' ', 2 * ( LEVEL - 1 ) ) || table_name as Child_Tables
FROM ALL_CONSTRAINTS
START WITH R_CONSTRAINT_NAME in
select constraint_name
from all_constraints
where table_name = '%table_name%'
and constraint_type = 'P'
CONNECT BY PRIOR CONSTRAINT_NAME = R_CONSTRAINT_NAME ;
To get ALL parents:
SELECT lpad ( ' ', 2 * ( LEVEL - 1 ) ) || table_name as Parent_Tables
FROM ALL_CONSTRAINTS
where owner = 'CHARTUSER'
START WITH CONSTRAINT_NAME in
select constraint_name
from all_constraints
where table_name = '%table_name%'
and constraint_type = 'R'
CONNECT BY PRIOR R_CONSTRAINT_NAME = CONSTRAINT_NAME ;
what i need to do is:
1) get children & parents of SHIPS
2) for each element of (1), get children, parents till i get PARTS
3) so, i will get EQUIPMENT and then, PARTS.
this wud be very expensive. my appln is in Java and i will need to call these functions - that makes it more complex. is there any simpler way out?
and my main problem is to find out WHAT attributes line two tables. this wudnt be a big deal if it were just simple parent-child tables. but, how do i find out the attributes that link PARTS and SHIPS table?
any ideas? -please help.
thanks in advance
--$uDhADear Srikanth,
This tables can be used once we come to know whether its a customer or vendor line item but in our case we using the GL account as reference have to knock off the entries.How we come to know that aginst the GL whether its a customer or vendor line item.. Then it should route to this table.
Suggest me if any options are there.
Regards,
Balaji.c -
I have a database table where it keeps record of the transaction when it starts at StartTime and when it ends at EndTime. Both these entries are having the timestamp entries. Say for example, I have a tuple with Entries like 'Transaction A' starts at '2014-05-07
20:55:03.170' and ends at '2014-05-08 08:56:03.170'. I need to find the difference between these two timestamps and my expected output is 12:01:00.000. Let me know how to achieve this ?Hi,
You can use below script which calculates difference as DD:HH:MM:SS. You can modify the same:
DECLARE @startTime DATETIME
DECLARE @endTime DATETIME
SET @startTime = '2013-11-05 12:20:35'
SET @endTime = '2013-11-10 01:22:30'
SELECT [DD:HH:MM:SS] =
CAST((DATEDIFF(HOUR, @startTime, @endTime) / 24) AS VARCHAR)
+ ':' +
CAST((DATEDIFF(HOUR, @startTime, @endTime) % 24) AS VARCHAR)
+ ':' +
CASE WHEN DATEPART(SECOND, @endTime) >= DATEPART(SECOND, @startTime)
THEN CAST((DATEDIFF(MINUTE, @startTime, @endTime) % 60) AS VARCHAR)
ELSE
CAST((DATEDIFF(MINUTE, DATEADD(MINUTE, -1, @endTime), @endTime) % 60)
AS VARCHAR)
END
+ ':' + CAST((DATEDIFF(SECOND, @startTime, @endTime) % 60) AS VARCHAR),
[StringFormat] =
CAST((DATEDIFF(HOUR , @startTime, @endTime) / 24) AS VARCHAR) +
' Days ' +
CAST((DATEDIFF(HOUR , @startTime, @endTime) % 24) AS VARCHAR) +
' Hours ' +
CASE WHEN DATEPART(SECOND, @endTime) >= DATEPART(SECOND, @startTime)
THEN CAST((DATEDIFF(MINUTE, @startTime, @endTime) % 60) AS VARCHAR)
ELSE
CAST((DATEDIFF(MINUTE, DATEADD(MINUTE, -1, @endTime), @endTime) % 60)
AS VARCHAR)
END +
' Minutes ' +
CAST((DATEDIFF(SECOND, @startTime, @endTime) % 60) AS VARCHAR) +
' Seconds '
Reference:
http://sqlandme.com/2013/12/23/sql-server-calculating-elapsed-time-from-datetime/
- Vishal
SqlAndMe.com -
How to run this query to get the minutes between two hours?
Hi all,
Hope doing well,
sir i am running one query which is:
v_TotalHrsMin1 := LPAD((extract(minute from TO_TIMESTAMP (v_Temphrs,'HH24:mi:ss')) - extract(minute from TO_TIMESTAMP (v_Outtime1,'HH24:mi:ss'))), 2, '0');--select to_date(v_temphrs,'YYYY-MM-DD HH:mi:ss')-to_date(v_OutPunch,'YYYY-MM-DD HH:mi:ss')*1440;
in this v_TotalHrsMin1 is number datatype and v_Temphrs is varchar2 which is storing this value: 12:00:00
and v_Outtime1 is varchar2 which is storing 06:00:00
now i want the minute difference between both times
and insert into v_Totalmin1.
but getting null value in v_totalmin1.
thanks952646 wrote:
Hi Sir,
i used query like this: v_TotalHrsMin1 := extract(hour from time_interval) * 60 + extract(minute from time_interval) from (select to_timestamp(v_temphrs,'HH24:MI:SS')-to_timestamp(v_outtime1,'HH24:MI:SS') time_interval from dual);That is not a query - that is a PL/SQL assignment expression. You should learn the differences between SQL and PL/SQL and how they work together ;-)
When doing it in PL/SQL, you do not need a query at all. Why would you do a select from dual in the PL/SQL assignment.
But you should be able to take the SQL example I gave you and write the equivalent PL/SQL code.
We do not want to do your work for you - we want to teach you how to do it yourself.
You should try and understand the examples we give you - not just cut-and-paste it and cry for help when you are cut-and-pasting a SQL example into PL/SQL code.
Anyway - here's a way to do it in PL/SQL:
declare
v_outtime1 varchar2(8);
v_temphrs varchar2(8);
v_interval interval day to second;
v_totalhrsmin1 number;
begin
v_outtime1 := '06:00:00';
v_temphrs := '12:00:00';
v_interval := to_timestamp(v_temphrs,'HH24:MI:SS')-to_timestamp(v_outtime1,'HH24:MI:SS');
v_totalhrsmin1 := extract(hour from v_interval) * 60 + extract(minute from v_interval);
end;
/What's so difficult about taking my SQL example, understanding what the differenct functions do, and then write that piece of PL/SQL? ;-)
Maybe you are looking for
-
24" iMac AlSiO does not boot with iPod video on USB dock
Hello all, I have already reported this as an issue with Apple. I noticed that when I turn on my new iMac with the video iPod on the dock connected via USB, I only see the gray screen and the OS does not start. However, once I remove the iPod from th
-
Pricing date change on service order when creating confirmation.
Hi gurus, I want to change the pricing date (and recalculate prices)on service order to the date confirmation is created from the service order.I would like to know if this can be achieved by copy control BADI or order save BADI or pricing BADI ? Pl
-
Dangers of repairing disk permissions
Are there any things that can go wrong whilst you're trying to repair disk permissions on your startup disk?
-
Copy things out of png/jpg
Hi, I am working with Illustrator CS4 on a Macintosh. I am working on a project in which I am editing a jpg file. I want to copy small bits out of the file and place them elsewhere in the picture. However, selection tools do not work on these files.
-
I have recently received 3 emails over the last 2 weeks from [email protected] I presume these are fake. Can anyone confirm