-
Copyrights 2010 - Online Training Oracle Applications. All Rights Reserved.
|
Used to share the code across the modules. Pl/SQL Libraries generally contain procedures, functions and packages. Creating PL/SQL Library Open the form builder tool Select PL/SQL Libraries Click on Create Select Program units Click on create Name -- add_num Types Select Function OK Provide the following code and compile
function add_num ( a number, b number) return number Lets create another function In the Object Navigator Under Pl/SQL Libraries Under Program units Click on create button Name -- mul_num Types Select Function OK
Provide the following code and compile function mul_num ( x number, y number) Lets create another function In the Object Navigator Under Pl/SQL Libraries Under Program units Click on create button Name -- sub_num Types Select Function OK function sub_num ( n number, m number) select n-m into r from dual; So, our library is having three functions. Now, Go to File Save as TEST.pll Using Libraries in Forms Open the from builder tool Build new form manually In the Object Navigator We get the following Alert Click on No Select Data Blocks Click on create button Select build a new Data Block manually OK General Note In Object Navigator General Go to the Layout editor Name the two text items as T1 and T2 Name the buttons as B1 , B2, B3 and B4 Provide the following label respectively For B1 label it as ADD Name the Display Item as D1, Prompt as Result Create WHEN-BUTTON-PRESSED for the button B1 and provide the following code and compile. :D1 := add_num (:T1, :T2); Create WHEN-BUTTON-PRESSED for the button B2 and provide the following code and compile. :D1 := mul_num (:T1, :T2); Create WHEN-BUTTON-PRESSED for the button B3 and provide the following code and compile. :D1 := sub_num (:T1, :T2); clear_block; Save the form with the name CALCULATE.fmb Compile the form. Check the functionality. Advantage
|