Oracle stored procedure and serialized write demo

Source: Internet
Author: User
1. Create an Oracle stored procedure, set a parameter n, execute the stored procedure, and pass the parameter n. After the execution, the output is five times. Note: The for statement is used in the stored procedure.

1. Create an Oracle stored procedure, set a parameter n, execute the stored procedure, and pass the parameter n. After the execution, output the parameter hello world five times. Note: The stored procedure uses the for statement.

1. Create an Oracle stored procedure and set the parameter n

Then run the stored procedure to pass a parameter n, and output the hello world five times.

Note: Use the for loop in the stored procedure and execute the exec

Create or replace procedure Hello (n in number)
Is begin
For I in 1. n loop
Dbms_output.put_line ('Hello World ');
End loop;
End;
/

-- Open output
Set serveroutput on;

-- Execute this function
Execute Hello (5 );

2. Create a sequence (Initial Value 1030, step 1 ),

Use this sequence to insert two data records to the emp table.

(The sequence creation statement and the data insertion statement must be written)

Create sequence myse increment by 1 start with 1030;
Insert into emp_xxx values (myse. nextval, 'zhang Wuji ', 'manager', '12-January 10 );

,

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.