Home » Developer & Programmer » Forms » view based datablock (froms)
view based datablock [message #641230] Wed, 12 August 2015 02:32 Go to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
I have view based datablock in my forms

and when i tried to update some filed i get the error:
"FRM-40735: ON-UPDATE trigger raised unhandled exception ORA-00001"

my on-update trigger:
update tab_je
  set id  = :control_blk.id,
      rec_id  = :detail_blk.rec_id,
     rec_text = :detail_blk.rec_text;
update_record;

on-insert trigger:
Insert into tab_je 
 (id, rec_id, rec_text)
 values
  (:control_blk.id, :detail_blk.rec_id, :detail_blk.rec_text);
  insert_record;


can anyone please help? how could i solve this?
thanking you.
Re: view based datablock [message #641232 is a reply to message #641230] Wed, 12 August 2015 02:35 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Remove update_record and insert_record. They tell forms to create an update/insert statement for the current values in the block. When you've got your own update/insert statement they're counter-productive.
Re: view based datablock [message #641234 is a reply to message #641232] Wed, 12 August 2015 02:42 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You said that a block is based on a view. What is TAB_JE? Sounds like a table, not a view ("TAB"). Is the view based on that table? If that's so, you might need to use INSTEAD OF (database) triggers.
Re: view based datablock [message #641235 is a reply to message #641234] Wed, 12 August 2015 02:56 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Thankyou CM and LF.

Yes, it is view based datablock but the tab_je is the base table where i Need to make insert/update some records.

and also when i run my forms and want to write in the text filed then it gives a message box: could not reserve (2 tries). Keep trying?

any Feedback please?
Re: view based datablock [message #641236 is a reply to message #641235] Wed, 12 August 2015 03:10 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:

could not reserve (2 tries)

Someone is holding that record (i.e. it is locked). If it is only you who works with that, maybe you locked yourself. That usually happens when Forms crashes. Ask your DBA to kill the previous session; otherwise, wait for a while, as Oracle should fix it itself.
Re: view based datablock [message #641237 is a reply to message #641236] Wed, 12 August 2015 03:13 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Considering the block is based on a view it may well be the case that forms doesn't actually know how to lock it, in which case you need to write an on-lock trigger.
Re: view based datablock [message #641242 is a reply to message #641237] Wed, 12 August 2015 05:39 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
is it possible to make where clause property of block as:

exists (select 1 from Tab_js where tab_js.id = tab_je.id and tab_js.text in ('TEX'))
UNION ALL
  select tab_js.id, tab_jf.cid, tab_je.mal
    from tab_js, tab_jf, tab_je
    where tab_je.id (+) = tab_js.id
    and   tab_je.rec_id (+) = tab_js.rec_id
    and   tab_jf.id (+) = tab_js.id
    and   tab_jf.fil (+) = tab_js.fil
    and   tab_js.text in ('TEX')


I set where clause of one block as above and got the error.
"frm-40505: ORACLE error: unable to perform query"
and when i press ctrl+shift+E then it display: ORA-00918: column ambigously defined.
Help please..
regards
Re: view based datablock [message #641243 is a reply to message #641242] Wed, 12 August 2015 05:43 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
That would be an invalid WHERE clause, don't you think? UNION part of that code doesn't belong here, it looks more like a candidate for data block's source, not its WHERE clause.
Re: view based datablock [message #641244 is a reply to message #641243] Wed, 12 August 2015 05:45 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
I m sorry LF,
I dont understand what u mean..can you please explain me? :/
Re: view based datablock [message #641245 is a reply to message #641244] Wed, 12 August 2015 05:48 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You put the red coloured text into data block's WHERE clause. It won't work (as Forms already told you).

select ...
from ...
where exists (...)
union all
select ...
Re: view based datablock [message #641246 is a reply to message #641245] Wed, 12 August 2015 05:54 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
ohh sry ..
thank you for your feed back.. LF
but my Problem is, i would like to have all id which are not in tab_je but in two others, thats why i did Union to get These id too.

and I put the whole query start with select...... in FROM Clause Query /Query Data Source Name = my query....

and while compiling this i get the error:
FRM-30409: Delete Record Behavior for the relation is invalid.
FRM-30085: Unable to adjust form for output.

can you please suggest me how can i do this?

thanking you again

[Updated on: Wed, 12 August 2015 05:55]

Report message to a moderator

Re: view based datablock [message #641247 is a reply to message #641246] Wed, 12 August 2015 05:59 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
ok Smile i did solve this error by changing relation property
Delete Record Behavior = Non isolated to Isolated Smile

this error has been solved but still i am unable to get data my Detail block Sad
Re: view based datablock [message #641248 is a reply to message #641246] Wed, 12 August 2015 06:01 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Wouldn't it be simpler to properly create a view (as you can easily test its SELECT statement in any tool you use, such as SQL*Plus or SQL Developer or TOAD or ...) and - once you are satisfied with the result (such as: it displays all records which are not in TAB_JE but in two other tables) simply use that view as a data block source?
Re: view based datablock [message #641250 is a reply to message #641248] Wed, 12 August 2015 06:09 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Yes, ist the same as view but i got a Problem with updating and inserting data that's why i choose this way...
well, now, i am able to Display all respected data, but i can not insert and update the needed field in the block. and when i type some text in the repective field it erase immediately and got error :
Frm-40501- ORACLE error. unable to reserve record for update or delete.

I have on-insert and on-update Trigger in the same block
Re: view based datablock [message #641251 is a reply to message #641250] Wed, 12 August 2015 06:14 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Previously I told you to use INSTEAD OF trigger(s) for updating/inserting records, while Cookiemonster told you to create an ON-LOCK trigger to resolve locking issues.
Re: view based datablock [message #641252 is a reply to message #641251] Wed, 12 August 2015 06:31 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Thank you very much LF.

Well, I can now insert and update without getting any error in my respective Detail block, and it also Shows - 1 record has been saved, but i did not see that currently entered record in the respective table.

and also can not see any error...
Re: view based datablock [message #641253 is a reply to message #641252] Wed, 12 August 2015 06:39 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Have you committed the change?
Re: view based datablock [message #641257 is a reply to message #641253] Wed, 12 August 2015 07:58 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
I don't have key-commit Trigger in my block. but isn't it the same when we click SAVE Icon above in the form?
Re: view based datablock [message #641258 is a reply to message #641257] Wed, 12 August 2015 08:06 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Possibly not if you've got on-insert and on-update.
I suggest you write a select in each of those triggers after the insert/update and use a message to show the current data that's been inserted/updated in the DB. If it shows the correct values but you can't see that data in another session then it's the commit that's missing.

That said - If you're only inserting/updating 1 table then you're probably better off basing the block on table and spending your time working out the correct where clause to apply.
Re: view based datablock [message #641269 is a reply to message #641258] Wed, 12 August 2015 09:39 Go to previous message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hallo CM and LF,

Well, I did use the FROM clause Query and rewritten my on-update Trigger in the detail-block and it works now. Smile
i have added in my on-update Trigger:
declare
 var varchar2(20)
begin
var := get_item_property('block1.field1', database_value); 
 update....
   set....
 where field1 = var
   and ...... ;
if SQL%rowcount then
 insert into ....
 values ....
end if;
end;
Thankyou very much for your continous Feedback/Suggestion/ and help and hoping for further too Smile
regards,

Previous Topic: Global variables
Next Topic: Linking Forms based on criteria
Goto Forum:
  


Current Time: Fri Apr 26 11:49:39 CDT 2024