updation is not happening when do insrt and update in same procedure in oracle forms [message #608846] |
Tue, 25 February 2014 07:35 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/50c45c40c9283093f437b0ff815a9523?s=64&d=mm&r=g) |
rvsri
Messages: 26 Registered: February 2014 Location: Chennai India
|
Junior Member |
|
|
***Hi,Good day..am a new entry level SE in oracle forms..i will gladly appreciate if someone help me..***
i have a insrt and update statement on the same procedure..the form looks like this ,the canvas has a text field for the :Column1 upon
click on the link on this canvas shows another stacked canvas that have a list with some values to be selected for :Column2.
By default if we wont give any values for :Column2 it saves the not null value
my problem is even i select :colum2 value from List also it saves the not null value only to the database and not the value which am selecting from the list.
PROCEDURE PROCESS_ON_INSERT_UPDATE IS
BEGIN
Insert into table_name(column1,column2)
values(:column1,' ');
//updaing the not null value(column2) (in the next screen-stagged canvas-upon clicking the link from the first canvas)
IF :column2 IS NOT NULL THEN
UPDATE table_name
SET column2= :COlumn2
where
colum1=:column1 ;
END if;
End;
[Updated on: Tue, 25 February 2014 07:41] Report message to a moderator
|
|
|
|
|
|
|
Re: updation is not happening when do insrt and update in same procedure in oracle forms [message #608851 is a reply to message #608850] |
Tue, 25 February 2014 08:49 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
If that code is not giving the results you expect then there are two options:
1) :column2 isn't set to the value you think it is.
2) Some other code is also updating column2 and setting it to a different value.
But it seems to me you're making this more complicated than it needs to be.
Why isn't the code simply this:
Insert into table_name(column1,column2)
values(:column1,nvl(:COlumn2, ' ');
Or even scrap the on-insert trigger and just put this in pre-insert:
:column2 := nvl(:COlumn2, ' ');
You should never need to update a row immediately after inserting it.
You should never need to use on-insert, unless you're working against a non-oracle database.
In addition - why are you using a stacked canvas? What's wrong with an LOV?
|
|
|
|
|