Home » Developer & Programmer » Forms » Query in forms
Query in forms [message #185943] Fri, 04 August 2006 07:35 Go to next message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
Hi,
I have a simple table with 2 columns ...One is sno,sname.
I am basing my form on this table. Then in the form I am taking a button and in the when-button-pressed of the button, if I write commit or commit_form I am able to save the values. Now I have to write an INSERT statement instead. So my code is as follows.
insert into s_test values(:sno,:sname);
commit;

Now when I run my form ,enter values and press the button,
I observed that it is saving the values twice. If I use commit or commit_form instead of INSERT, I am able to insert the value only once. Actually I am working on one complex form...When I faced this problem...so i took a simple form ...but here also it is the same problem. What should I do now? I have to use INSERT statement only since my complex form is getting values from another table too.

Re: Query in forms [message #185996 is a reply to message #185943] Fri, 04 August 2006 13:08 Go to previous messageGo to next message
RJ.Zijlstra
Messages: 104
Registered: December 2005
Location: Netherlands - IJmuiden
Senior Member
Hi,

What's happening here is the following:
When you commit, you commit TWO things:
1) The values you entered in the form fields
2) Your insert statement.

The easiest solution seems to me, that you make those two fields on the form non database fields, so on your commit, you insert only one row.

HTH,

Regards
Rob Zijlstra
Re: Query in forms [message #186018 is a reply to message #185943] Fri, 04 August 2006 14:30 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
orafan2003 wrote on Fri, 04 August 2006 08:35

Hi,
I have a simple table with 2 columns ...One is sno,sname.
I am basing my form on this table. Then in the form I am taking a button and in the when-button-pressed of the button, if I write commit or commit_form I am able to save the values. Now I have to write an INSERT statement instead. So my code is as follows.
insert into s_test values(:sno,:sname);
commit;



I am wondering why you couldn't logically figure this out. You state that when you hit a button with code behind it that does a commit, the row is there. Then you state that if you use an insert statement, it is there twice.

If it already saves your row with a commit, why rewrite the built-in to do an insert? Why do you think you need to write an insert statement? Please explain.

[Updated on: Fri, 04 August 2006 14:32]

Report message to a moderator

Re: Query in forms [message #186120 is a reply to message #185943] Sun, 06 August 2006 03:42 Go to previous messageGo to next message
emadbsb
Messages: 334
Registered: May 2005
Location: egypt
Senior Member

check in the "property palette" for the both items
that they are a database items

database item :yes
column name :sno


if they are a database item you don't need to insert into that table it will automatically save your change after the commit command

[Updated on: Sun, 06 August 2006 03:43]

Report message to a moderator

Re: Query in forms [message #186276 is a reply to message #185996] Mon, 07 August 2006 04:58 Go to previous message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
Hi,
It inserted only once when I made the items non-database. Thank you for explaining me the background process.
Thanks !!
Previous Topic: searching a string in a xml file from Oracle Form
Next Topic: Regarding form
Goto Forum:
  


Current Time: Fri Dec 02 18:46:10 CST 2016

Total time taken to generate the page: 0.46560 seconds