Re: Where do SQL/PL programs execute from ?
Date: Sat, 20 Dec 2003 01:31:38 GMT
Message-ID: <MPG.1a4d711a3427d3ca9896ce_at_nntp.slnt.phub.net.cable.rogers.com>
On Mon, 15 Dec 2003 22:14:42 GMT a_at_b.com says...
> Hi all.
>
> I'm a newbie to ORacle and am planning to take a course in Oracle this
> January. Can anyone tell me where a SQL/PL script is run from ? I tried
> to run a simple SQL/PL script under SQL Plus but it doesn't work. Maybe
> I was doing something wrong.
>
> Any suggestions would be greatly appreciated...
>
> Thanks in advance
>
> Victor
>
Ok here it is. If you need for me to post the SQL code which created the tables and populated I will.
declare
cursor bc is select * from bank;
cursor brc (bn bank.b#%type) is select t#, city from branch where bn =
branch.b#;
cursor cc (cbn bank.b#%type, ctn branch.t#%type) is
select distinct customer.c#, customer.name, customer.status,
customer.city, account.balance from customer, account
where account.c# = customer.c# and account.b# = cbn and account.t# =
ctn;
begin
dbms_output.put_line
('+==============================================+'); dbms_output.put_line('| Bank# Name City|');
dbms_output.put_line
('------------------------------------------------');for btuple in bc loop
dbms_output.put_line('| '||btuple.b#||' '||btuple.name||' '||btuple.city||' ');
dbms_output.put_line('| +==========================================+ |'); dbms_output.put_line('| | Branch# City ||');
dbms_output.put_line('| --------------------------------------------|');
for brtuple in brc(btuple.b#) loop
dbms_output.put_line('| | '||brtuple.t#||' '||brtuple.city||' ');
dbms_output.put_line('| | +======================================+ ||');
dbms_output.put_line('| | |Customer# Name Status City Balance | | |');
dbms_output.put_line('| | ---------------------------------------- ||');
for ctuple in cc(btuple.b#, brtuple.t#) loop dbms_output.put_line('| | | '||ctuple.c#||' '||ctuple.name||' '||ctuple.status||' '||ctuple.city||' '||ctuple.balance||' ');
end loop;
dbms_output.put_line('| | ---------------------------------------| ||');
dbms_output.put_line('| --------------------------------------------|');
end loop;
dbms_output.put_line
('------------------------------------------------');end loop;
dbms_output.put_line
('+==============================================+');end;
-- inderpaul_s1234 AT yahoo DOT com To reply please remove the "1234" and translate the rest.Received on Sat Dec 20 2003 - 02:31:38 CET