Home » Developer & Programmer » Forms » update table data via oracle forms 10g (oracle forms 10 g)
update table data via oracle forms 10g [message #515010] Thu, 07 July 2011 13:36 Go to next message
msdtjw
Messages: 25
Registered: March 2011
Junior Member
I am trying to develope a form consisting of a keyblock and a single data block.

The problem is that the driving table is not the table that needs to be updated.

user wants the following layout:
student                                    Advisor
ID#     name   degree  major Concentration  ID#    name 
The driving table (TABLE A) will supply the first 5 fields. The advisor ID comes from (TABLE B).

The user needs to update the advisor ID# field associated with the student ID# field. The form is to be tabular listing all students.

I've seen some info on using procedures to insert, delete, update, query and lock tables, but i'm just not sure if that's what is needed.

Any help is appreciated.
Thanks

[EDITED by LF: applied [pre] tags to preserve formatting]

[Updated on: Fri, 08 July 2011 01:16] by Moderator

Report message to a moderator

Re: update table data via oracle forms 10g [message #515081 is a reply to message #515010] Fri, 08 July 2011 01:26 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How do these tables look like? How are they related? A student can have only one advisor, I suppose? If so, these tables *should* look like this:
CREATE TABLE advisor
(
   a_id   NUMBER PRIMARY KEY,
   name   VARCHAR2 (20)
);

CREATE TABLE student
(
   s_id            NUMBER PRIMARY KEY,
   name            VARCHAR2 (20),
   degree          VARCHAR2 (20),
   major           VARCHAR2 (20),
   concentration   VARCHAR2 (20),
   a_id            NUMBER CONSTRAINT fk_st_ad REFERENCES advisor (a_id)
);

Which means: the STUDENT table already contains the advisor ID (A_ID column) so - you have to fetch advisor's name into the block (that would be a display item, populated in WHEN-VALIDATE-ITEM trigger on the A_ID column (during insert/update) and POST-QUERY block trigger (during select)).

On the other hand, if I was wrong, please, answer questions posted at the beginning of this message.
Re: update table data via oracle forms 10g [message #515181 is a reply to message #515010] Fri, 08 July 2011 07:31 Go to previous messageGo to next message
msdtjw
Messages: 25
Registered: March 2011
Junior Member
Thanks for the reply littlefoot. But my question has to do with is how to use forms to update, insert, delete data on a table via oracle forms where the table being updated is not the block table?

Essentially I have a driver table (student table) which under normal circumstances would be the block table. The problem is that the student table is not going to be updated, only the advisor table.

For example: I need to select all students that are "ECO" (economics) students. have them displayed in a single block with their associated advisors. Now some of these students will not have an advisor. The form is to allow users(staff) to assign an advisor to a student. Since the advisor table is not the driving/block table i don't know how to update the table. The way i understand oracle forms to work is that any action on a table has to be defined as a datablock. in this case the table that would drive the selection of students is not the table that needs to be updated.

I hope this clarifies my predicament
Re: update table data via oracle forms 10g [message #515190 is a reply to message #515181] Fri, 08 July 2011 08:16 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Not really. What is the relationship between student and advisor?
Re: update table data via oracle forms 10g [message #515192 is a reply to message #515190] Fri, 08 July 2011 08:23 Go to previous messageGo to next message
msdtjw
Messages: 25
Registered: March 2011
Junior Member
Both tables contain the student ID and the school term. that's how in sql i would link them to gather the info.
Re: update table data via oracle forms 10g [message #515220 is a reply to message #515192] Fri, 08 July 2011 13:10 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Possible solutions depend on exact data model - so give us details. Table structures and exact linkage.
Re: update table data via oracle forms 10g [message #515221 is a reply to message #515220] Fri, 08 July 2011 13:14 Go to previous message
msdtjw
Messages: 25
Registered: March 2011
Junior Member
Thanks for trying. I am going to try a possible solution i found.
Previous Topic: master child relation for non control blocks
Next Topic: query mode
Goto Forum:
  


Current Time: Mon Sep 16 21:17:22 CDT 2024