Erorr while updating or deleting a record... [message #422794] |
Sat, 19 September 2009 06:04 |
sprity
Messages: 18 Registered: July 2009
|
Junior Member |
|
|
Hi to all...
i have created a table group_master with 2 fields Group_id and Group_name
the user will specify a group_name in a text box and press save. Before commiting a seq number will be generated
inside the form procedure and it will be inserted.
The insert is working fine.
But when i select a record i.e a group_name and modify and commit it, it is not commiting.
when i checked the display error it showed Ora-01400 cannot insert null values into the table.
Iam not inserting a value here iam updating the group name only.
even when i delete a record it shows same error....
can any one help to solve this....
thanx in advance........
|
|
|
|
|
Re: Erorr while updating or deleting a record... [message #422894 is a reply to message #422866] |
Mon, 21 September 2009 02:14 |
|
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Well, this "MAX + 1" principle might work in a single-user environment. In any other case, it will (sooner or later) lead into the DUP-VAL-ON-INDEX error. Use a real sequence instead (an Oracle object, created with the CREATE SEQUENCE command). You can then use it in "Initial value" item property (for more information, read Forms Help).
As of "selecting" records, you do use Forms' built-in querying system (Enter query - enter search criteria (LoV is OK) - Execute query), don't you? If not, well, you should.
Besides, where do you use this GEN_SEQ_NO procedure?
|
|
|
Re: Erorr while updating or deleting a record... [message #422913 is a reply to message #422794] |
Mon, 21 September 2009 02:57 |
sprity
Messages: 18 Registered: July 2009
|
Junior Member |
|
|
Hi...
thanx for the response...
before Commiting the form iam calling GEN_SEQ_NO procedure.
this is for admin use only.. so i used MAX+1 concept...
if i use execute query then it prompts a message box saying Do u want to save the changes u made with yes,no,cancel buttons.
thats why i avoided execute query...
one of the oracle programmer said there is no need to use execute query whiling retriving records thru LOV....
|
|
|
Re: Erorr while updating or deleting a record... [message #422924 is a reply to message #422913] |
Mon, 21 September 2009 04:16 |
|
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Quote:one of the oracle programmer said there is no need to use execute query whiling retriving records thru LOV This might be right, but also might be wrong - depends on what you plan to do with that record. In your case, I believe that this approach is wrong because you want to update an existing record. In that case, you first have to fetch it from the database (using execute query). If you fetch it via LoV, this record is treated as a new record.
I might be wrong, but I have a feeling that you should rewrite this form (using a wizard might be a good option) and use built-in Forms' functionalities up to their maximum. In other words, do not code anything by yourself. Once you make such a "basic" form work (which should be immediately - inserting, querying, updating and deleting will work just fine), try to improve it (by adding a sequence generator, for example).
|
|
|
Re: Erorr while updating or deleting a record... [message #422942 is a reply to message #422794] |
Mon, 21 September 2009 05:51 |
sprity
Messages: 18 Registered: July 2009
|
Junior Member |
|
|
hi...
thanx again....
i have recreated the form...
i used the default menu bar to enter,execute,update,remove the datas... its working fine...
then i tried with my own queries.
i have used sequence this time.
Insert and update or working fine. But deletion is not working.
i have used delete_record to delete the particular selected record and commit the form.
the same concept worked for me earlier.
But now its not working . The record which i select for deletion
is still present in the database .
the same concept is used in another form which works fine........
|
|
|
|
|
Re: Erorr while updating or deleting a record... [message #423181 is a reply to message #422794] |
Tue, 22 September 2009 07:44 |
sprity
Messages: 18 Registered: July 2009
|
Junior Member |
|
|
my client has said not to use default and smart bar...
so all my form will have a horizontal tool bar with add,modify,delete,clear and save option....
whenever i fetach a data/record thru LOv and display it in the form and then if i made any update it says oracle unable to insert record...
One of field is primary key. After throwing a record into the form thru LOV it treats the selected record as a new record...
this is want...
i have three fields.
Sub_module_id primarykey
sub_modulename
File_location.
i have used data block wizard and created a form with sub_modulename and file location. i will generate a sequence number for sub_module_id before commitng the form in my Save button.
My insert/add is working fine...
Now i want t o modify an inserted record. So after pressing my modify button a LOV will be generated,then i will select a record.
That particular record will be displayed in my form. Now i want to update/modify the datas...
then i will commit the changes thru my save button. i have used commit_form in it.
But it display error unable to insert becoz of the primary key.It treats the data as anew record.
i want to avoid it n save my changes...
Any one can help me in this...
or
guide me to use the same concept for me....
thanx in advance....
with cheers
sprity
|
|
|
|