Archives for: December 2004, 17

PL/SQL FAQ for Newbies

12/17/04 | by Clarise Z. Doval Santos [mail] | Categories: Databases

1. What is PL/SQL? How is it different from SQL*Plus?
PL/SQL is Oracle's extension to SQL incorporating Procedural Language. It allows the data manipulation and query statements of SQL to be included in logical program blocks and procedural units of code.
SQL*Plus is an Oracle Server tool that recognizes and executes SQL statements.

2. What is the basic Structure of the PL/SQL Block?
Every unit of PL/SQL comprises one or more blocks. These may be entirely separate or nested. The general structure of the block is:
HEADER: Used only for named blocks
DECLARE: Defines the PL/SQL Objects to be used in this block
BEGIN
/* start of executable actions */
EXCEPTION
/* Error Handlers; Defines what to do if an executable action produces exceptions or errors */
END;

3. What are some of the control statements in PL/SQL?
- IF Statement
- GOTO statement
- Basic Loops
- FOR Loops
- WHILE Loops

4. How do you process PL/SQL blocks in SQL*Plus?
- Define a block in the SQL buffer and then run the buffer
- Define a block as part of a SQL*Plus script and then run the file

Example PL/SQL

5. While using PL/SQL in SQL*Plus, how can one print to screen?
Issue:
SQL> set serveroutput on;
then run your PL/SQL block

6. How do you show errors while compiling from SQL*Plus?
issue:
SQL> show errors

7. How do you issue create table from PL/SQL?
Starting with 8i, DDL statements e.g. CREATE, TRUNCATE and DROP can be called within PL/SQL by using EXECUTE IMMEDATE.
Example:
begin
EXECUTE IMMEDIATE 'CREATE TABLE SAMPLETABLE(ID NUMBER)';
end;

Permalink
December 2004
Mon Tue Wed Thu Fri Sat Sun
 << < Current> >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

This blog contains thoughts that range from non-technical to technical. Its name is derived from "Yakity Blah Blah" a column I once had that discussed a cornucopia of ideas. Who am I? I'm Clarise Z. Doval Santos, providing Project Management and Technical Leadership as part of InterActive Systems & Consulting, Inc.

InterActive Systems & Consulting, Inc. (IASC) performs research in the areas of data analytics, collaboration and remote access.

InterASC Professional Services, a service mark of IASC, provides strategic consulting and project management for data warehousing, business intelligence and collaboration projects using proprietary and open source solutions. We formulate vendor-independent strategies and implement solutions for information management in an increasingly complex and distributed business environment, allowing secure data analysis and collaboration that provides enterprise information in the most valuable form to the right person, whenever and wherever needed.

TeleInterActive Networks, a service mark of IASC, hosts open source applications for small and medium enterprises including CMS, blogs, wikis, database applications, portals and mobile access. We provide the tools for SME to put their customer at the center of their business, and leverage information management in a way previously reserved for larger organizations.

37.652951177164 -122.490877706959

Search

XML Feeds

Blogroll

  • Business Life
Powered by b2evolution