|
|
|
|
Re: Execute Query with Non database Block [message #415006 is a reply to message #415005] |
Fri, 24 July 2009 06:31 |
kame
Messages: 69 Registered: July 2009
|
Member |
|
|
I have 2 block in a form
one is view non database block
2nd is personnel database block
I defined a crusor when_new_form_instance
DECLARE
CURSOR chk
IS
select perscode,persname,commission,conversion,netrate from personnel order by to_number(perscode);
vcode personnel.perscode%type;
vName personnel.persname%type;
vcomm personnel.commission%type;
vconv personnel.conversion%type;
vnrate personnel.netrate%type;
BEGIN
OPEN chk;
LOOP
FETCH chk INTO vcode, vname, vcomm, vconv,vnrate;
EXIT WHEN chk%NOTFOUND;
create_record;
go_block('view');
:view.vpercode := vcode;
:view.vpersname := vname;
:view.vcomm := vcomm;
:view.vcon := vconv;
:view.vnet := vnrate;
--Message('DOC...'||vname);
END LOOP;
-- commit;
CLOSE chk;
END;
when I run the form all the records I can see in the view datablock
I write a code at item view.persname when-button-press
:personnel.perscode := :view.vpercode;
:personnel.persname := :view.vpersname;
:personnel.commission := :view.vcomm;
:personnel.conversion := :view.vcon;
:personnel.netrate := :view.vnet;
when I click on any record value I can see in personnel datablock one by one with help of click.
when I insert new record in personnel datablock it save new record and also that record which click in last.
why it is happening ?
or there is any other way to execute the query
|
|
|
Re: Execute Query with Non database Block [message #415019 is a reply to message #415000] |
Fri, 24 July 2009 07:30 |
cookiemonster
Messages: 13950 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
If you set values in a record that hasn't been queried from the database oracle will assume it's a new record and try and insert it.
Seems to me both blocks should be database blocks and you should use standard forms query functionality to populate them.
You don't need this custom code.
|
|
|
Re: Execute Query with Non database Block [message #415032 is a reply to message #415000] |
Fri, 24 July 2009 07:57 |
TonyJaa
Messages: 50 Registered: May 2009
|
Member |
|
|
Does only one record of view correspond to only one record of personnel ?
If yes, I think you've better do only one block with some based item named personnel_itemX and some non-based item named view_itemX.
In When new form instance, Execute query on the block and in POST-QUERY populate the VIEW_ITEM.
but in the layout separate the view_item from the personnel_item.
|
|
|