Difference function
Hi,
Is there any equivalent for SQL Server's difference function in Oracle. If not, is it possible to achieve the same ?
Thanks,
Sam
As far as I unterstand the specification you could use something like:
create or replace function my_difference (p_string1 IN VARCHAR2, p_string2 IN VARCHAR2) RETURN NUMBER
is
v_str1 VARCHAR2(4);
v_str2 VARCHAR2(4);
v_count pls_integer := 0;
begin
SELECT soundex(p_string1), soundex(p_string2)
INTO v_str1, v_str2
FROM dual;
for i in 1..4 loop
if (substr(v_str1, i,1) = substr(v_str2, i,1)) then
v_count := v_count + 1;
end if;
end loop;
RETURN v_count;
end my_difference;
SQL> -- Returns a DIFFERENCE value of 4, the least possible difference.
SQL> SELECT SOUNDEX('Green'),
2 SOUNDEX('Greene'), MY_DIFFERENCE('Green','Greene')
3 from dual;
SOUN SOUN MY_DIFFERENCE('GREEN','GREENE')
G650 G650 4
SQL>
SQL> -- Returns a DIFFERENCE value of 0, the highest possible difference.
SQL> SELECT SOUNDEX('Blotchet-Halls'),
2 SOUNDEX('Greene'), MY_DIFFERENCE('Blotchet-Halls', 'Greene')
3 from dual;
SOUN SOUN MY_DIFFERENCE('BLOTCHET-HALLS','GREENE')
B432 G650 0
SQL>
Similar Messages
-
Exchange Rate Differences function and when to use
The company I am asking about is based in the US, but also has offices and transactions in Canada. Does the Exchange Rate Differences function need to be run at month-end before finalizing the financials, in order to "re-value" the Canadian accounts, such as Accts Receivable, Accts Payable, Fixed Assets, etc. that may not have changed during the last month (no activity during the "current" month)? The financials are expressed in US Currency. Transactions during the month to the various Canadian accounts are "re-valued" at the time of the transaction entry, since the exchange rates are updated every day in the system. We need a clear-cut idea of when the Exchange Rate Differences function should be run.
I would say that you do need to do it. This is very important to ensure your account receivable control account (or payable) is revalued at the end of the month based on the new exchange rate.
I know some companies do not revalue the balances as it is not required. I think, revaluating the balance makes sense as it will give you a true picture of your payable or receivable at the end of the month. This is also a good way of accruing your exchange rate loss/gain.
Vincent -
Is there a time difference function to get the time difference between ending time and starting time which are in HHMMSS format?
thanksHi katarnak,
you are right !
you have to use try/catch statement.
And if i want to put this code in a method and call it
from another class what shoudl be the return type of
this method?the ex i gave you print the result as a String
if you want to use it as a method do this :
public java.util.Date doDifference(java.util.Date dateStart, java.util.Date dateEnd) throws ParseException{
java.text.SimpleDateFormat dateFormat = new
java.text.SimpleDateFormat("hhmmss");
java.util.Date dateStart =
dateFormat.parse(strDateStart);
java.util.Date dateEnd =
dateFormat.parse(strDateEnd);
java.util.Date difference= new
java.util.Date(dateStart.getTime()-dateEnd.getTime());
return difference;
now the return type is java.util.Date !
when you use this method do :
java.util.Date dateDiffence;
try {
dateDifference = TheClassWhichContainsTheMethod.doDifference(YourDateStart, YourDateEnd) ;
catch (ParseException pe) {
pe.printStackTrace();
Badr. -
Distribute difference function in F-28
Hi Gurus,
When we use the distribute difference function during the incoming payment process (f-28) the posting keys which are currently used are
06 for underpayments
15 for overpayments
The correct posting key for overpayments should be 16 not 15
In case of under payment the system picks posting key 06 which is fine, but in case of over payment the system picks posting key 15 in place of 16.
I looked into OBXH and there the posting keys mentioned for payment difference are 06 and 16 however, the system is picking posting key 15 in place of posting key 16. I have checked with some of my ex-colleagues also working on different sites and they all are having the same issue. Could anyone tell me how to fix it and what is the reason why it is picking posting key 15 and not 16.
Thanks in advanceHi,
As far as I understand, the system will use both the posting keys. Let me explain you with an example:
Lets assume that the outstanding invoice is for 9900/-. The customer has made a payment of Rs.10000/- with an over payment of Rs.100/-.
The entry for this would be as below along with the relevant posting keys:
PK Account Amount
40 Bank 10000
16 Customer(for the difference amount) 100
15 Customer (for the invoice amount) 9900
If this is the entry you are getting, then it is the normal way SAP will behave.
Regards
AKV -
Month Difference - Function Module needed
Hi Experts,
In my report, I am using mcs0-spmon as select options; one of my inputs where the user will enter month and year in the selection screen . e.g. 04.2008 to 07.2008
I want to calculate the month difference and it should not exceed 3 months. If it does, an error will be shown.
My question is -
Is there any Function Module by which I can proceed. How do I go about it?
Can anyone tell me a solution?
Thanks in advanceHi,
concatenate '200804' '01' into dur_begda.
concatenate '200807' '01' into dur_endda.
call function 'HR_PT_GET_MONTHS'
exporting
first_date = dur_begda
second_date = dur_endda
modify_interval = space
importing
duration = duration-months
exceptions
invalid_seq_dates = 1.
Thanks,
Durai.V
Edited by: Durai V on Aug 12, 2008 6:33 AM -
Difference functionality student&teacher version vs. "normal" version
Is there a difference conercerning functionality of the Design Studio Std. Student&Teacher version compared with the "normal" Design Studio Std. Version !?
Thanks,
i11msNo.
-
Date difference function that returns minutes between two dates and excludes weekends and holidays
Is there a way to get this to work as a function?
Currently returns error "Select statements included within a function cannot return data to a client"
CREATE FUNCTION [dbo].[WorkDays](@DateFrom datetime,@DateTo datetime)
RETURNS int
AS
BEGIN
--Working time
DECLARE @WTFrom TIME = '8:00AM';
DECLARE @WTTo TIME = '5:00PM';
DECLARE @minCount BIGINT
--Date ranges
IF (DATEDIFF(HOUR, @DateFrom, @DateTo) > 12)
BEGIN
WITH CTE AS
SELECT @DateFrom AS DateVal
UNION ALL
SELECT DATEADD(HOUR, 1, DateVal)
FROM CTE
WHERE DateVal < DATEADD(HOUR, -1,@DateTo)
SELECT DATEDIFF(minute, MIN(CTE.DateVal), MAX(CTE.DateVal))
FROM CTE
WHERE (CAST(CTE.DateVal AS time) > @WTFrom AND CAST(CTE.DateVal AS time) < @WTTo) AND DATEPART(dw, CTE.DateVal) NOT IN (1, 7) AND NOT EXISTS (SELECT * FROM Holiday AS H WHERE H.holiday = CTE.DateVal)
OPTION (MAXRECURSION 0);
END;
ELSE
BEGIN
WITH CTE AS
SELECT @DateFrom AS DateVal
UNION ALL
SELECT DATEADD(MINUTE, 1, DateVal)
FROM CTE
WHERE DateVal < DATEADD(MINUTE, -1,@DateTo)
SELECT DATEDIFF(minute, MIN(CTE.DateVal), MAX(CTE.DateVal))
FROM CTE
WHERE (CAST(CTE.DateVal AS time) > @WTFrom AND CAST(CTE.DateVal AS time) < @WTTo) AND DATEPART(dw, CTE.DateVal) NOT IN (1, 7) AND NOT EXISTS (SELECT * FROM Holiday AS H WHERE H.holiday = CTE.DateVal)
OPTION (MAXRECURSION 0);
END;
END
Thanks for your help.Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules (you do not). Temporal
data should use ISO-8601 formats (you do not!). Code should be in Standard SQL as much as possible and not local dialect.
This is minimal polite behavior on SQL forums.
We hate functions in SQL. This is a declarative language and you are using it like 1950's FORTRAN. We hate local variables (more FORTRAN!)
The name of a function has to be either a known, common name, like “sine”, “cosine” etc. Or it is “<verb>_<object>”; you think a noun is a verb! Do you really need BIGINT? Why did you invite garbage data with it? Why do you think that SQL
uses AM/PM? Have you never seen the TIME data type?
Think about “date_val” as a data element name. A date is a unit of temporal measurement on a calendar scale. This would be a “<something>_date” in a valid schema.
>> Is there a way to get this to work as a function? <<
Probably, but why do it wrong?
Build a calendar table with one column for the calendar data and other columns to show whatever your business needs in the way of temporal information. Do not try to calculate holidays in SQL -- Easter alone requires too much math.
The julian_business_nbr is how SQL people do this. Here is the skeleton.
CREATE TABLE Calendar
(cal_date DATE NOT NULL PRIMARY KEY,
julian_business_nbr INTEGER NOT NULL,
Here is how it works:
INSERT INTO Calendar
VALUES ('2007-04-05', 42),
('2007-04-06', 43), -- Good Friday
('2007-04-07', 43),
('2007-04-08', 43), -- Easter Sunday
('2007-04-09', 44),
('2007-04-10', 45); --Tuesday
To compute the business days from Thursday of this sample week to next Tuesday:
SELECT (C2.julian_business_nbr - C1.julian_business_nbr)
FROM Calendar AS C1, Calendar AS C2
WHERE C1.cal_date = '2007-04-05',
AND C2.cal_date = '2007-04-10';
See how simple it can be when you stop trying to write FORTRAN and think in sets?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
The real difference between iPad Mini & iPad Mini Retina
I was window-shopping on the Apple-direct store's "refurbished & clearance" web site, and noticed that iPad Mini and iPad Mini with Retina Display are now available for resale there.
If I want to use an iPad Mini for certain functions, such as:
1: checking e-mail and address books while on-the-road
2: using an AppleTV and adaptors to wirelessly give presentations via Airplay to business meetings via HDTVs and projector-screen rigs
3: giving one-on-one image presentations for business/personal discussions using the tablet directly
4: consulting maps, weather forcasts and various light web-browsing
5: dappling in art tablet apps, note-writing, and math (calculator apps)
6: using the iPad as an entertainment device (playing music, watching movies/TV)
... then what is the real difference, functionally, between the iPad Mini and the iPad Mini with Retina Display?iPad mini with Retina Display vs. iPad mini
http://www.gizmag.com/ipad-mini-vs-ipad-mini-2/29541/
First iPad Mini vs. Retina: No contest
http://news.cnet.com/8301-13579_3-57613975-37/first-ipad-mini-vs-retina-no-conte st/
Cheers, Tom -
Hi experts,
i understand the general concept of exchange rate differences ie Rate at which one currency may be converted into another. The exchange rate is used when simply converting one currency to another
but i need to know where it will affect in SAP and what is the use in SAP?
regards
anandHi Anand......
Please read teh following para......
Exchange Rate Differences
Use
When you maintain a foreign currency (FC) business partner and/or accounts, all related bookkeeping is conducted in the FC. As the bookkeeping system must also be conducted in local currency (LC), every FC transaction of this nature also is expressed in LC according to the FC exchange rate on the date of transaction. The daily fluctuations in the FC exchange rates create a situation whereby the balances in LC and FC do not match. The automatic exchange rate differences are designed to periodically recalculate the LC and FC balances, according to the exchange rate on the day the differences are calculated.
SAP Business One can provide recommendations for executing automatic journal transactions for exchange rate differences in FC business partners and accounts, correct to a given date. The function of the program that calculates exchange rate differences is to reconcile between the FC card balance and the LC balance, considering the fluctuation in the FC exchange rate.
To access the Exchange Rate Differences function, choose: Financials ® Exchange Rate Differences.
Hope this may help you to understand the concept of Exchange Rate Difference....
Also check this Thread.....
Regards,
Rahul -
Differences between CRM2006s and CRM2007
Hi All,
Can someone please tell me about the differences between CRM2006s and CRM2007 ?
I want to know particularly what are the additions done in CRM2007 as compared to CRM2006s.
Regards,
AshishAshish,
This has been hashed up before but here are the major differences:
Functional
- Trade Promotion Management Module
- Drag and Drop personalization
Technical
- Editable overview screens
- New NOVA theme
- collapsable left hand menu bar
- Personalization of SU3 user data
- ability to configure screens directly in UI instead of going to SAP GUI however this is still kinda flakey and I prefer to still use BSP_WD_CMPWB.
From a pure config/developer standpoint you won't notice a lot of difference and if you learned 2006s then the transition to 2007 is very seemless .
We ran both releases here, so If you got some more detailed questions let me know.
Take care,
Stephen -
What are the differences between Cartweaver CF and PHP?
I am on my final step of finishing the webpage that I am building and saw Cartweaver for a shopping cart that is compatible with dreamweaver. But I looked into the site and hey didnt give an explanation between the CF and PHP version. So I would like to know the differences and which one would work best with Dreamweaver Cs6.
Hi Kendall,
As far as application differences, functionality wise, there is no difference. Both Cartweaver 4 CF and Cartweaver 4 PHP function and present themselves exactly the same. As far as implementation there are very subtle differences due the the way CF and PHP work, but they both are very close and use "includes" to place the Cartweaver functionality in your site penetration pages. The web based store admins work exactly the same for both. So you get the same results no matter which direction you go.
Now what is the difference between PHP and ColdFusion? That is a very important question as it will impact what platform you use from now on - for this site, and possably future sites you build so this is worth taking a little time to consider.
Which is best? Well this could lead to a discussion like which is best Mac or PC? There are evangelists and zealots on both sides. The real truth of the matter is both are good choices, you just need to decide which is best, for you. One poster said "what does your host support" - good point, but if you are new to working with dynamic web sites and are deciding what platform you want to go with there are more important factors to consider than what your current host supports. You can always select a different host.
The biggest difference between CF and PHP is they way they are written - PHP is script pasted, much like JavaScript, CFML is tag based much like html. Because of this CFML is often a little easier to learn because it's a bit easier to look at something and figure out what it's doing. So you may want to take a little time looking at this aspect.
Fact is though, with either one because Cartweaver does the vast majority of anything to do with code for you, learning the language is something you may not choose to do anyway. An advantage to PHP is that it has much wider support, so finding developers to help out, or hosts can easier with PHP. So if you don't have any desire to dig in and learn code as you go and only want to learn what's necessary to get your shopping cart site up, then the steps and learning curve are pretty much the same and PHP may be a good way to go. If this raises more questions than it answerers, let me know I'd be happy to discuss this more with you offline.
So, back to the basics - from a functionality point, they are both the same. You only need to choose which platform you think will work best for you and go from there.
I hope this helps. If you have any other questions at all, ask away.
Lawrence Cramer - *Adobe Community Professional*
http://www.Cartweaver.com
PHP & ColdFusion Shopping Cart for Adobe Dreamweaver
Stay updated:
http://www.facebook.com/cartweaver
http://www.twitter.com/cartweaver
http://blog.cartweaver.com -
What is the subtraction function in number called
I want to use a function to subtract 2 numbers. It has to be as easy as addition (SUM) but I cannot figure it out for the life of me.
Can someone please help me find out what Apple calls subtraction as a functionWhy would apple provide a difference function when the sum performs the same thing? They provide the negation operator (the minus) which I suggested earlier was the proper way to subtract.
= SUM(A1, A2)
or
= A1 + A2
to take the difference:
= SUM(A1, -A2)
or
= A1 - A2 -
hi everyone,
i want to know the difference& functionality of technical scenarios in SRM............
1) can we activate the classic &extn. classic at the same time?is it possible.
2) is it possible to replicate the material from SRM to R/3? but i know from R/3 to SRM.
3) which technical scenario is better for industry requirements?
can anyone pls put an eye to solve these.points will b awarded. send asap.
Warm Regards
rakhiHi,
For all your questions I think Claudia answers are correct. Just to add one more point that defining the backend documents whether to happen in SRM or R/3 can be done in Purchasing group and Product category combination in SPRO.
That kind of scenario is called Decoupled Scenario. Normally when we opt for direct material (STOCK) the system behaves as extended classic. For consumables classic will be good option.
Regards,
Munna -
Difference between Two Date Should come into Text Item
Dear All,
i want to get difference between two date into text Item :P36_C in On Change java script.
i have two Date Item :P36_A and :P36_B .i have extract these date value from table then difference comes into Text Field :P36_C.
Now i want if i change Date into Item :P36_A or Item :P36_B then Defference between two date Should Come into Item :P36_C .
So i have use Java Script Code to do this
<script>
function diffdat(){
function getVal(item){
if($x(item).value != "")
return parseFloat($x(item).value);
else
return 0;
$x('P36_C').value =
getval((TO_DATE('P36_B', 'DD-MON-YYYY'))-
getval(TO_DATE('P36_A', 'DD-MON-YYYY')))+1;
</script>
i have put this into Item HTML Form Element Attributes
onChange="javascript:diffdat();"it's not woring .
How to work that Code with dates.
ThanksYou can always create your own difference function based on your own criteria. You can modify this to suit your needs.
CREATE OR REPLACE FUNCTION CALC_OFFICE_DAYS(date1 DATE, date2 DATE)
RETURN NUMBER
IS
v_begin_date DATE := date1;
v_end_date DATE := date2;
v_office_start_time VARCHAR2(10) := '09:30 AM';
v_office_end_time VARCHAR2(10) := '06:30 PM';
v_comp_begin_time DATE;
v_comp_end_time DATE;
v_days PLS_INTEGER := 0;
v_hrs NUMBER := 0;
v_ttltm NUMBER;
BEGIN
select trunc(v_end_date) - trunc(v_begin_date)
into v_days
from dual;
select to_date(to_char(sysdate,'DD-MM-YYYY')||' '||to_char(v_begin_date,'HH24:MI'),'DD-MM-YYYY HH24:MI')
into v_comp_begin_time
from dual;
select to_date(to_char(sysdate,'DD-MM-YYYY')||' '||to_char(v_end_date,'HH24:MI'),'DD-MM-YYYY HH24:MI')
into v_comp_end_time
from dual;
select (v_comp_end_time - v_comp_begin_time)/24 into v_hrs from dual;
IF v_hrs > 4 then
v_ttltm := v_days + .5;
ELSE
v_ttltm := v_days;
END IF;
return v_ttltm;
END;
As has been noted, this question is best posted on the PL/SQL forum. -
Call Library Function "Function prototype" incorrect
Why does the same DLL file produce difference function prototypes?
I inserted the call library function node in my VI directly. However it has the incorrect function prototype.
This call library function node I copied from the “Goodness of Fit.vi”. This has the correct function prototype.
Solved!
Go to Solution.The DLL file DOES NOT produce prototypes at all. That is up to you! Look at the parameters tab for both of your examples, you will see that for the second one, someone has already filled in the prototype information. When making a new DLL call, you will need to know the correct prototype to apply, this is usually obtained from the .h (header) file.
Charles Chickering
Architecture is art with rules.
...and the rules are more like guidelines
Maybe you are looking for
-
Hi, I am looking for a Vendor Statistics report developed by an ABAPER which basically shows how late a PO was, If full quantity was GR etc basically a Vendor Evaluation report, Points will be awarded any Vendor Evaluation Type report will be helpful
-
Multiple events created in R3 when creating sales order
Hi all, We are having a problem when creating and changing a sales order in CRM. When a sales order is created and rapidly changed (or changed more than one time) from CRM, backend is receiving 2 events (from BO BUS2032, CREATED and CHANGED) but at t
-
How do I get Adobe to fix this bug/Is there a workaround?
Searching the internet shows that lots of people have the following problem: when using Adobe products on Windows 7 64bit with Outlook 2013. How does one get a 'fix' created for this, or is there a workaround? I have seen a workaround that involved e
-
I am not very computer literate, so I don't know details. It happens every time I try to open an e-mail.
-
TestStand using sockets, I have two Teststand sequences and I would like to condition the sequence to run using sockets. The two sequences are called from a Main Sequence. The test environment is connected to a database through a custom barcode inter