473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,395 developers and data experts.

PL/SQL-PROCEDURES - 1

debasisdas
8,127 Expert 4TB
PROCEDURE:-IT IS A COMPILED BLOCK OF CODE WHICH IS STORED AS AN OBJECT WITHIN THE DATABASE. IT MAY OR MAY NOT RETURN ANY VALUE OR MIGHT RETURN MORE THAN ONE VALUE.

syntax
------------
CREATE [OR REPLACE] PROCEDURE PROCEDURENAME([PARAMETER PARAMETER MODE DATATYPE [,PARAMETER...,....]])
{IS/AS}
[LOCAL DECLARATION];
BEGIN
EXECUTABLE STATMENT;
[EXCEPTION
EXCEPTION HANDLER]
END [PROCEDURENAME];

SAMPLE EXAMPLE TO SHOW PARAMETER LESS PROCEDURE
==================================================
Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE list_tables AS
  2. BEGIN
  3. dbms_output.put_line('These are the tables you own:');
  4. FOR item IN (SELECT table_name FROM user_tables)
  5. LOOP
  6. dbms_output.put_line(item.table_name);
  7. END LOOP;
  8. END;
  9.  

Parameters
===========
1.formal---declared In The Defination Of The Procedure.they Receive The Value.
2.actual---passed Within Parenthesis,to Execute The Procedure.

Parameter Mode--it Specifies What Can Be Done With The Parameters.

In/out/in Out
------------------------

In--(default)-it Lets To Pass A Value To The Subprogram Being Called.the Value Can't Be Changed Inside The Subprogram.it Is Like A Constant.it Can't Be Assigned Any Value.

Out--it Lets The Subprogram Pass A Value To The Caller.inside The Subprogram The Out Parameter Is An Un-initialised Variable.
Subprogram Has To Place A Value In The Out Parameter. What Ever Changes Are Made To The Out Parameter Are Made Available To The Actual Parameter.the Actual Parameter Corresponding To The Out Parameter Must Be A Variable.

In Out--it Is Same As In And Out Both Together.it Can Get A Value From The Calling Procedure And Can Return A Value To The Calling Procedure.the Value Of This Type Of Paramater Can Be Used In Subprogram And The Actual Parameter Must Be An Initialised Variable.


Also check PL/SQL-PROCEDURES - 2
May 30 '07 #1
1 5005
can any 1 tell me advantages of using stored procedures in postgresql.........
Feb 20 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: cooldv | last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and Access 2000 database. (with a hosting company) traffic is slow at this time but expect to grow. lately i have been reading...
2
by: Peter | last post by:
I run most of my SQL scripts via kornshell on AIX. I use the "here-document" to run some of the smaller ones. Example: #!/bin/ksh # Analyze the table. sqlplus...
0
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the...
2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
4
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
6
by: Fuzzydave | last post by:
I am back developing futher our Python/CGI based web application run by a Postgres DB and as per usual I am having some issues. It Involves a lot of Legacy code. All the actual SQL Querys are...
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
5
by: dbrother | last post by:
Access 2003 Win XP Pro SP3 Using SQL /ADO Recordsets in a Do Loop Hello, I'm using a random number generator based on an integer input from a user from a form that will get X number of random...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.