pl sql examples for practice

Alibabacloud.com offers a wide variety of articles about pl sql examples for practice, easily find your pl sql examples for practice information here online.

PL/SQL Practice Basic PL/SQL statements

fromEmpwhereEmpno=N; Dbms_output.put_line ('Employee name is:'||v_ename); Dbms_output.put_line ('Employee Sal is:'||v_sal); Exception whenNo_data_found ThenDbms_output.put_line ('Please input current number!'); End;6. With%type, ensure that the data type of the variable is consistent with the data type of the field in the table:Declarev_ename Emp.ename%type;v_sal emp.sal%type;begin SelectEname,sal intoV_ename,v_sal fromEmpwhereEmpno=N; Dbms_output.put_line ('Employee name is:'||v_ename); Dbms

Oracle PL/SQL practice

11g for optimized compilation 2088.6 conclusion 209Chapter 2 calling PL/SQL 9th from SQL9.1 cost of using PL/SQL functions in SQL 2109.1.1 context switch 2119.1.2 run 2169.1.3 less ideal data access 2189.1.4 difficulties of optimizer 2229.1.5 trap of read consistency 2269.1

Small examples of using cursors, dynamic SQL, and bound variables in PL/SQL

Requirements: Query and output employee information for Department 30thMode one: Use Loop...fetch1 SETServeroutput on;2 DECLARE3 CURSORC_emp is 4 SELECT * fromEmpWHEREDeptno= -;5V_emp EMP%RowType; 6 BEGIN7 OPENc_emp;8 Loop9 FetchC_emp intov_emp;Ten Exit whenC_emp%NotFound; OneDbms_output.put_line (v_emp.empno||' '||V_emp.ename||' '||V_emp.job||' '||V_emp.mgr||' '||V_emp.hiredate||' '||V_emp.sal||' '||V_emp.comm||' '||V_emp.deptno); A EndLoop; - Closec_emp; - E

Oracle Daily Practice free to install Oracle clients using PL/SQL

/volnet/plsqldev.ico) 7.3.2 to eliminate the black command-line window, you can also write the following bat file directly: set nls_lang=simplified Chinese_china. Zhs16gbkStart plsqldev.exe This will not show a black command-line window. The same way to modify the icon. I'm also in the study of how applications that you write can be deployed in a free-to-install manner, and this link is worth referencing: http://www.oracle.com/technetwork/issue-archive/2008/08-nov/o68odpnet-101744.html For the

Oracle Pl/sql Introductory Case Practice _oracle

The Oracle tutorial you are looking at is the Oracle Pl/sql introductory case practice. We have already learned the basics of pl/sql programming, and this article will combine a case to deepen understanding of these knowledge points. A Case Introduction A database has two

PL/SQL Practice cursor cursor:oracle A private area of memory allocated for SQL statements when executing SQL statements

a record matching the criteria can be found in the cursor, the result is trueSql> Declare 2 3v_id t1.id%type; 4 5 begin 6 7V_ID:=Ten; 8 9 Delete fromT1whereId=v_id;Ten One ifSql%Found Then ADbms_output.put_line ('T1 Recorder is delete!'); - Commit; - End if; the End;3.sql%rowcout statistics The number of records processed in the cursorSql> Declare 2 3v_id t1.id%type; 4 5 begin 6 7V_ID:=Ten; 8 9 In

PL/SQL Practice

Dept values (V_deptno, V_dname, V_loc);CommitexceptionWhen E_dept_err ThenDbms_output.put_line (' You deptno are not unique,please input unique deptno number! ');When others thenDbms_output.put_line (' other error ');Endsql> exec insert_dept ("Zhangsan", ' Beijing ')PL/SQL procedure successfully completedsql> exec insert_dept ("Zhangsan", ' Beijing ')You deptno are not unique,please input unique Deptno num

ORACLE PL/SQL Practice (vii)

20-feb-81 1600 300 307521 WARD salesman 7698 22-feb-81 1250 500 307654 MARTIN salesman 7698 28-sep-81 1250 1400 307698 BLAKE MANAGER 7839 01-may-81 2850 307844 TURNER salesman 7698 08-sep-81 1500 0 307900 JAMES Clerk 7698 03-dec-81 950 306 rows selected.Define and UndefineSql> Define Name=enameSql> select name,sal from emp;Ename SAL---------- -----SMITH 800ALLEN 1600WARD 1250JONES 2975MARTIN 1250BLAKE 2850CLARK 2450SCOTT 3000KING 5000TURNER 1500ADAMS 1100JAMES 950FORD 3000MILLER 1300Rows select

PL/SQL Practice named blocks: stored procedures, functions, triggers, packages

