Oracle
  Home arrow Oracle arrow Page 2 - Learning to Query in Oracle XE
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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? 
ORACLE

Learning to Query in Oracle XE
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 14
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    PCmover - $15 Off with Coupon Code CJPH7Q

    Learning to Query in Oracle XE - Running SQL Queries
    (Page 2 of 4 )

    Example 1

    In the HR database there are a couple of tables, which include DEPARTMENTS and Employees. Here is the table design of the Employees table as seen in the Object Browser (review the first article).

    Select query against the Employees table

    Let's just run a query to return everything in the Employees table with this simple query Select * from employees. This query can be saved or executed by clicking the Run button. The results are seen in this next picture. Since we have chosen to display 10 rows of results, the Results pane shows just the 10 rows. If you want you may show more rows by clicking on the drop-down, Display. As you can see from the design view there are more columns in this table than shown in this screen. You could scroll to the right, and see the rest of the columns.  Once the query is run you may find other details. The other details are accessed by clicking on the tabs in the bottom, tabbed window.

    Explain Tab

    Click on the Explain tab in the bottom pane. This brings up the next screen which shows the Query Plan, the indexes on columns, and details of the table columns. This is really nice without having to move to a new window.

    Describe Tab

    Next you click on the Describe tab, and you will get a message which asks you to type the PL/SQL statement "Describe." "Describe" (or just Desc) is a keyword in Oracle's SQL with the following Oracle syntax:

    DESC[RIBE] {[schema.]object[@db_link]}
    Lists the column definitions for the specified table, 
    view or synonym, or the specifications for the 
    specified function or procedure.
    

    Typing in the statement Describe Employees produces the result in the next screen. You will get complete design information on the table. From this tab you cannot go back to the Explain tab because the context has changed. You need to run the query once again to go back to what you interrupted by typing in the "Describe Employees" statement. Of course you could have saved the query before running the "Describe employees" query, which allows you to come back to any of your saved queries, as you will see shortly.

    Saving the Query

    Let's run the query "Select * from Employees" again and save the query this time, after reviewing the results. Unless you Save the query, the Saved SQL tab will show "No Saved SQL Found." Now click on the Save button to save the query and you will be asked to provide a Name a Description to the query you want to save, as shown in the next picture.

    The next time you click on Saved SQL you will see the following screen. It shows the owner, name, description it was saved with, and other details. You may bring up the query by clicking on the hyperlink on the Name ("AllEmpl" in this screen) of the query and run again to get some fresh results.

    History Tab

    The last tab, History, shows the chronological query-related information. This is very useful information if you want to backtrack your work. In this screen you can search for saved queries by a chosen owner, and display the results. After placing a check mark for the query, you can even delete it from the saved list. After going back in history, you can bring up an old query and the statement gets copied to the SQL Pane; you can now run it if you like. It is a great way to bring up old queries and refine them as per the situation. The only complaint I have against this UI is that both the panes should have had adjustable scroll bars (or is it a limitation of my display device?). When all the results are shown the UI occupies the entire screen height.

    More Oracle Articles
    More By Jayaram Krishnaswamy


       · Well, what I am describing is the canvas where you can experiment your scripting...
       · hallooo gud morningthese comments on the data base related (query) r not...
     

       

    ORACLE ARTICLES

    - 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...
    - Sub-templates and More with Oracle HTML DB
    - Focusing on Templates in Oracle HTML DB

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway