Re: INTERVAL Calculations
Posted in 1995
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Gregory Lynn Wood <lynnwood@crash.cts.com> wrote: > >I have a table that contains two columns. > >one is dollars, type is money. >second is duration, type is interval hour to minute. > >I wish to divide the dollars by the duration in order to >get price per minute. > >How do I convert interval to an integer that I can do >calculations with. > >Greg > If you are using 4GL all you need to do is define a second variable as in interval minute(n) to minute where n is the maximum nuber of digits needed. Then define a char variable large enough to hold that value. Then divide. Example: define duration interval hour to minute, amount money, dur_min interval minute(9) to minute, dur_chr char(10), cost money(7,4) let dur_min = duration let dur_char = dur_min let cost = amount/dur_min 4GL will allow you to divide a number by a char as long as it makes sense to do so (i.e. the char represents a real number) Hope that helps. I don't know if this will work in ESQL or not. THOMAS BARNES - WWHF15A@prodigy.com