Subtracting a negative value
Please support our Oracle advertiser: Programming Forums
![]() |
Does anyone know how Oracle's PL/SQL handles subtraction with a negative number? Really what I need to know is, given the following: (NOTE: this is NOT the code I'm working with. It's just an example to give and idea of what I'm trying to do.)
How do I get number3 to be 7, like math is supposed to work (5 - (-2) = 7)? I keep getting 3. Anyone?
DECLARE number1 NUMBER; number2 NUMBER; number3 NUMBER; BEGIN number1 := 5; number2 := -2; number3 := number1 - number2; END; /
How do I get number3 to be 7, like math is supposed to work (5 - (-2) = 7)? I keep getting 3. Anyone?
but i am getting 7, how come you are getting 3 ?
oracle Syntax (Toggle Plain Text)
DECLARE number1 NUMBER; number2 NUMBER; number3 NUMBER; BEGIN number1 := 5; number2 := -2; number3 := number1 - number2; dbms_output.put_line(number3); END;
Share your Knowledge.
![]() |
Similar Threads
Other Threads in the Oracle Forum
- Working with doubles, having some troubles (C++)
- Need help getting text to display in a graphics window (Python)
- Java home work help (long post) (Java)
- Small date problem (ASP)
- how do i sort reords from Z-A? (in turbo C) (C++)
- Classes (C++)
- a program about fractions (C++)
Other Threads in the Oracle Forum
- Previous Thread: Oracle SQL Plus Joining
- Next Thread: Deletion of Autonumber
•
•
•
•
Views: 1215 | Replies: 4 | Currently Viewing: 1 (0 members and 1 guests)






Linear Mode