By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,197 Members | 974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,197 IT Pros & Developers. It's quick & easy.

Where do SQL/PL programs execute from ?

P: n/a
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
--
inderpaul_s1234 AT yahoo DOT com

To reply please remove the "1234" and translate the rest.
Jul 19 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
You've got it perfectly, a PL/SQL program can run from SQL*Plus.
Please post your code, and the reason why you think it doesn't run.

Daniel
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

Jul 19 '05 #2

P: n/a
You've got it perfectly, a PL/SQL program can run from SQL*Plus.
Please post your code, and the reason why you think it doesn't run.

Daniel
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

Jul 19 '05 #3

P: n/a
for running a pl/sql script you need to put a "begin" at start and an
"end" at the end of script an yes you can run it from sql* plus
prompt.

if you can post the code you are trying to run that would be easier
for group to answer.;
Faheem

da*************@hotmail.com (Daniel Roy) wrote in message news:<37************************@posting.google.co m>...
You've got it perfectly, a PL/SQL program can run from SQL*Plus.
Please post your code, and the reason why you think it doesn't run.

Daniel
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

Jul 19 '05 #4

P: n/a
for running a pl/sql script you need to put a "begin" at start and an
"end" at the end of script an yes you can run it from sql* plus
prompt.

if you can post the code you are trying to run that would be easier
for group to answer.;
Faheem

da*************@hotmail.com (Daniel Roy) wrote in message news:<37************************@posting.google.co m>...
You've got it perfectly, a PL/SQL program can run from SQL*Plus.
Please post your code, and the reason why you think it doesn't run.

Daniel
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

Jul 19 '05 #5

P: n/a
On Mon, 15 Dec 2003 22:14:42 GMT a@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.
Jul 19 '05 #6

P: n/a
One way to execute it to make it a stored procedure at the end of code
and another end;
like this
creat or replace procedure Test is

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




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
and remove the declare keyword
like this

create or replace procedure Test is

GUEST <a@b.com> wrote in message news:<MP************************@nntp.slnt.phub.ne t.cable.rogers.com>... On Mon, 15 Dec 2003 22:14:42 GMT a@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

('------------------------------------------------');
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;

Jul 19 '05 #7

P: n/a
On 19 Dec 2003 23:49:14 -0800 fa*******@yahoo.com says...
One way to execute it to make it a stored procedure at the end of code
and another end;
like this
creat or replace procedure Test is

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






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


and remove the declare keyword


Ok thanks I'll give it a try...

--
inderpaul_s1234 AT yahoo DOT com

To reply please remove the "1234" and translate the rest.
Jul 19 '05 #8

P: n/a
You can always do this.

SQL> declare
<your decalarations>
begin
<you pl/sql stuff>
end ;
/

You can have your PL/SQL in a file and call it from SQL*Plus.

SQL> @<your pl_sql file>
/

Also make sure to have the server output on, to see your dbms_output results.

Regards,
Prince.

GUEST <a@b.com> wrote in message news:<MP************************@nntp.slnt.phub.ne t.cable.rogers.com>...
On 19 Dec 2003 23:49:14 -0800 fa*******@yahoo.com says...
One way to execute it to make it a stored procedure at the end of code
and another end;
like this
creat or replace procedure Test is

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






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


and remove the declare keyword


Ok thanks I'll give it a try...

Jul 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.