One block based on two table when update/insert result in FRM-40654
Hi,
I ahve a multi line block based on two tables.
Customers - AFCUSTOMER
Maintenance - AFMAINT
Some customers exist when maintenance doesnt so in my where clause i have
AFCUSTOMER.CUSTID=AFMAINT.MAINT_CUSTID(+) AND AFCUSTOMER.CUSTBRANCHID=1 AND AFCUSTOMER.CUSTSTATUSID=2
I have primary key set as the AFMAINT table primary key and have set DML data targetr name as AFMAINT.
I am displaying customer name (from AFCUSTOMER) and type of payment (from AFMAINT) on screen and i want to change the type of payment which then uses pre update trigger to fil in the primary key of AFMAINT.
Querying works fine and displays all records. But when i try to insert a record into the AFMAINT table by changing the type of payment list item i get FRM-40654 Record updated by another user. I have checked and block status is QUERY right before the list item is changed.
Any ideas on where i am going wrong.
But when i try to insert a record into the AFMAINT table by changing the type of payment list item i get FRM-40654 Record updated by another userWhen you start editing a record which is already stores in the database forms "rereads" the record from the database and check id all values in the database are the same as in the form. If there is some difference, forms assumes that someone else changed the record after you did the query.
The main causes for that are:
-Some database-trigger which changes the value of a column which is included in the form
-numeric column with a higher precision in forms, than in the database
-a block based on a view or "select from clause" which does not return the same values as inserted/updated through forms.
I guess you run into the third issue. Check all the values in the forms-items after your dml and compare them to the values saved to the database, there will be some difference. If you find it, correct the error, if one, or re-read the data in the POST-UPDATE-trigger.
Similar Messages
-
I've created a block based on two tables.
Querying records works fine.
However, when I try to amend a column in the master table I get an error message 'Record has already been updated by another user.'
I have set the dml target property to to the master table and set the primary key on the correct columns.
What else could there be??!!Block1 will be----- enter_query Sku :123 then from dropdown select Level 1 which will show data like this
in two different rows.
Sku : 123 Price : $100 Qty : 10 (Primary)
Sub Sku : 345 Price : $110 Qty : 8 (Level 1)then from dropdown selected Level 2 which will show data like this in two different rows.
Sku : 123 Price : $100 Qty : 10 (Primary)
Sub Sku : 456 Price : $90 Qty : 12 (Level 2)There are two more blocks which will display more information based on either Level 1 is selected or Level2 selected.
Regards
Sandy -
Detail tabular form based on two tables
db11gxe , apex 4.0 , firefox 24 ,
hi all ,
i have a master detail form based on two tables , the detail form ofcourse based on one table , the problem is i want to include a column of another
table into the tabular form , so i have changed the query of the tabular form and included the column in it correctly ,
but the problem is about saving data , i can not save the data , i think
because the "mru" process is based on one table , that is because i face an error talking about "mru" process when i try to save the data ,
Error in mru internal routine: ORA-20001: no data found in tabular form Unable to process update.
so
what should i do to save the data ? should i create another "mru" process based on the other table or what ?
thanksAnything beyond "simple" requires that you do it yourself. I believe that what you want is "beyond simple"
As far as I know, you can only use the 'mru' on one table.
(I could be wrong)
If the conditions are right, you might be able to simplify things such that you can use the 'mru'.
ie CREATE VIEW on the two tables.
However, you need to understand how Oracle treats DML operations on views, what type of views can be updated, etc., etc.
If just creating the view doesn't work, creating an INSTEAD OF trigger on the view come to mind...
(lol) - at that point, you have already started down the 'dark path' of creating your own 'MRU'
personal note: triggers have a really baaaddd habit of hiding code from other developers. you are better off, in the long run, creating your own 'mru'..
ie a package with procedures to handle INSERT, UPDATE, and DELETES
MK -
Does adding a field to a table affect a data block based on the table?
If I make a change to a table like adding a field does it affect data data blocks based on the table?
The other place I have seen where adding a new column to a table causes problems is when a programmer codes: Select * from table.
If that is coded in a form, the form will need to be recompiled before it will work properly. -
ERROR (ORA-01002) when Ioading a table by UPDATE/INSERT
I get the error message ORA-01002 ( Fetch out of sequence ) when I am loading a table by UPDATE/INSERT.
At de Runtime Audit Viewer the process of loading update a number of register, in that case 44.050 and to the left register I get the error message that I show above.Can you please give us some details about your source and targets. I have used UPDATE/INSERT but I did not get this kind of error.
rgds
-AP -
How to lock a table when i insert a row
hi, friends,
how to lock a table when i insert a row, then unlock the tableIf you want to lock the whole table so that no-one else can do DML then you go LOCK TABLE <table> IN EXCLUSIVE MODE. This lock remains in force until you commit or rollback.
There are less powerful locking modes available, but you can look those up in the OTN online documentation.
APC -
Hi guys,
I have created a copy of the AdventureWorks2012 DB called AdventureWorks2012_new on the same instance.
I have created the following trigger below but my friend who is a DBA told me that this is not correct and I should be using the inserted table when creating this trigger. I would like AdventureWorks2012_new DB to be updating/inserting/deleting data from
the same tables that have been updated/inserted/deleted in the AdventureWorks2012 DB. How exactly should I do this for all the tables in the whole database ? What I have written below is just for one of the tables, is there a quicker way to do it for all tables
in this DB so that it performs the actions mentioned above, automatically ? Help would be greatly appreciated so I can understand how this works, thanks
CREATE TRIGGER [HumanResources].[tr_HumanResources_AfterUpdate]
ON [AdventureWorks2012].[HumanResources].[Department]
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE AdventureWorks2012_new.HumanResources.Department
SET Name = t2.Name,
GroupName = t2.GroupName,
ModifiedDate = t2.ModifiedDate
FROM AdventureWorks2012.HumanResources.Department AS t2
INNER JOIN AdventureWorks2012_new.HumanResources.Department AS t1
ON t2.DepartmentID = t1.DepartmentID
ENDFor insert it's easy:
CREATE TRIGGER [HumanResources].[tr_HumanResources_AfterInsert]
ON [AdventureWorks2012].[HumanResources].[Department]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
Insert INTO AdventureWorks2012_new.HumanResources.Department
(DepartmentID, Name, GroupName, ModifiedDate)
SELECT DepartmentID, Name, GroupName, ModifiedDate
FROM Inserted;
END
I didn't verify column names, so you may need to make sure to use correct column names for that table.
Setting replication is a bit advanced topic although BOL is clear and you may start here
http://technet.microsoft.com/en-us/library/ms151198.aspx
If it will be complicated for you, you can ask extra questions in the MSDN Replication forum.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
I have one itunes account with two phones assigned to it, sons and daughters, (5s). When i phone one of the numbers both phones have started to ring, only when connected to wifi at home. The problem does not occur when not connected to wifi. How do i resolve this please? texting is fine it is only when ringing one of the numbers.
<http://support.apple.com/kb/HT6337>
"To turn off iPhone Cellular Calls on a device, go to Settings > FaceTime and turn off iPhone Cellular Calls." -
Can I create a view based on two tables that have the same column name?
I have two tables A and B. Each table has 50+ columns.
I want to create a view that includes all the columns in A and all the columns in B. I created a view with a select statement that says
Select A.*, B.*
From A, B
where A.id = B.id
It returns an error because in each table I have a column that keeps track if a record has been changed called Modified_By. That's where it chokes up on I figure. I would like to write the view without explicitly writing each column name from A and B as part of the select statement. The actual select statement works fine and only bombs when trying to turn the select statement into a view.You will have to type the full column list at least once. You can save a few keystrokes (i.e. alias. on every column) by providing the column names to the CREATE part instead of in the SELECT part. Something like:
SQL> desc t
Name Null? Type
ID NUMBER
NAME VARCHAR2(10)
SQL> desc t1
Name Null? Type
T_ID NUMBER
LOC_ID NUMBER
NAME VARCHAR2(15)
SQL> CREATE VIEW t_v (id, t_name, t_id, loc_id, t1_name) AS
2 SELECT t.*, t1.*
3 FROM t, t1
4 WHERE t.id = t1.t_id;
View created.HTH
John -
Insert a new row in log table when update on view object
hi All,
i have created approval System where i maintain log which is based on table(ApprovalLog) which contain attribute like (Agencycode,approve_status,approved_by,approved_date).
and i have also create a view object which is based on (AgencyApproval) table. which is also contain field approval_status by default 'N'
i create a jsf page using this view object and drag drop as adf table now i want when user change approve_status field and click on commit button then
a new row created on to ApprovalLog table and values of column like (agencycode,approve_status,approved_by) comes from AgencyApproval table.
How can i do this in ADF.
Please Reply.
manishhi Timo,
i have done this as following and it is working.
please tell me it is right approach or not.
protected void prepareForDML(int i, TransactionEvent aTransactionEvent)
if (i != EntityImpl.DML_DELETE)
ViewObjectImpl vo = (ViewObjectImpl)this.getDBTransaction().findViewObject("AdAgcrlimitAppLogView3"); // change it to the name of your VO
Row row = vo.createRow();
// set the values ...
row.setAttribute("AppDt",getAppDt() );
row.setAttribute("Publ",getPubl() );
row.setAttribute("GrpAgcode",getGrpAgcode() );
row.setAttribute("GrpAgsubcode",getGrpAgsubcode() );
row.setAttribute("StaticCrlimit",getStaticCrlimit() );
row.setAttribute("FixCrlimit",getFixCrlimit() );
row.setAttribute("VarcrLimit",getVarcrLimit() );
row.setAttribute("AdhocLimit",getAdhocLimit() );
row.setAttribute("AdhocFr",getAdhocFr() );
row.setAttribute("AdhocTo",getAdhocTo() );
row.setAttribute("CrAlertLimit",getCrAlertLimit() );
row.setAttribute("BillAmt",getBillAmt() );
row.setAttribute("AdjAmt",getAdjAmt() );
row.setAttribute("DbnAmt",getDbnAmt() );
row.setAttribute("PayAmt",getPayAmt() );
row.setAttribute("UnbillAmt",getUnbillAmt() );
row.setAttribute("Status",getStatus() );
row.setAttribute("AlertTag",getAlertTag() );
row.setAttribute("CrlimitTag",getCrlimitTag() );
row.setAttribute("Confirm",getConfirm() );
row.setAttribute("ApproveRemark",getApproveRemark() );
row.setAttribute("ApproveBy",getApproveBy() );
row.setAttribute("ApproveDt",getApproveDt() );
row.setAttribute("ApproveStatus",getApproveStatus() );
row.setAttribute("ApproveHier",getApproveHier() );
row.setAttribute("Usrname",getUsrname() );
row.setAttribute("Usrid",getUsrid() );
row.setAttribute("Usrdate",getUsrdate() );
row.setAttribute("Cuser",getCuser() );
vo.insertRow(row);
super.prepareForDML(i, aTransactionEvent);
} -
How to relate two tables when there is null in join criteria
Hi,
I have two tables dept and emp, they both are joined on basis of deptno. few records in emp table have no deptno. i want to join these tables, i want to count those records as well where deptno is null in emp table. Please can anybody help me to get this query.
Regards,Please refer...
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm#i2054062
and search 'Using Outer Joins: Examples'
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2066378 -
Insert into two tables, how to insert multiple slave records
Hi, I have a problem with insert into two tables wizard.
The wizard works fine and I can add my records, but I need to enter multiple slave table records.
My database:
table: paper
`id_paper` INTEGER(11) NOT NULL AUTO_INCREMENT,
`make` VARCHAR(20) COLLATE utf8_general_ci NOT NULL DEFAULT '',
`model` VARCHAR(20) COLLATE utf8_general_ci NOT NULL DEFAULT '',
`gsm` INTEGER(11) NOT NULL,
PRIMARY KEY (`id_paper`)
table: paper_data
`id_paper_data` INTEGER(11) NOT NULL AUTO_INCREMENT,
`id_paper` INTEGER(11) NOT NULL,
`value` DOUBLE(15,3) NOT NULL,
`nanometer` INTEGER(11) NOT NULL,
PRIMARY KEY (`id_paper_data`)
I need to add multiple fields "value" and "nanometer"
Current form looks like this:
Make:
Model:
Gsm:
Value:
nanometer:
I need it to look like this:
Make:
Model:
Gsm:
Value:
nanometer:
Value:
nanometer:
Value:
nanometer:
Value:
nanometer:
and so on.
The field "id_paper" in table paper_data needs to get same id for entire transaction. Also how do I set default values for each field "nanometer" on my form the must be different (370,380,390 etc)?
Thanks.you can find an answer here: http://209.85.129.132/search?q=cache:PzQj57dsWmQJ:www.experts-exchange.com/Web_Development /Software/Macromedia_Dreamweaver/Q_23713792.html+Insert+Into+Two+Tables+Wizard&cd=3&hl=lt& ct=clnk&gl=lt
This is a copy of the post:
Hi experts,
Im using ADDT to design a page that needs to insert one record into a master ALBUMS table, along with three records into a GENRES table, all linked by the primary, auto-incremented ALBUMS. ALBUM_ID.
Ive tried many different ways of combining the Insert into Multiple Tables wizard and the insert record wizard with Link Transactions, all with no luck. Either only the album info gets inserted, or a ALBUM_ID cannot be null error from MySQL. Here is the structure of the tables
ALBUMS
ALBUM_ID, INT(11), Primary, Auto_Increment
alb_name, varchar
alb_release, YEAR
USER_ID, int
alb_image, varchar
GENRES
ALBUM_ID, int, NOT NULL
GENRE_ID, int, NOT NULL
ID, int, primary, auto-increment
Many thanks in advance...
==========================================================================================
//remove this line if you want to edit the code by hand
function Trigger_LinkTransactions(&$tNG) {
global $ins_genres;
$linkObj = new tNG_LinkedTrans($tNG, $ins_genres);
$linkObj->setLink("ALBUM_ID");
return $linkObj->Execute();
function Trigger_LinkTransactions2(&$tNG) {
global $ins_genres2;
$linkObj = new tNG_LinkedTrans($tNG, $ins_genres2);
$linkObj->setLink("ALBUM_ID");
return $linkObj->Execute();
function Trigger_LinkTransactions3(&$tNG) {
global $ins_genres3;
$linkObj = new tNG_LinkedTrans($tNG, $ins_genres3);
$linkObj->setLink("ALBUM_ID");
return $linkObj->Execute();
//end Trigger_LinkTransactions trigger
//-----------------------Different Section---------------------//
// Make an insert transaction instance
//Add Record Genre 1
$ins_genres = new tNG_insert($conn_MySQL);
$tNGs->addTransaction($ins_genres);
$ins_genres->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "VALUE", null);
$ins_genres->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $detailValidation);
$ins_genres->setTable("genres");
$ins_genres->addColumn("GENRE_ID", "NUMERIC_TYPE", "POST", "GENRE_ID");
$ins_genres->addColumn("ALBUM_ID", "NUMERIC_TYPE", "VALUE", "");
$ins_genres->setPrimaryKey("ID", "NUMERIC_TYPE");
// Add Record Genre 2
$ins_genres2 = new tNG_insert($conn_MySQL);
$tNGs->addTransaction($ins_genres2);
$ins_genres2->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "VALUE", null);
$ins_genres2->setTable("genres");
$ins_genres2->addColumn("GENRE_ID", "NUMERIC_TYPE", "POST", "GENRE_ID2");
$ins_genres2->addColumn("ALBUM_ID", "NUMERIC_TYPE", "VALUE", "");
$ins_genres2->setPrimaryKey("ID", "NUMERIC_TYPE");
// Add Record Genre 3
$ins_genres3 = new tNG_insert($conn_MySQL);
$tNGs->addTransaction($ins_genres3);
$ins_genres3->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "VALUE", null);
$ins_genres3->setTable("genres");
$ins_genres3->addColumn("GENRE_ID", "NUMERIC_TYPE", "POST", "GENRE_ID3");
$ins_genres3->addColumn("ALBUM_ID", "NUMERIC_TYPE", "VALUE", "");
$ins_genres3->setPrimaryKey("ID", "NUMERIC_TYPE");
=========================================================================================
Hi Aaron,
Nice job!!
$ins_albums->registerTrigger("AFTER", "Trigger_LinkTransactions2", 98);
$ins_albums->registerTrigger("AFTER", "Trigger_LinkTransactions3", 98);
These lines, right? :-( Sorry I forgot to mention that
Thanks a lot for the grading! -
How can i merge data between two tables and then insert to another table
Hi ,
Could pls help me,
I have two tables i need to merge this tables for a single column then need to insert the records to a third table
Ex-
Suppose emp, dept two tables , merge this two tables for empid then insert that value to emp_dept table.
I am using oracle 10g.
ThanksHi,
too many values comes from the select clause. I stated you have to match the columns from the emp_dept table to the columns in the select. In my example I return all the columns of emp and dept, but I think you have only one empid column, the select for example will give 2, one empid from emp and one empid from dept. So best is to match:
insert into emp_dept
(column1,column2,column3,empid)
select emp.column1, emp.column2, dept.column3, emp.empid
from emp, dept
where emp.empid = dept.empidAbove is an example how you can match, so the number of columns in the insert should match with the number of columns coming from the select.
But better for us to help you is give your definitions of emp, dept and emp_dept.
Herald ten Dam
htendam.wordpress.com -
Hi all,
Here is what I am trying to do. I have 2 tables A and B. Both have a fiscal year and a school ID column. I want to return all data from table B where all school IDs match but fiscal year from A is not in B. I wrote 2 queries below but this took
2 minutes each to process through 30,000 records in table B. Need to optmize this query.
1) select 1 from table A inner join table B
on A.SchoolID=B.SchoolID where A.Year not in (select distinct Year from table B)
2) select distinct Year from Table A where School ID in (select distinct School ID from table B
and Year not in (select distinct Year from table B)Faraz81,
query execution time will depend not only on your data volume and structure but also on your system resources.
You should post your execution plans and DDL to generate data structures so we can take a better look, but one think you could try right away is to store the results of the subquery in a table variable and use it instead.
You'll also benefit from the creation of:
1. An index for the B.SchoolID column.
2. Statistics for the Year column in table B.
You can also try to change the physical algorithm used to join A to B by using query hints (HASH, MERGE, LOOP) and see how they perform. For example:
select 1 from table A inner HASH join table B
on A.SchoolID=B.SchoolID where A.Year not in (select distinct Year from table B)
As the query optimizer generally chooses the best plan, this might not be a good idea though, but then again, without further information its going to be hard to help you. -
Defining a Recordset Set based on two tables
I am having difficulty displaying records for a "membership"
page. I have set up a simple database in PHPMyAdmin with two main
tables: instructors and membership. Instructors are given a
temporary username and password to enter a restricted area. If they
decide to become a member, they go to a page with a
Pre-registration
form and fill that in. If their credentials check out, they are
sent a registration form.
The pre-registration form populates the instructors table.
I set up three pages in the Admin area: Contact_info,
Addresses, and Membership.
The Contact_info has the instructors' email and phone
numbers. This is based on some of the fields in the instructors
table. This page works fine.
The Addresses page also is populated fields from the
Instructors table and also works well.
The membership page is not working. I want this page to
display fields from the Instructors and the Membership tables.
Here's the SQL statement that I am using in the Recordset
dialog box in DW:
SELECT instructors.instructor_id, instructors.first_name,
instructors.last_name, membership.instructor_id,
membership.username, membership.pwd, membership.type
FROM instructors INNER JOIN membership ON
instructors.instructor_id = membership.instructor_id
ORDER BY instructors.last_name
It seems to me to be correct but its not displaying any
records. I don't know if the sql statement is bad or I have my
instructor_id field in my Membership table set up incorrectly in
PHPMyAdmin. I don't know how to indicate that its a foreign field
or how to relate it to the other table, other than indication the
relationship with sql. By the way, did I mention that I am new to
php and sql?
I appreciate any help.Just and idea.
Try to create one dimension like this:
Id
type
Category
1
juice
drink
2
milk
drink
3
alcohol
drink
4
beer
liquor
5
wine
liquor
Hope this helps.
Reeves
Denver, CO
Maybe you are looking for
-
In Firefox, I select Tools > Add-ons > Find Updates. The Plugin Check page comes up in the browser. The entry for the WMP Plugin indicates it is out of date. I click on the "Update" button and nothing happens. When I mouse over the button, no link is
-
I try to insert image into a helpaction, into my hs file. The image is showed, but there is space around it (about few pixel). How can I show the image without any spaces around ? Thanks for your help.
-
Hi All, Im selecting values into an internal table say ' 0001...0010 ' and i have concatenated prefix with 'PA' to them (which will be PA0001 ... PA0010 ) and appened in the internal table. Now based on this values in the internal table
-
Why do I get the error message "iTunes Match could not be updated because you were disconnected from the network during processing." I'm on the internet during all of this. What disconnect is the message referring to? Itunes is frozen now. I keep
-
311 lock button dose not work as given in the manu...
hi, maybe I missed someting, but according to the user manual the lock button should lock the buttons and unlocking should need another press on the lock button and then (or at the same time) a move of the start screen. But my 311 (7.36) comes up aga