[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Help with variable values??



Many many thanks to Daniel Vandenberg!!  He explanation clearly defined my
problem.  I made the necessary code correction and it's working perfectly.  Is
this a great group, or what?!






Daniel Vandenberg <vandberg@VAXA.CIS.UWOSH.EDU> on 03/13/2001 09:12:27 AM

Please respond to sqr-users@list.iex.net

To:   SQR-USERS@list.iex.net
cc:    (bcc: Rick Creel/IT/Aon Consulting)

Subject:  Re: Help with variable values??



The reason this is happening is that #prev_bill_rt is declared decimal
(2).   The precision of a decimal variable tells how many digits are
stored.  Since the precision in your program is 2, only the first two
digits are stored, so 325 becomes 320.  I am guessing you wanted to specify
two decimal places, but precision needs to be the total number of
digits.  For example if the largest amount that might be in ac_bill_rt is
999.99, then #prev_bill_rt should be declared decimal (5).

At 04:26 PM 03/12/2001 -0500, you wrote:
>We're running SQR 4.3.4, Oracle 8.06
>
>If I do a SQL select from a table, I get these results:
>
>select ac_bill_rt, ac_cost_rt
>from ps_ac_te_sumwork
>where business_unit = 'ACUS1'
>and emplid = '0007987'
>
>AC_BILL_RT AC_COST_RT
>---------- ----------
>        325      72.44
>
>In an SQR program, I can select the bill rate into a variable name
>and display its contents:
>
>begin-select on-error=sql_error
>srd.ac_bill_rt
>    let #prev_bill_rt = &srd.ac_bill_rt
>    show 'Prev = ' #prev_bill_rt
>from ps_ac_te_sumwork srd
>where  srd.business_unit = $opr_bu
>and    emplid = '0007987'
>
>The variable #prev_bill_rt is declared as
>      decimal (2) #prev_bill_rt
>
>The log file shows this:
>
>Prev = 320.000000
>
>
>Can anyone explain WHY this is happening, and what I need to do to correct?
>I am using the variable in and equation, I am getting incorrect results.


----------------------------------------------------------------------------
----
Daniel Vandenberg                    |  Email :  vandberg@uwosh.edu
Applications Programming
University of Wisconsin Oshkosh