Oracle Consulting Oracle Training Oracle Support Development
Home
Catalog
Oracle Books
SQL Server Books
IT Books
Job Interview Books
eBooks
Rampant Horse Books
911 Series
Pedagogue Books

Oracle Software
image
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
 Phone
 800-766-1884
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books
image
image

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle

STATSPACK Viewer

Privacy Policy

 

   
 

ss

Oracle Tips by Burleson 

Variable Declaration and Conversion

In the previous examples a variable v_line was defined.  All variables are defined in the declaration section of the block.  Variables are defined in the form:

variableName      datatype      := defaultvalue;

Below are examples of variables.  Variables can be defined as any valid datatype  to include user defined datatypes and records.

declare
  v_str1   varchar2(80);
  v_str2   varchar2(30) := ‘Hello World’;
  d_today  date;
  n_sales  number;
  n_order  number(8);
begin

A constant  is defined the same way a variable is with the key word constant.

c_standard constant number := 90;

Notice that a constant must be assigned a value and the above statement does four things:

  • Names the variable c_standard

  • Defines c_standard as a constant

  • Defines c_standard as a numeric datatype

  • Assigns a value of 90 to c_standard

With PL/SQL  constants, note that a constant value can’t be changed unless it is redefined in a subsequent block. 

In the examples above our two variables are defined as numbers, and we are now ready to see how to include the precision and scale for a number.  As in SQL, PL/SQL supports mathematical operations and has a large library of mathematical functions, covering everything from advanced multivariate statistics  to Newtonian Calculus .  PL/SQL also supports single-row functions to convert numbers to characters and characters to numbers.


The above book excerpt is from:

Easy Oracle PL/SQL Programming

Get Started Fast with Working PL/SQL Code Examples

ISBN 0-9759135-7-3   

John Garmany 

http://www.rampant-books.com/book_2005_1_easy_plsql.htm

Linux Oracle commands syntax poster

ION Oracle tuning software

Oracle data dictionary reference poster



Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   

 

   

 Copyright © 1996 -2016 by Burleson. All rights reserved.


Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation. 
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks