Oracle
  Home arrow Oracle arrow Page 3 - Learning to Query in Oracle XE
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
ORACLE

Learning to Query in Oracle XE
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 15
    2006-06-07


    Table of Contents:
  • Learning to Query in Oracle XE
  • Running SQL Queries
  • An Example from PL/SQL
  • Example 3: Dual Tables

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Learning to Query in Oracle XE - An Example from PL/SQL
    ( Page 3 of 4 )

    SQL is just a query language. However, you need more than SQL to take care of  business. Every database vendor has an alternative language set that works well with SQL, but can handle data more flexibly by introducing logic and transactional capabilities to the handled data. PL/SQL for Oracle provides the sophisticated data processing capability. PL/SQL stored procedures can store your business logic, PL/SQL packages can do summarizing data and other chores on a schedule, and PL/SQL can set up triggers to work with the business logic and much more. The object of this example is to show that PL/SQL can be run from SQL commands in the OracleXE interface.

    PL/SQL is a block-based programming interface. The PL/SQL block is built from three sections:

    declare

    execution{between BEGIN and END}

    optional exception.

    Example 2

    The example shown calculates the man-hours utilized by a job which takes the number of men working multiplied by the number of hours worked. The query is shown in the next picture with the results. The query also shows the PL/SQL's way of printing results using the DBMS_output_PUT_LINE() method. In the code, the number of men is an integer, but the hours_worked is a decimal. The number of man hours is again in integers. If the number of hours is changed to, say, 8.3, the total will come out to 50 instead of 51 man-hours because man_hours is declared to be integer.

    Exception Messages

    Exceptions are handled in the Exception block. Let's look at how exception messages are displayed. The next picture shows the display when an exception is thrown. The man_hours variable is declared without the data type. Discussion of trouble shooting is outside the scope of this tutorial.



     
     
    >>> More Oracle Articles          >>> More By Jayaram Krishnaswamy
     

       

    ORACLE ARTICLES

    - Oracle's Turn to Play in the Sun
    - Implementing and Using Oracle`s Restore Poin...
    - Tuning PL/SQL Code
    - Debugging PL/SQL Code
    - Testing PL/SQL Code
    - Working With PL/SQL Code
    - Conditional Compilation for Oracle Database ...
    - Compile-Time Warnings for Oracle DB 10g
    - Compiling PL/SQL Code for an Oracle Database
    - Troubleshooting PL/SQL Code
    - Managing PL/SQL Code
    - Data Manipulation and More for HTML DB Appli...
    - Oracle Database Fundamentals
    - Adding Processes to HTML DB Applications
    - Adding Computations, Processes, and Validati...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek