473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Where do SQL/PL programs execute from ?

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
8 3147
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Benny Hill | last post by:
I have a website (running on a linux machine) that currently makes use of JSP to access data on an AS/400. I've found information telling me that after setting up ODBC drivers on the linux...
8
by: Darren Dale | last post by:
Is there a place to put python programs so I dont have to refer to the absolute path everytime I want to call them? For example: if I am in /home/me and want to execute: python...
16
by: Weasel | last post by:
What do i use to compile , and basically program in windows? Since at home i use linux, but at school they dont have linux... what can i use?
3
by: John P | last post by:
Hi, I know that some older Unix programs that compile with GCC use socket.h to connect to and execute other programs. However, I am using Visual C++ 6.0 and it doesn't seem to have socket.h...
2
by: Allan Adler | last post by:
In C, I can execute system("gs gleep.ps"); and have C run a ghostscript program gleep.ps, which might ask for user input and, when it gets it, take some actions and report back to the C...
1
by: Kapil | last post by:
My goal is to write an application in which I need to execute some programs on remote clients. The clients should be listening to the server machine all the time and as soon as a request comes,...
2
by: nareshdacha | last post by:
Is it possible to execute c programs from DOS? If it is possible plz send me details to naresh185@gmail.com
6
by: GUEST | last post by:
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...
0
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: Programs dealing with autoruns Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list programs that help me to view/modify the autoruns...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.