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.)

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 ?

DECLARE
number1 NUMBER;
number2 NUMBER;
number3 NUMBER;
BEGIN
number1 := 5;
number2 := -2;
number3 := number1 - number2;
dbms_output.put_line(number3);
END;

That was my question. Why am I getting 3?

the same block of pl/sql code never gives different output to different people on different machine.

Hai Bondo,
you will never get 3 for the above code..please check it once again...........................

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.