PL/SQL Developer is an integrated development environment that specializes in developing applications for Oracle databases. PL/SQL is also a programming language called the procedural SQL language (procedural language/sql), which is an extension of the Oracle database to SQL statements. In the use of ordinary SQL statements to increase the characteristics of the programming language, so PL-SQL to the data Operations and query statements organized in the PL/SQL code of the process unit, through logical judgment, loop and other operations to achieve complex functions or calculations, so that the SQL language has process capabilities. PL/SQL is available only for Oracle databases.
A PL/SQL program Structure :
Declare
Description section (variable description, cursor declaration, exception description)
Begin
Statement sequence (DML statement) ...
exception
Exception Handling Statements
End
Here's a question about variables:
Var1 char (15);--describes the variable name, data type, and length followed by a semicolon ending description statement.
Married boolean:=true;--uses ": =" to denote an equal sign "=", and "=" for "= =".
My_name emp.ename%type;--reference variable, that is, the type of my_name is the same as the type of the ename column in the EMP table
Emp_rec emp%rowtype;--Record type variable
Reference to the variable component of the record type: emp_rec.ename:= ' Adams ';
An example of the following plsql: According to the employee's job increase wages, the President 1000 yuan, the manager 800 yuan, the other people rose 400 yuan.
Declare cursor Cemp is select Empno,empjob from emp; Pempno Emp.empno%type; Pjob emp.empjob%type;begin rollback; Open cemp; Loop -Take a record fetch cemp into pempno,pjob; Exit when Cemp%notfound; --Judge Position if Pjob = ' president ' then update EMP set sal=sal+1000 where empno=pempno; elsif pjob = ' MANAGER ' then update emp set sal=sal+800 where empno=pempno; Else update emp set sal=sal+400 where empno=pempno; End If; End Loop; Close Cemp; commit; Dbms_output.put_line (' done '); end;/
before the rise:
after the rise:
The data manipulation ability of SQL language is combined with the data processing ability of process language, which makes plsql more simple, efficient and practical than the process language.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Oracle's Plsql