Home » Developer & Programmer » Forms » How to save multiple records at once?
How to save multiple records at once? [message #586093] Mon, 03 June 2013 07:00 Go to next message
oraclehi
Messages: 41
Registered: July 2012
Location: India
Member
how to save multiple records at once i did coding like this:

declare
cnt number;
l_rec number;
f_rec number;

begin
cnt := 0;
go_block('aan');
last_record;
l_rec := :system.cursor_record;
first_record;
f_rec := :system.cursor_record;
go_block('aan');
for v in f_rec..l_rec loop
update aan set pan=:aan.pan where aan=:aan.aan;
cnt := cnt+1;


next_record;
end loop;
first_record;
commit_form;
end;
exit_form;

but this works as saving the last record only, not saving the all records.
how to do this??
Re: how to set a format of characters [message #586096 is a reply to message #586093] Mon, 03 June 2013 07:05 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why have you written any of that code? Why not just let forms default functionality do the update for you?
Re: how to set a format of characters [message #586097 is a reply to message #586093] Mon, 03 June 2013 07:08 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Code you wrote implies that this block is a control block. Is it?

The simplest way is to base a block on a table. Everything you put in it is automatically saved when you push the "save" form button (i.e. you don't have to write a single line of code).
Re: how to set a format of characters [message #586100 is a reply to message #586097] Mon, 03 June 2013 07:17 Go to previous messageGo to next message
oraclehi
Messages: 41
Registered: July 2012
Location: India
Member
it is a control block, not a database block, so how can i save it w/o any coding.
i need to do it through loop then how can i do this???
Re: how to set a format of characters [message #586101 is a reply to message #586100] Mon, 03 June 2013 07:22 Go to previous message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As you were told (twice): making it a data block saves a LOT of your problems. Recreate the form (or, at least, a block), if possible.
Previous Topic: how to set a format of characters
Next Topic: form top field
Goto Forum:
  


Current Time: Fri Apr 26 09:12:51 CDT 2024