Oracle Stored Procedures

Source: Internet
Author: User

CREATE TABLE STUDENT (--Creating student tables
ID Number (TEN) PRIMARY key,--primary Key ID
SNAME VARCHAR2 (20),
);

--Create a stored procedure to add a record to a student table

CREATE OR REPLACE PROCEDURE procedure_add
(in_id in Student.id%type,in_sname STUDENT. Sname%type)
As
BEGIN
INSERT into STUDENT VALUES (in_id,in_sname);
Dbms_output. Put_Line (' data added successfully! ‘);
END Procedure_add;
--when the process is called because it is adding data so when you add it, commit commits or the added data cannot be displayed.
--set serverout on before calling

EXECUTE Procedure_add (NULL, ' AA ', 3);--it is important to note that the ID should be preceded by a trigger to automatically grow otherwise the first parameter here cannot be written as null to give a value I've already written the trigger so here's a null value about ID autogrow The previous article has been written to make reference to

I am a stored procedure written in Sqldeveloper, but the process is performed in Sqlplus

Oracle Stored Procedures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.