Emp-Dept Form doubt [message #452775] |
Sat, 24 April 2010 02:35 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Akshita
Messages: 22 Registered: February 2010
|
Junior Member |
|
|
Hi All,
I have a requirement based on the EMPLOYEE and DEPARTMENT tables.
The requirement is as follows:
1. The header block is DEPT with fields DEPTNO and DNAME.
2. The Item DEPTNO must be provided with an LOV.
3. The detail block is EMP with fields EMPNO and ENAME.
4. Detail block must be provided with a scroll bar.
5. When a record is selected from the LOV of DEPTNO, the employees corresponding to that department must be displayed.
5. New records must be allowed to be created in both the blocks.
Now my problem is:
I've created the blocks, provided DEPTNO with LOV and also provided scrollbar for EMP block.
To display the employees in a particular department, I've created a WHEN-NEW-BLOCK-INSTANCE Trigger in EMP block with the following code:
BEGIN
EXECUTE_QUERY;
END;
This is allowing me to display the employees of a particular department when selected from the LOV.
This also allows me to create new record in DEPT block and corresponding employees to that new department. But when I try to create records in EMP block corresponding to a department which already has few employees, its sending an error message, "FRM-40508: ORACLE error: Unable to INSERT record".
To be clear, Say we have departments from 10 to 50. Now I created a new department 60 and new employees A, B and C and saved this, these r getting saved. But when I execute the block again and I select department 60 in DEPT block (which already has employees A, B and C) and try to create employee D in EMP block, I am facing this error message.
I dont know why this is actually happening. Can anyone please explain this to me and help me solve the issue?
I am uploading the file for reference.
|
|
|
|
|
Re: Emp-Dept Form doubt [message #452783 is a reply to message #452782] |
Sat, 24 April 2010 06:37 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Akshita
Messages: 22 Registered: February 2010
|
Junior Member |
|
|
But this is too not solving my requirement completely.
I am not able to navigate to other department even if I press "Clear All" and select a record from LOV.
If i use Execute(F8), I am able to navigate to department required, but am not able to insert a new employee.
|
|
|
Re: Emp-Dept Form doubt [message #452802 is a reply to message #452783] |
Sat, 24 April 2010 13:52 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Reading what you have to do, it seems that you, actually, don't have to do anything.
Not literally, but close enough. If you use data block wizard and create master block first and then detail block, everything that is needed for a form to work will already be here. You'll be able to query records, modify them and create new ones. No additional code should be written.
The only feature you have to do by yourself is to create a LoV. It is there so that users shouldn't have to remember all possible values. It also means that querying mechanism still works as if there's no LoV there. So, you'll still press <Enter query>, press LoV and select a value, press <Execute query> - both master and details records will be fetched.
You'll then be able to scroll through detail records, modify them and add new ones. Guess what? It will work as expected!
I don't have Forms installation here so I can't view what you've already done, but - once again - use wizard and create a LoV. That should be all.
|
|
|
|
|