Oracle cursor for updating in oracle dating traditional thai girl

END process_employee; The implicit SELECT INTO offers the most-efficient means of returning that single row of information to your PL/SQL program.In addition, the use of SELECT INTO states very clearly that you expect at most one row, and the statement will raise exceptions (NO_DATA_FOUND or TOO_MANY_ROWS) if your expectations are not met.

Code Listing 1: Encapsulating SELECT INTO in a function PACKAGE employees_qp IS FUNCTION last_name (id_in IN employees.employee_id%TYPE) RETURN employees.last_name%TYPE; END employees_qp; PROCEDURE process_employee (id_in IN employees.employee_id%TYPE) IS l_last_name employees.last_name%TYPE; BEGIN l_last_name := employees_qp.last_name (id_in); END process_employee; With this approach, you are much more likely to reuse that SELECT INTO rather than write it repeatedly in your code.

This reuse is important, because it will make optimizing the SQL statements in your application much easier.

In particular, you will be able to take advantage of Oracle Database 11’s function result cache feature more quickly and smoothly.

This technique will “work,” but the program will consume a dangerously large amount of per-session memory. Instead, switch to an associative array or nested table and use the LIMIT clause with BULK COLLECT (as described in the next section).

By the way, if you are writing back-end code that serves up data to a stateless user interface, as is often the case with browser-based applications, you would never retrieve so many rows at once.

Leave a Reply