PLSQL bilinmesi gerekenler-6

12-PLSQL source code versioning:

ilk önce history bilgilerimiz tutacak bir tablo yaratalım.

CREATE TABLE source_history
(change_date DATE NOT NULL,
owner VARCHAR2(30) NOT NULL,
name VARCHAR2(30) NOT NULL,
type VARCHAR2(20),
line NUMBER NOT NULL,
text VARCHAR2(4000));

Daha sonra

CREATE OR REPLACE trigger source_history
AFTER CREATE ON DATABASE
BEGIN
INSERT INTO source_history
SELECT SYSDATE, owner, name, type, line, text
FROM dba_source
WHERE owner = ORA_DICT_OBJ_OWNER
AND name = ORA_DICT_OBJ_NAME
AND type = ORA_DICT_OBJ_TYPE;
END source_history;
/

COLUMN owner FORMAT a12
COLUMN name FORMAT a11
COLUMN line FORMAT 9999
COLUMN text FORMAT a60 WORD_WRAPPED
SELECT change_date, owner, name, type, line, text
FROM source_history
WHERE name = ‘PIN_OBJECTS’
order by change_date, owner, name, type, line;

historymiz asağıdaki şekilde oluşacaktır.

CHANGE_DA OWNER NAME TYPE LINE TEXT
——— ———— ———– ———- —– ————————————————————
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 1 PROCEDURE pin_objects
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 2 (p_pin_flag_txt IN VARCHAR2 := ‘P’) IS
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 3 — The p_pin_flag_txt is either ‘P’ for pin
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 4 — or ‘U’ for unpin.
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 5 CURSOR cur_pin_objects IS
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 6 SELECT owner ‘.’ owner,
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 7 object
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 8 FROM objects_to_pin
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 9 ORDER BY owner, object;
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 10 BEGIN
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 11 FOR cur_pin_objects_rec IN cur_pin_objects LOOP
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 12 IF p_pin_flag_txt = ‘U’ THEN
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 13 DBMS_SHARED_POOL.UNKEEP(cur_pin_objects_rec.owner
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 14 cur_pin_objects_rec.object, ‘P’);
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 15 ELSE
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 16 DBMS_SHARED_POOL.KEEP(cur_pin_objects_rec.owner
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 17 cur_pin_objects_rec.object, ‘P’);
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 18 END IF;
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 19 END LOOP;
27-JAN-07 TRIGGER_TEST PIN_OBJECTS PROCEDURE 20 END pin_objects;

Advertisements

About oracledocuments

Zekeriya Beşiroğlu, It joined the Bilginc IT Academy in July 2000. In the meantime, the Oracle Education, Oracle Data Base Management System and Oracle Internet Technologies, Oracle development technologies such as the training of Oracle products is responsible for training as consultants. During this task, since 1 April 2008 with 293 Oracle training in total, in 2150 Oracle customers successfully submitted. Oracle 10g New York in November 2002 have received training and education in Turkey was the first time the consultants. 20 April 2008 on education in Turkey 11g is the first who was a consultant. Oracle Real Application Cluster Expert advisor is certified is the first . Http://zekeriyabesiroglu.blogspot.com and Http://www.oracleforum.info owner and manager of the site. Its own has more than one hundred articles. In addition, creation and improvement of training materials are also related to work. Oracle products are used, database management and reporting Academy eruditely It also is working on. From the date of 1 January 2009 will continue to work as the Technical Director
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

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