Re: Need some guidance

From: Michael Nolan <nolan_at_helios.unl.edu>
Date: 24 Aug 1994 05:45:05 GMT
Message-ID: <33emp1$dua_at_crcnis1.unl.edu>


Brenda Thompson <bthompson_at_sbctri.sbc.com> writes:

>If I take off the BEGIN-END, I get the results of the SELECT FROM WHERE
>statement only. The IF statements are not recognized.
 

>What am I doing wrong? Thanks.

To start with, I'm assuming you're using SQL*PLUS. (It is helpful in describing problems to indicate what tool and what version of Oracle you are using, although in this case the version is probably not significant.)

In addition to supporting direct SQL commands, SQL*PLUS has a language called PL/SQL imbedded in it. PL/SQL blocks are what you get when you use BEGIN-END.

SQL itself does not support the IF statement, PL/SQL does. (Conversely, PL/SQL has no simple mechanism for displaying output, but that's a different issue.) PL/SQL is used mainly for writing relatively short programs to manipulate a database. There are limits on the maximum size of a PL/SQL block, but it is something like 32,000 characters so you probably don't need to worry about it for a while.

If you have access to the Oracle documentation, there is a separate manual for PL/SQL, it is a fairly complex language.

---
Michael Nolan, Sysop for the DBMS RoundTable on GEnie
nolan_at_notes.tssi.com, dbms_at_genie.geis.com
(posted from nolan_at_helios.unl.edu)
Received on Wed Aug 24 1994 - 07:45:05 CEST

Original text of this message