PLSQL herkesin bilmesi gerekenler-4

7- DBMS_SESSION.SET_SQL_TRACE

Yazılan sqlleri trace etmek bizim açımızdan son derece önemlidir.

DBMS_SESSION.SET_SQL_TRACE(sql_trace BOOLEAN);

CREATE OR REPLACE PROCEDURE core_process IS
BEGIN
IF USER = ‘PLSQL_USER’ THEN
DBMS_SESSION.SET_SQL_TRACE(TRUE);
DBMS_OUTPUT.PUT_LINE(‘trace açıldı’);
END IF;
DBMS_SESSION.SET_SQL_TRACE(FALSE);
DBMS_OUTPUT.PUT_LINE(‘Trace kapandı.’);
END;
/

8-UTL_FILE/DBMS_OUTPUT

Operating sistem okuma ve yazma işlemlerine yarayan hazır paketlerimiz.

Önce oracle’nın operating sisteme ulaşması için bir directory yaratıp o directoryde hak vermemiz gerekir.

CREATE OR REPLACE DIRECTORY ‘TEMP_DIR’ AS ‘/usr/users/oracle’;
GRANT READ, WRITE ON DIRECTORY TEMP_DIR TO plsql_user;

PROCEDURE FREMOVE
Argument Name Type In/Out Default?
————————— ———————– —— ——–
LOCATION VARCHAR2 IN
FILENAME VARCHAR2 IN

PROCEDURE FRENAME
Argument Name Type In/Out Default?
————————— ———————– —— ——–
SRC_LOCATION VARCHAR2 IN
SRC_FILENAME VARCHAR2 IN
DEST_LOCATION VARCHAR2 IN
DEST_FILENAME VARCHAR2 IN
OVERWRITE BOOLEAN IN DEFAULT

PROCEDURE FCOPY
Argument Name Type In/Out Default?
————————— ———————– —— ——–
SRC_LOCATION VARCHAR2 IN
SRC_FILENAME VARCHAR2 IN
DEST_LOCATION VARCHAR2 IN
DEST_FILENAME VARCHAR2 IN
START_LINE BINARY_INTEGER IN DEFAULT
END_LINE BINARY_INTEGER IN DEFAULT

PROCEDURE FGETATTR
Argument Name Type In/Out Default?
————————— ———————– —— ——–
LOCATION VARCHAR2 IN
FILENAME VARCHAR2 IN
FEXISTS BOOLEAN OUT
FILE_LENGTH NUMBER OUT
BLOCK_SIZE BINARY_INTEGER OUT

DBMS_output paketmiz sayesinde ekrana plssqlden bir bilgiyi yazdırabiliriz.

set serveroutput on olmalıdır.

SET serveroutput on
begin
dbms_output.put_line(‘MERHABA’);
end;
/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s