(V_empnoinch Number, V_ename outvarchar2, v_sal out Number) 3 is 4 5 begin 6 7 SelectEname,sal intoV_ename,v_sal fromEmpwhereEmpno=V_empno; 8 9Dbms_output.put_line ('Employee name is:'||v_ename); Ten OneDbms_output.put_line ('Employee Salary is:'||v_sal); AException - whenNo_data_found Then -Dbms_output.put_line ('Employee ID is error!'); the whenOthers Then -Dbms_output.put_line ('Others Error!'); - End;running under the system:

PL/SQL Practice explicit Cursors

; - Closecur_emp; + - End; ② reading cursor data through a For loop: Sql> Declare 2 cursorCur_emp is 3 Select * fromEmpwhereDeptno=No; 4 5 begin 6 forEmp_recinchCur_emp Loop7Dbms_output.put_line (emp_rec.ename||' , '||Emp_rec.sal||' , '||Emp_rec.deptno); 8 EndLoop; 9 Ten End; ③ cursors with parameters: passing parameters to Cursors Sql> Declare 2 3

"PL/SQL Practice" custom exceptions

2E_emp_remain exception; 3pragma exception_init (E_emp_remain,-2291); 4 5V_empno Emp.empno%Type:=N; 6V_deptno Emp.deptno%Type:=nn; 7 8 begin 9 UpdateEmpSetDeptno=V_deptnowhereEmpno=V_empno; Ten Commit; OneException A whenE_emp_remain Then -Dbms_output.put_line ('Department is NOT exists!'); - whenOthers Then theDbms_output.put_line ('Others Error!'); - End; Get error codes and error messages in others: Sqlcode:oracle error code sqlerrm:oracle er

Oracle Practice--pl/sql-based code block

A code block for the basic introduction to PL/SQLPL/sql: Process language (Procedure Language) and structured language (structured Query Language) A combined programming language is an extension to SQL that supports a variety of data types such as large objects and collection types, using control statements such as conditions and loops, creating stored procedu

PL/SQL on-machine Practice (i)

_ (: _"∠) _ _ (: _"∠) _ _ (: _"∠) _ Cheat Traffic Series _ (: _"∠) _ _ (: _"∠) _ _ (: _"∠) _Title Description:The names of all employees in the employee table are treated as follows: The first letter of the name is between ' A ' and ' G ', merged into the first string, between ' H ' and ' O ', merged into a second string, between ' P ' and ' Z ', merged into a third string, separated by a space between the names.Code:DECLAREstr1 String ( -); str2 string ( -); Str3 string ( -);CURSORName_ag isSEL

Working with Numbers in PL/SQL (use Numbers in PL/SQL)

the performance of computation-intensive operations. these datatypes are not supported ed in this article. in practice, you may encounter other numeric types, such as FLOAT, INTEGER, and DECIMAL. these are subtypes of the four core numeric types in the preceding list. now let's take a closer look at NUMBER and PLS_INTEGER.The NUMBER datatype. the NUMBER data-type is by far the most common numeric datatype you'll encounter in the world of Oracle and

Working with numbers in PL/SQL (use numbers in PL/SQL)

. These datatypes are not supported ed in this article. In practice, you may encounter other numeric types, such as float, integer, and decimal. These are subtypes of the four core numeric types in the preceding list. Now let's take a closer look at number and pls_integer. The number datatype. the number data-type is by far the most common numeric datatype you'll encounter in the world of Oracle and PL/

Working with Dates in PL/SQL (date used in PL/SQL)

Working with Dates in PL/SQL (date used in PL/SQL) The previous articles in this introductory PL/SQL series focused on working with strings and numbers in PL/

Oracle Stored Procedure debugging and Pl/SQL installation in 64-bit operating system (prompt that Oracle has been installed before pl/SQL installation)

Today, I am working on an OA report. I use a stored procedure to calculate some data. When doing a for xxx in xxxx loop end loop; loop, I never knew it was Mao. I can't catch the no_data_found exception in for any more. Once this no_data_found Oracle occurs, it automatically jumps out of the for loop, but I don't know what went wrong, that was depressing for an hour. Shit. Later I remembered that pl/SQL too

Description of Oracle PL/SQL Performance Analysis Tool profiler

normal. After testing, the problem was found. The previous environment was 64-bit Windows 7 + 32-bit Oracle 11gr2, and oracle was changed to 64-bit 11gr2. This cause may be related to the version, because it cannot be ruled out by some unknown factors solved by the re-installation. The test results are as follows: 3. The difference between the two examples is that example 1 does not modify the PL/

PL/SQL data development that's something.

, the program immediately stops executing and goes to execute the exception handler.After the exception is processed, the execution of the entire PL/SQL block ends. So once an exception occurs, in the executable portion of the PL/SQL block, starting at the place where the exception occurred, the future code will no lon

How to use dynamic SQL in PL/SQL Development

Abstract: In the PL/SQL development process, SQL, PL/SQL can be used to meet most of the requirements. However, in some special cases, standard SQL statements or DML statements in PL/

Total Pages: 6 1 2 3 4 5 6 Go to: Go

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.