By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,083 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,083 IT Pros & Developers. It's quick & easy.

I want to update a field of a table from other table on Run_time.

P: 5
Hi and thanks to pragatiswain for reply.

i tell u about tables in the database.
TABLE NAMES are "SUB_HEAD","CATEGORY","COMPANY","BILL","BILL_DETAI L.

I've a master detail relationship b/w BILL and BILL_DETAIL FORM.

Master table is "BILL" and Child table is "BILL_DETAIL".
and also CATEGORIES and COMANY tables values are dependent on "BILL and BILL_DETAIL" table.

I want that when i enter values in master detail form and when i press save button then it
those values(of COMPANY and Categories tables), which are dependent on master detail form, should
be updated , which trigger should i use in the FORMS.

Please help me to solve out the problem.
These are the table structures:

1. SUB_HEAD Table Structure

Name Null? Type
------------------------------- -------- ----
S_HEAD_CODE NOT NULL VARCHAR2(12)
S_HEAD_NAME NOT NULL VARCHAR2(60)
M_HEAD_CODE NOT NULL VARCHAR2(12)
TAXABLE NOT NULL VARCHAR2(6)
S_HEAD_TEXT NOT NULL VARCHAR2(1000)
ADDITIONAL_ALLOCATION NUMBER(38)
INITIAL_ALLOCATION NUMBER(38)
---------------------------------------------------------------------------------------------
2. CATEGORIES Table

Name Null? Type
------------------------------- -------- --------------- ----
S_HEAD_CODE NOT NULL VARCHAR2(12)
CATEGORY_CODE NOT NULL NUMBER(38)
CATEGORY_DESC NOT NULL VARCHAR2(50)


3. COMPANY TABLE

Name Null? Type
------------------------------- -------- ----
COMP_ID NOT NULL NUMBER(38)
COMP_NAME NOT NULL VARCHAR2(40)
CONTACT_PERSON VARCHAR2(25)
COMP_ADDRESS VARCHAR2(200)
NTN VARCHAR2(15)
OWNER_CNIC VARCHAR2(15)
TOTAL_BUSINESS_PURCHASE NUMBER(38)
TOTAL_BUSINESS_REPAIR NUMBER(38)

(Note: TOTAL_BUSINESS_PURCHASE and TOTAL_BUSINESS_REPAIR field is dependent on the field of " BILL_AMOUNT" of BILL_DETAIL table)
because these fields are amount of business in rupees

4. BILL TABLE

Name Null? Type
------------------------------- -------- ----
BILL_ID NOT NULL NUMBER(38)
S_HEAD_CODE NOT NULL VARCHAR2(12)
BILL_DATE NOT NULL DATE
TOTAL_BILL NUMBER(38)
------------------------------------------------------------------------------------------------


5. Name Null? Type
------------------------------- -------- ----
BILL_ID NOT NULL NUMBER(38)
S_HEAD_CODE NOT NULL VARCHAR2(12)
SR_NO NOT NULL NUMBER(38)
BILL_AMOUNT NUMBER(38)
DESCRIPTION NOT NULL VARCHAR2(1000)
CATEGORY_CODE NUMBER(38)
COMP_ID NUMBER(38)
TAX_AMOUNT NUMBER(38)
TAX_ID NUMBER(38)

---------------------------------

Please tell me which TRIGGER should be used in ORACLE FORMS.

Thanks and Regards
Nov 22 '06 #1
Share this Question
Share on Google+
1 Reply


Expert
P: 96
You quoted : "Master table is "BILL" and Child table is "BILL_DETAIL".
and also CATEGORIES and COMANY tables values are dependent on "BILL and BILL_DETAIL" table."

MY QUESTION : WHICH FIELDS ARE DEPENDENT AND HOW?

I FEEL, YOUR INFORMATION IS INADEQUATE TO DO WHAT YOU EXACTLY WANT. AGAIN, YOU PROBABLY DIDN'T UNDERSTAND THAT I HAVE ALREADY PROVIDED YOU THE SOLUTION. YOU HAVE TO JUST MODIFY IT BASED ON YOUR BUSINESS LOGIC AND CREATE IT IN THE DB. IT WILL SOLVE YOUR PROBLEM.
TRIGGER IS A DATABASE OBJECT WHICH YOU HAVE TO CREATE BASED ON YOUR REQUIREMENT.

TRIGGER CREATION STRUCTURE:

CREATE OR REPLACE TRIGGER <YOU_SPECIFY_TRIGGER_NAME>
<AFTER / BEFORE> <INSERT / UPDATE>
ON <YOUR_SOURCE_TABLE_NAME>
FOR EACH ROW
BEGIN
<YOUR_CODE_LOGIC_IMPLEMENTATION>
END <YOU_SPECIFY_TRIGGER_NAME>;

NOTE : WHILE WRITING THE LOGIC, :NEW REPRESENTS THE CURRENT RECORD ON WHICH IS AFFECTED IN SOURCE TABLE AND ITS COLUMN CAN BE ACCESSED AS :NEW.<SOURCE_TABLE_COLUMN>
YOU TRY TO WRITE THE TRIGGER. IF YOU FACE ANY PROBLEM, MEMBERS HERE CAN HELP YOU OUT.
Nov 22 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.