TAILIEUCHUNG - Teach Yourself PL/SQL in 21 Days- P13

Teach Yourself PL/SQL in 21 Days- P13: Welcome to Sams Teach Yourself PL/SQL in 21 Days, Second Edition. The fact that you purchased this book indicates that you have an interest in learning the PL/SQL language, which is Oracle’s relational database procedural programming language. It allows you to develop powerful and complex programs to access and manipulate data in the Oracle8i database. We have attempted to include as many examples of PL/SQL code as possible to illustrate PL/SQL features | PL SQL and Java 577 Input Listing Publishing a Java Method with an OUT Argument 1 CREATE OR REPLACE PROCEDURE get_super_name2 2 emp_id IN NUMBER 3 emp_name OUT VARCHAR2 4 AS LANGUAGE JAVA 5 NAME int 6 Analysis In line 3 the emp_name argument is declared as an OUT argument. If you look at the last part of line 5 you ll see that the corresponding method parameter is an array. Oracle looks at this situation and assumes that element 0 the first element of that array is going to contain the output value. When you call this procedure after the Java method completes Oracle takes element 0 of the String array and places it into the variable used for the emp_name parameter. Note that because the Java method has a void return type it was published as a procedure line 1 and not as a function. Listing shows the get_super_name2 procedure which you just published in Listing being executed from SQL Plus. Input Output Listing Invoking get super name2 from SQL Plus 1 SQL VARIABLE emp_id NUMBER 2 SQL VARIABLE emp_name VARCHAR2 30 3 SQL EXECUTE emp_id 514 4 5 PL SQL procedure successfully completed. 6 7 SQL EXECUTE get_super_name2 emp_id emp_name 8 9 PL SQL procedure successfully completed. 10 11 SQL PRINT emp_id 12 13 EMP_ID 14 . 15 514 16 17 SQL PRINT emp_name 18 19 EMP_NAME 20 . 21 Ashley Nue 20 578 Day 20 Analysis The statements in lines 1 and 2 declare two SQL Plus bind variables for use when calling the published function. A bind variable is necessary for the output variable because you need a place for PL SQL to store the output. The EXECUTE statement in line 3 sets the value of the emp_id bind variable to 514. This is the input to the Java method. The EXECUTE statement in line 7 calls the Java method by using the interface published in Listing . Lines 11-15 show the value of the emp_id variable being displayed. It s still unchanged at 514. Lines 17-21 show the contents of the emp_name variable being .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.