PL/SQL User's Guide and Reference | ![]() Library |
![]() Product |
![]() Contents |
![]() Index |
When you want to read or write a text file, you call the function fopen, which returns a file handle for use in subsequent procedure calls. For example, the procedure put_line writes a text string and line terminator to an open file. The procedure get_line reads a line of text from an open file into an output buffer.
PL/SQL file I/O is available on both the client and server sides. However, on the server side, file access is restricted to those directories explicitly listed in the accessible directories list, which is part of the Oracle initialization file.
For more information, see Oracle7 Server Application Developer's Guide.
Also, several new attributes give you previously unavailable information about a PL/SQL table. Attributes are characteristics of an object. Every PL/SQL table has the attributes EXISTS, COUNT, FIRST, LAST, PRIOR, NEXT, and DELETE. They make PL/SQL tables easier to use and your applications easier to maintain.
For example, COUNT returns the number of elements that a PL/SQL table contains. COUNT is useful because the size of a PL/SQL table is unconstrained. Suppose you fetch a column of Oracle data into a PL/SQL table. How many elements does the PL/SQL table contain? COUNT gives you the answer.
To apply the attributes to a PL/SQL table, you use dot notation, as the following example shows:
IF ename_tab.COUNT = 50 THEN ...
For more information, see "PL/SQL Tables" .
The Oracle Server also has a PL/SQL engine. So, you can pass cursor variables back and forth between an application and server via remote procedure calls (RPCs). And, if you have a PL/SQL engine on the client side, calls from client to server impose no restrictions. For example, you can declare a cursor variable on the client side, open and fetch from it on the server side, then continue to fetch from it back on the client side.
Furthermore, now you can define weak (nonrestrictive) REF CURSOR types. As the following example shows, a strong REF CURSOR type definition specifies a return type, but a weak definition does not:
DECLARE TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE; -- strong TYPE GenericCurTyp IS REF CURSOR; -- weak
Weak REF CURSOR types are more flexible because PL/SQL lets you associate a weakly typed cursor variable with any query.
Also, now you can apply the cursor attributes %FOUND, %ISOPEN, %NOTFOUND, and %ROWCOUNT to a cursor variable. They return useful information about the execution of a multi-row query.
For more information, see "Using Cursor Variables" .
For more information, see "PLS_INTEGER" .
For an example, see "Using Subqueries" .
Needless recompilations can slow network traffic and affect performance. Furthermore, if a client system has no PL/SQL compiler, invalidated applications cannot be recompiled.
Now, Oracle can use timestamps or signatures to manage remote dependencies. (The signature of a subprogram includes its name and the number, datatypes, and modes of its parameters.) When Oracle uses the signature of a remote library unit, dependent subprograms are invalidated only if the signature or specification of the unit was altered. So, dependent subprograms are recompiled only when necessary.
To have Oracle use signatures instead of timestamps, you set the following parameter in the Oracle initialization file:
REMOTE_DEPENDENCIES_MODE = SIGNATURE
You can reset the parameter dynamically, as the following Pro*C example shows:
EXEC SQL ALTER SESSION SET REMOTE_DEPENDENCIES_MODE = TIMESTAMP;
For more information, see Oracle7 Server Application Developer's Guide.
![]() ![]() Prev Next |
![]() Copyright © 1996 Oracle Corporation. All Rights Reserved. |
![]() Library |
![]() Product |
![]() Contents |
![]() Index |