Hi Alan

I will assume there is always 1 space between the constants and the numbers. Also that the length of the constants is as you show here - 10. If those lengths are different, you'll just need to make a suitable adjustment. This should work -

with numbers as (select decimal(substr(field1, 12, locate(' ', field1, 12) - 12)) as number1, decimal(substr(field1, locate('yyyyyyyyyy', field1) + 12)) as number2 from file1) select number1, number2, number2 - number1 from numbers

This also assumes that there is nothing after the second number.

Hope this is close!
Vern

On 7/18/2012 12:59 PM, Alan Shore wrote:
Afternoon all
I'm having a brain freeze (well, more so than usual)
I have a file (FILEA) with a field (FIELD1) that contains data like
xxxxxxxxxx 9912.43 yyyyyyyyyy 46.03
where xxxxxxxxxx will ALWAYS be the same value and yyyyyyyyyy will ALWAYS be the same value (but different from xxxxxxxxxx)
Each of the above amounts can range from 0.00 thru 9999999999.99
Here is what I am having a problem with.
Using SQL how can I separate the 2 amounts AND calculate the difference between them


Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill


Disclaimer: This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.