For update......urgent
how to use for update in group functions.
for e.g select max(ref_no) from ttt for update of ref_no.
i.e i want to update in table ttt based on ref_no. the problem i am facing is that at a time more than one user is using my application and the value retrieved using max(ref_no) returns the same value for both the person and hence the updation process goes wrong. can anyone tell me how to generate different max(ref_no) for different people. what changes can i have to make in the query when retreiving ref_no.
Mari
First, select max(ref_no) from ttt for update of ref_no is not a valid cursor.
Then, I do not understand the problem really. If you want to do an update, you already have a record. Of course, you cannot have 2 users updating the same record. Do you mean that you want to insert a new record with a new ref_no?
If a lot of users use the same table, and generate many new records, you can use a sequence to generate ref_no.
A disadvantage of sequences is that it does not guarantee a number range without a gap (if that is your requirement).
If you store your current max(ref_no) in a seperate table, you may retrieve, update and immediately commit this update in an autonomous transaction.
Similar Messages
-
Help on Procedure and trigger for updating(urgent please)
SQL> / Table A
CTUT_ID CTUT_COMPANY_NAME CURRT_USER_ID FMIS_ID CREATE_DA UPDATE_BY UPDATE_DATE
1234 A 15-APR-03
2222 B 15-APR-03
3333 C 15-APR-03
4444 D 15-APR-03
5555 E 15-APR-03
6666 F 15-APR-03
150282 G oRACLE 23-APR-03
1 H 15-APR-03
2 I 15-APR-03
3 J 15-APR-03
150343 K TIGER 24-APR-03
150305 L EXAMPLE 23-APR-03
150342 M SCOTT 24-APR-03
sQL >/ Table B
Empno Empname UPDATE_BY UPDATE_DATE
1 AA
2 BB
3 CC
4 DD
What i need to do is i need to create an update trigger on both tables
like create a procedure
1)In procedure i need to check like
IF TABLEA.CURRT_USER_ID = (SELECT USER FROM DUAL)
THEN
UPDATE_BY = (CURRENT_USER_ID of CTUT_ID)
FOR EXAMPLE CURRENT USER_ID IS SCOTT THEN
UPDATE_BY = 150342
UPDATE_DATE = SYSDATE
ELSIF
UPDATE_BY <=> (CURRENT_USER_ID of CTUT_ID)
THEN
MESSAGE('USER IS NOT IN TABLE);
END IF;
and call that procedure in the update triggers
FOR BOTH TABLES TABLEA,TABLEB
i CREATED A PROCEDURE BUT IT IS NOT WORKING
ANY HELP PLEASE
CREATE OR REPLACE PROCEDURE UPDATE(
UPDATE_DATE out DATE,
UPDATE_BY out VARCHAR2)
IS
Uuser varchar2(20);
Udate date;
Ufound number(1);
BEGIN
SELECT USER,SYSDATE
INTO Uuser,Udate from dual;
SELECT count(*),CTUT_ID into Ufound,Uctut_id
FROM TABLEA
WHERE CURRT_USER_ID = Uuser
Group by Ctut_id;
IF (UFOUND = 1) THEN
UPDATE_DATE := UDATE;
UPDATE_BY := UCTUT_ID;
END IF;
EXCEPTION WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20001,'User Does not Exist');
END UPD_CONSTITUENT;
CREATE A TRIGGER :
CREATE OR REPLACE TRIGGER TU
BEFORE INSERT ON TABLEA
FOR EACH ROW
BEGIN
UPDATE(:NEW.update_date,
:NEW.update_BY);
END IF;
END;
SQL> update TABLEA
2 set CTUT_COMPANY_NAME = 'SCOTT TEST'
3 WHERE FMIS_USER_ID = 'N';
update TABLEA
ERROR at line 1:
ORA-04091: table TABLEA is mutating, trigger/function may not see it
ORA-06512: at "UPDATE", line 12
ORA-06512: at "TU", line 1
ORA-04088: error during execution of trigger 'TU'Hi Mara,
You are right thats what i want
I have a table A
EmpNo Empname Currtuser_id Update_date Updateby
1 Denis Oracle
2 Scott Scott
3 Mara MMara
1)what i need to do is when any user tries to update the table Table A
Then the Trigger or procedure should check whether user is exits in table A in column currtuser_id
If his user id exits in table A
Then allow him to update the TABLE A
and insert his EMPNO in UPDATE_BY
and SYSDATE in UPDATE_BY
He will do all this process using forms
But i need to have trigger or procedure in database level for table
2) I have another table like 10 tables
Suppose TABLE B
When user tries to update TABLE B
Then the Trigger or procedure should check whether user is exits in table A in column currtuser_id
If his user id exits in table A
Then allow him to update the TABLE B
and insert his EMPNO in UPDATE_BY
and SYSDATE in UPDATE_BY
3) I need to have a common Procedure and call that procedure in all tables in UPDATE TRIGGER
Thanks for your help
Thanks -
Very urgent help - for update field1 nowait across databaselink
Hi,
We have a form that uses select for update field1 nowait for a table that is accessed across a database link. When we try to do this the form errors out giving frm-92101 error. If I comment out the for update statement then it works fine. I know it the for update that is causing the problem but I'm not sure how to fix it. Can someone help me please. Very urgent, we are in the middle of upgrade and we found this issue while testing the forms.
Any ideas or suggestions ?
I'm using 10g App.Server and 10g database.
Please help.
Thanks in advance.under which trigger you ran that update ?
-
Urgent -Create RFC for update the database and delete from the database
Hi Guy's,
Please help me how to create the RFC for update to databse and delete from database(step-by-step) procedure.
Thanks and Regards,
Sai.Hi,
Please go through the following link,
reward if helps.
[RFC Step By Step|https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action?pageId=39728]
regards,
mahantesh -
BAPI for updation of Profit center in table VBRP
Hello Friends,
I have to Update the Field 'PRCTR' in the table VBRP. Is there some BAPI available for updating VBRP .
I tried FM 'RV_INVOICE_ITEM_MAINTAIN'.
FM RV_INVOICE_DOCUMENT_UPDATE
But fields are not getting updated
Could you please help me, It is urgent.
Thanks & Regards,
Anju NRV_INVOICE_DOCUMENT_UPDATE is used to buffer header updates, i don't think you need this. what you most likely need is RV_INVOICE_DOCUMENT_ADD to process the buffered item updates. but its highly recommended to have complete sequence 1. RV_INVOICE_REFRESH 2. RV_INVOICE_DOCUMENT_READ 3. series of RV_INVOICE_ITEM_MAINTAIN, if multiple line update 4. RV_INVOICE_DOCUMENT_ADD
-
For Update Query with Wait Clause from ORACLE Forms
Hi
We are using Oracle Forms 10g running with 10g database 10.2.0.1.0. We happend to see a query which is getting generated in AWR report like Select rowid, all_columns from TableName for Update of C1 Nowait. But no such query is really written in forms and we are aware that, Any query prefixed with rowid is definitely executing from Forms. But how the ForUpdate and Nowait clause is appended to the query.
We have checked the following properties in the database Block
*1) Locking Mode is set to Automatic*
*2) Update Changed Columns only is set to YES*
*3) Query all records is set to No (Though this particular property may not be relevant to the issue)*
What is the property or setting which might trigger such a query from ORACLE Forms with ForUpdate and Nowait clause.
Any ideas/suggestions on why such behaviour. Please have a healthy discussion on this. Thanks in advance.Why have you started another thread on the same thing?
FOR UPDATE cursor is causing Blocking/ Dead Locking issues
Just use one thread to avoid confusion.
The fact that nobody has answered on the other thread for a couple of days could be to do with it being the weekend and most people are not at work.
Either be patient or, if it's more "urgent" than that, raise a SR/Tar with Oracle metalink. -
FOR UPDATE causing query to take very long to execute.. What can we do ??
SELECT cell_data
FROM csv_workfile
WHERE cell_row = p_r
AND cell_column = p_c
FOR UPDATE;
this is our query. it take very long to execute.
wat can we do to get it working properly.
this is real real urgent .
RagardsHi,
first ask yourself if a SELECT FOR UPDATE is really necessary. If so, try to use an FOR UPDATE OF <attribute>. If there are many users accessing and updateing this table try NOWAIT Option. Your process will not be blocked on case of another lock. You will get error ORA-00054 and can do other things while waiting.
Keep in mind that locks will only released after COMMIT.
But remember to ask yourself. Row locking can be very time consuming. If you can avoid it.
Bye,
Holger -
How to avoid 'select for update'
Hi,
we are using the bc4j framework of jdev 3.2.3. We have a View which collects data from several tables in different database schemes, so we naturally have to use the 'union clause'. But if we try to make an update on a row (via 'setAttribute'), we got a DMLException ORA-02014 telling us that we should not use 'select for update' on views whith unions.
Since i cannot avoid using a union clause, is there a way to avoid the 'select for update' in the bc4j framework?
Please help, its urgent!
Thanx,
DietmarSELECT FOR UPDATE is used for our implementation or row-level locking.
If you are using pessimistic locking mode, this will occur the first time any attribute is modified.
If you are using optimistic locking mode, it will be deferred until post/commit time.
If you are using "none" locking mode, it will not happen in your application may hang indefinitely if another session has locked the row.
Are you asking how to avoid locking?
Do you mean to be updating this view with a union over multiple databases? -
Error message: "playlists selected for updating no longer exist"
I tried to update my ipod nano and I guess I had deleted a playlist, but since then, I have not been able to update. Every time I try, I get the following message:
"Cannot be updated because all of the playlists selected for updating no longer exist."
I haven't been able to highlight which playlists are selected to begin with.
I read through the manual and thought that maybe rebooting the whole system might work. So I deleted Itunes from my computer and re-installed.
Then I tried re-setting my ipod. So now I have nothing on my ipod.
I also deleted everything from my library, thinking it might help to start from scratch. Nothing has worked.
How do I "select" and "unselect" playlists so I can get up and running again?Here you go.
http://discussions.apple.com/thread.jspa?messageID=607312򔑐 -
Why does my app store use a different account for downloading and another for updating apps?
My app store used my own account for downloading and my sister's for updating, and it keeps telling me to reset my account. I already did that the other few times it told me to do that!
Have you restored your device from your sister's backup?
-
Lost music on ipod because "playlists selected for updating no longer exist
Not sure what I've done. I recently downloaded newer version of itunes. Then when synching, I had too much music in my library for the ipod to handle so it told me about doing the smart playlist. I erased a couple of playlists on the itunes menu I no longer wanted and then when I went to synch, this error came up "songs on the ipod cannot be updated because all of the playlists selected for updating no longer exist."
Please help.....Check this out.
iPod cannot sync because one or more playlist.... -
Playlists for updating no longer exist
i am a novice...i deleted my ipod nano playlist from source list...i also updated yesterday...no i keep getting a screen when i connect my ipod to computer that reads, "songs on the ipod cannot be updated because all of the playlists for updating no longer exist. but all songs remain in library....Help!
You will find this user tip useful for resolving the missing playlist issue: Hudgie - iPod cannot sync because one or more playlists are missing
-
"songs..can't be updated b/c all the playlists for updating no longer exist
My Ipod was "off power" for so long that it "forgot" all its music. Now when I plug it in to my base computer, rather then synching it says "songs on the ipod "name" cannot be updated because all the playlists for updating no longer exist"
Hey.
See if this can help;
http://discussions.apple.com/thread.jspa?threadID=121728&tstart=150
Cheers!
-Bryan -
"All of the Playlists Selected for Updating No Longer Exist"
My family has 2 ipod shuffles. After purchasing a Nano recently, I inserted the cd that came with it. Apparently the existing iTunes software was removed and reinstalled. At any rate, the library still shows all the original songs, but when the Nano is plugged in, iTunes immediately gives a prompt stating "Songs on the iPod *** cannot be updated because all of the playlists selected for updating no longer exist." The library is there, the playlists that were there are there, and I can play the songs on my cpu. Is there anything I can do besides completely uninstalling everything and starting over?
iPod Nano Windows XP ProThis user tip should help you sort out your missing playlist problem: Hudgie - iPod cannot sync because one or more playlists are missing
-
"All of the playlists for updating no longer exist"???!!
I created a few new playlists and deleted an old one in iTunes, and then when I plugged in my mini to update I get the message:
Songs on the iPod Kellee's iPod cannot be updated because all of the playlists for updating no longer exist"
There are no songs in my mini after this msg. I reset it, tried to update again, but got the same msg. Please help!!Hi Kellee!
Why do people delete playlists?? Seems like you have the same problem someone I tried to help has. She got the exact same error message when she deleted a playlist. If I were you I would have shifted some songs around, changed the name of the playlist to something else but NOT deleted the playlist. I don't think you can get the same playlist back once you delete it. Question is why is your iPod not recognizing your new playlists and it's requesting to update the playlist you already deleted?? I'm afraid I can't help you but maybe someone else can. I just wanted to say this.
Maybe you are looking for
-
hey, for some reason i turned on my macbook pro 2012 and it says i have no internet access. I then found out that it also says that my self assigned ip address will not connect to the internet. How is this and how can i fix it?
-
[W510] - USB 3.0 SSD, poor performanc​e.
Help please? I'm getting some rather poor performance on both of the USB 3.0 ports on the laptop. I have an SSD that's been tested via internal SATA II connection, capable of (sequential) read 275MB/s, and write 250MB/s. Also have a 3.5 inch WD Cavi
-
1020 There is no lock for ringer volume level, but...
Earlier today I posted in this Community regarding the Subject issue. Received good reply and marked it as a Solution. Had additional thoughts so I'm doing this new Post. Same Subject as before. I had asked if it's possible to LOCK the ring volume, a
-
Hi guys and girls I have develoed sim toolkit applet to send sms,its complied sucessfully and also converted successfully.But when i am loding this applet to java card its giving error like this: [b]error:package loading failed ! loading ended with e
-
Form Validation on Complex Primary Key
I have a that inserts/updates a table with a 2 coulmn primary key (ticket_num, ticket_seq). Is there anyway to create a page validation item that will keep users from violating the pk constraint and getting the ugly ORA-00001 error. I think I just do