PL/SQL -- huh?

From: Steve Frampton, Computer Operator/Systems Clerk <frampton_at_admin.flarc.edu.on.ca>
Date: 1995/09/11
Message-ID: <43284s$un0_at_govonca3.gov.on.ca>#1/1


Hello:

I've been working with SQL*Plus for quite awhile now, and I need to do a few things that I feel would be better handled with a procedural language such as PL/SQL.

I've never really used PL/SQL (except it's super(?)/sub(?)-set in SQL*Forms) and am a little confused -- there appears to be things in SQL*Plus you can't do in PL/SQL and vice-versa.

For example, I would like to do some calculations, and then display the result on the terminal. I haven't been able to figure out how to display something with PL/SQL!!! In *Forms I'd use the "MESSAGE" statement, and in *Plus I'd use a "SELECT" statement. Neither appears to work.

Also, if I need to do operations on more than one table, or more than one query, etc., do I put these into separate blocks? Or can they all be in one block:

Here's some pseudo-code as to what I'd sort of like to do:

declare
  blah blah blah;
begin
  select foo + 1
  into blah
  from table; /* Put value of foo+1 into "blah" */

  message ('The value of blah is: '||blah);

  insert into table2
  stuff based on foo

  message('Insertion complete.');

  update table
  set foo = blah;

  ... etc ...
end;

Any information would be greatly appreciated. Once I get pointed in the right direction, I should be okay.

BTW...I *have* looked at the example files provided by Oracle...they all conveniently appear to overlook outputting stuff to the display, and doing more than one table operation in a block (unless it's in an IF statement).

Thanks in advance!



This article contains my own words formed by my own opinions. I speak on my own behalf and my views do not necessarily agree with the views of my employer.
-----------------------------------+-------------------------------------------
Steve Frampton                     | Phone:  (613) 544-4927, ext. 312 or 331
Computer Operator/Systems Clerk | Fax: (613) 530-4761 Frontenac-Lennox & Addington RCSSB | E-mail: frampton_at_admin.flarc.edu.on.ca
-----------------------------------+-------------------------------------------
Received on Mon Sep 11 1995 - 00:00:00 CEST

Original text of this message