• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7258
  • Last Modified:

Oracle Forms 6i insert, update,delete,search,sort

I am given a program to insert, update, delete, search, sort records... i am new to oracle so can you give me the code on how to do it? and i am also confused on which triggers will be used in doing this....
0
aerokevs
Asked:
aerokevs
1 Solution
 
M-AliCommented:
You can start by using the wizards in forms developer. Start with the block wizard, selecting the table you want your block to be based on, select the fields...basically just follow the instructions of the wizard.

Once the block is created, you can start the layout wizard. Here you select the fields you want displayed, layout format, width, height, number of records etc. This is the fastest way to get a "skeleton" layout. Once the wizard finishes, you can then customize the layout as per your requirements.

When you run forms, by default it will start in insert mode ie an empty block will be displayed allowing users to feed in information. Once the information is fed, you can allow the user to save the record by using the default save button. Alternatively you can create your own toolbar, with buttons for inserting/deleting records etc. In this case you would need to write a trigger to process. For instance to save records, your code would be:
commit_form;

For searching you would need to query. This can be done by using shortcuts, for examply F7 key to enter in query-mode, then enter any search criteria, and F8 to execute the query. Alternatively you can have buttons in your toolbar that would carry out these functions: ENTER_QUERY and EXECUTE_QUERY are the two built-ins you need to use.

Once the record is on the screen (ie visible in the form) the user can update/delete it. For updating again you need to use the save button or COMMIT. For deleting you would need to use the delete button or the DELETE_RECORD builtin.

For sorting, you would need to set the ORDER BY property of the DATA BLOCK. Select the data block, press F4 will give you list of all its properties. If you want to do it programmatically, you will need to use: SET_BLOCK_PROPERTY builtin.

I suggest you go through the online help provided in forms.

Ali
0
 
Helena Markováprogrammer-analystCommented:
If your block is based on a table and you want to insert/update/delete record simply set data block property:

At design time you can use property pallete
INSERT_ALLOWED      Yes
UPDATE_ALLOWED     Yes
DELETE_ALLOWED     Yes

or programmatically:

Set_Block_Property('your_block',INSERT_ALLOWED,PROPERTY_TRUE);
Set_Block_Property('your_block',UPDATE_ALLOWED,PROPERTY_TRUE);
Set_Block_Property('your_block',DELETE_ALLOWED,PROPERTY_TRUE);

Now you can insert/update/delete records.

There are Pre-Insert, Pre-Update and Pre-Delete triggers which you can or can not use. (See "Pre triggers" in the help.)

For sorting,ordering  .... record there are DEFAULT_WHERE and ORDER_BY block properties.

Of yourse it is more complex but if you are a beginner I hope this will be a little help for you.
0
 
Mark GeerlingsDatabase AdministratorCommented:
The basic SQL database activities (select, insert, update, delete, lock record, etc.) are all handled automatically in Forms6i if you create a block based on a table or view.  You don't need to write any code to support these features.  You can add triggers like:
1. pre-insert and/or pre-update to provides some values automatically (user ID, timestamp, etc.)
2. when-validate-item to insure that the value entered exists in a database table somewhere, or meets some other criteria you need to enforce.

There are many more triggers initiated by various events that can be used for more complex data entry, validation, screen manipulation, etc. but I recommend starting with no (or only a few simple) triggers, then adding additional functionality and/or complexity after you get used to the basics.
0
 
aerokevsAuthor Commented:
thanks a lot.. if you have any tips and tricks site about oracle form 6i please tell me thanks...
0
 
Helena Markováprogrammer-analystCommented:
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now