What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 15202 |  Welcome, Guest!   Register  Login
 Home > Forums > Others > write procedures in oracle ...
Malar

write procedures in oracle

Replies: 5 | Posted by: Malar on 7/7/2012 | Category: Others Forums | Views: 357 | Status: [Member] | Points: 10  


how to write procedures in oracle
how to call in c#


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Mallesh
Mallesh  
Posted on: 7/7/2012 4:30:50 AM
Level: Starter | Status: [Member] | Points: 25

In Oracle, you can create your own procedures as follows.

The syntax for a procedure is:

CREATE [OR REPLACE] PROCEDURE procedure_name

[ (parameter [,parameter]) ]
IS
[declaration_section]
BEGIN
executable_section
[EXCEPTION
exception_section]
END [procedure_name];



When you create a procedure or function, you may define parameters. There are three types of parameters that can be declared:

IN - The parameter can be referenced by the procedure or function. The value of the parameter can not be overwritten by the procedure or function.
OUT - The parameter can not be referenced by the procedure or function, but the value of the parameter can be overwritten by the procedure or function.
IN OUT - The parameter can be referenced by the procedure or function and the value of the parameter can be overwritten by the procedure or function.


http://www.devshed.com/c/a/Oracle/Oracle-Stored-Procedures/2/
http://infolab.stanford.edu/~ullman/fcdb/oracle/or-plsql.html#procedures

== Mallesh

Malar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Ranjeet_8
Ranjeet_8  
Posted on: 7/11/2012 2:34:18 AM
Level: Gold | Status: [Member] | Points: 25

CREATE PROCEDURE remove_emp (employee_id NUMBER) AS
tot_emps NUMBER;
BEGIN
DELETE FROM employees
WHERE employees.employee_id = remove_emp.employee_id;
tot_emps := tot_emps - 1;
END;

OR refer this url

http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_6009.htm

Malar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Patel28rajendra
Patel28rajendra  
Posted on: 7/11/2012 5:00:39 AM
Level: Starter | Status: [Member] | Points: 25

Hi

The syntax for a procedure is:

CREATE [OR REPLACE] PROCEDURE procedure_name

[ (parameter [,parameter]) ]
IS
[declaration_section]
BEGIN
executable_section
[EXCEPTION
exception_section]
END [procedure_name];



Regards

R D Patel

Malar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Patel28rajendra
Patel28rajendra  
Posted on: 7/11/2012 5:02:17 AM
Level: Starter | Status: [Member] | Points: 25

Malar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Ketvin
Ketvin  
Posted on: 7/12/2012 1:41:55 AM
Level: Starter | Status: [Member] | Points: 25

This Docs May Help You.

http://docs.oracle.com/cd/A60725_05/html/comnls/us/pa/cxovie05.htm

Also Use Following Code For Create Procedure.

You need the CREATE PROCEDURE system privilege to create a procedure in your own schema.

Open SQL*Plus from Windows and log on to your database.

From SQL*Plus, open your skeleton.sql file.

SQL*Plus loads the contents of your skeleton.sql file into the SQL*Plus buffer or memory area and presents the SQL*Plus command prompt:

1 CREATE OR REPLACE PROCEDURE skeleton
2 IS
3 BEGIN
4 NULL;
5* END;
SQL>

Execute the contents of the SQL*Plus buffer. Type a front slash and press <enter> like this:

SQL> /

SQL*Plus informs you the procedure has been created successfully and presents the SQL command prompt:

Procedure created.

Malar, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 2:02:29 AM