15.01.2013 Views

Oracle Database 11g The Complete Reference (Osborne ORACLE ...

Oracle Database 11g The Complete Reference (Osborne ORACLE ...

Oracle Database 11g The Complete Reference (Osborne ORACLE ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

686 Part VI: Java in <strong>Oracle</strong><br />

Datatype Description<br />

Byte Byte-length integer<br />

Short Short integer<br />

Int Integer<br />

Long Long integer<br />

Float Single-precision floating-point real number<br />

Double Double-precision floating-point real number<br />

Char A single Unicode character<br />

Boolean A Boolean value, true or false<br />

TABLE 42-1 Java Primitive Datatypes<br />

Executable Commands<br />

You can assign values to variables via the use of expressions and statements. <strong>The</strong> arithmetic<br />

operators supported by Java include the following:<br />

Operator Description<br />

* Multiplication<br />

/ Division<br />

+ Addition<br />

– Subtraction<br />

% Modulus<br />

In addition to these operators, you can use Java’s unary operators to simplify your coding. For<br />

example, you can increment variables via the ++ operator, as shown here:<br />

aLoopCounter = aLoopCounter++;<br />

Or you could simply write this:<br />

aLoopCounter++<br />

NOTE<br />

<strong>The</strong> ++ operator is called a unary operator because it has only one<br />

operand. If an operator requires two operands (such as *), it is called<br />

a binary operator.<br />

In PL/SQL, that would have been written as follows:<br />

aLoopCounter := aLoopCounter +1;<br />

If the ++ operator is placed in front of the variable name, it is a pre-increment operator rather<br />

than a post-increment operator:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!