English 中文(简体)
甲型六氯环己烷和乙型六氯环己烷
原标题:Oracle APEX - Selecting next row to insert into using a process on form submit

Ok. 我的情况是,我有两个公司,即COMANY1公司和COMANY2公司,它们同时努力创建一个部分。 由于他们共同工作,他们都拥有自主权,因此希望双方将一个部分——UNMBER分配给同一部分。 拉美竞争和消费者保护局1 提供COMANY2, 参与单位:NUMBERS, 分配到它们创建的部分。

我有一个表(TABLE_PARTS),其中载有主要的关键(COMPANY1_PART_NUMBER)。 由于COMANY1向COMANY2提供了一组数字,因此该表仅列出了这些数字,等待实际分配。

我有一份投入表,将由COMANY2用于对包括COMANY2_在内的部分信息进行ug。 第一部分:NUMBER。 我需要更新TABLE的行文。 部分用于填写在纸面上的其余栏目,COMANY1_PART_NUMBER,从而将这一编号分配给一个部分。

我已经确定,我需要选举孔迪-孔波(COMPANY1_PART_NUMBER)的MIN(COMPAY1_PART_NUMBER)。

在提交表格之后,我需要确定哪几行将经过一个程序更新,因为表格将同时使用,而且当页数必然造成人们意外地试图将表格插入同样的COMANY1_PART_NUMBER。

任何想法? 我相信这并非困难,但我有问题。 感谢!

问题回答

因此,你们需要的是:

  • one and only one user can have a certain free part id somewhere on the page. It is not allowed to have the user open the form and let them fill out details and then have the process fail after submitting the page due to for example, number already taken by another user.
  • this already rules out the standard mechanisms used in apex. Concurrency and lost update checks only happen in the DML processing point, usually on submit after computations and validations.
  • i was thinking about marking a row which a user selects for updating. However, this would also have to be undone. That is okay as long as a user actually clicks the Cancel button, but you can t catch other events without an extra framework. Even then, you can only catch browser events. If the user would shoot down the browser process or even crash, what will happen with the marked record!? It ll just sit there, waiting for a developer to fix this, or not realizing they never actually ran out of numbers.
  • maybe it d be possible to write an own locking mechanism: create a lock onload of the page. Name this lock after the chosen part id, so it can be checked against. Another onload process on this page should check a lock on the input id. If a lock exists, then fail and do something, like a redirect. A created lock can also be given a timeout, so this would actually provide a backup for crashing browsers and computers. You d then need to remove this lock when the user cancels the operation. Clicking away through breadcrumbs or navigation is still not caught, but you could rely on the lock timeout. Or use a framework extension such as the Skillbuilders save before exit. You could then use a page process to remove the lock on the different exit events (through ajax calls). The solution would still not be 100% optimal though. An example would be where there is only 1 record left, and a user wants to assign something. However, a lock is still timing out for some reason, so the user gets an error message and so is led to believe no ids are left. Again, this may be solved by providing a more detailed error message, stating there are numbers left but are currently locked ("try again later"? - :-/ )

这些事情在我头上刚刚起作用。 我曾尝试过一些东西,如挑选来更新,但并没有工作。 值得注意的是,一旦整块被拆除,24小时就被释放。

我正在想一味地找到一些东西,但实实在在没有。 我只字不提这一要求(我说了吗?),这样一来也就 st了如何最好地解决这一问题。

Edit: i 记住i ve used dbms_locks some where in the past 5 years, 或许你应当尝试这样做。 但是,DBMS_LOCK在工作期间(这里有 d)无权使用。 因此,请见rel=“nofollow”

你们做的是:建立后载人程序,并在那里建立排他性锁(你当然不想分享任何东西)。 你们希望,这一id子对挑选出来的那部分人来说是独一无二的。 • 确保要么在锁定时停工(如果是LexWAIT=永远!) 或者有一个取消锁闭的程序,这样,你就能够摆脱麻烦。

-- this is just a handle though, not the actual lock
dbms_lock.allocate_unique(lockname        =>  lock_part_ ||company1_part_id,
                          lockhandle      => v_lockhandle, 
                          expiration_secs => 300 -- 5 mins
                         ); 

-- request does the actual lock,
-- so this ll give errors when called for the same lockhandle 
-- and a lock is already in effect
v_result := dbms_lock.request(lockhandle => v_lockhandle, 
                              lockmode => dbms_lock.x_mode, 
                              timeout => 0 -- fail instantly and don t wait to put a lock if already locked,
                              release_on_commit => true/false -- try both, not sure if it ll work with TRUE
                             );

release_on_commit
Set this parameter to TRUE to release the lock on commit or roll-back.

Otherwise, the lock is held until it is explicitly released or until the end of the session.

如果情况良好,另一场会议则由于你创造的锁锁,能够打开同样的大门。 绕过你,必须尝试放弃,但是,它不应该是对现有24小时进行硬性测试,为错误提供适当的反馈。

DBMS_LOCK.request Return Values

表70-10 职务回报价值

Return Value Description
0 Success
1 Timeout
2 Deadlock
3 Parameter error
4 Already own lock specified by id or lockhandle
5 Illegal lock handle

我喜欢开小节,但如果你只用一页就离开你,并且有许多不同的过程,那么,所有习惯都用在这个一页。 或许可以很容易地找到这个系统,但我只能把它看作是一个老板。





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

How to make a one to one left outer join?

I was wondering, is there a way to make a kind of one to one left outer join: I need a join that matches say table A with table B, for each record on table A it must search for its pair on table B, ...

Insert if not exists Oracle

I need to be able to run an Oracle query which goes to insert a number of rows, but it also checks to see if a primary key exists and if it does, then it skips that insert. Something like: INSERT ALL ...

How can I store NULLs in NOT NULL field?

I just came across NULL values in NOT-NULL fields in our test database. How could they get there? I know that NOT-NULL constraints can be altered with NOVALIDATE clause, but that would change table s ...

Type reference scope

I m studying databases and am currently working on a object-relational DB project and I ve encountered a small problem with the number of possible constraints in an object table. I m using "Database ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

热门标签