Microsoft
Software
Hardware
Network
Question : Exception handling for insert statement
Need a simple program that inserts records into a table and delete some records after the insert is successful. I have to check for exceptions and commit at the right place. I not sure what exceptions I should check for the insert and when to do the commit.
Here is the same proc I wrote. Please suggest a better way of handling exception and deletes after the insert is successful.
create or replace procedure insert_adj_rec (P_btch_id batch.btchid%type)
IS
l_trans_id trans.trans_id%type := 123;
BEGIN
INSERT INTO TABLE1 (
COL1,
COL2,
COL3)
VALUES (
SELECT COL1,
COL2,
amount * -1 ------make negative to postive
FROM TABLE2
WHERE BTCH_ID = P_BATCH_ID
AND trans_id = l_Trans_id
and amount < 0);
---after insert is success delete negative amounts
delete from table2
where amount < 0;
COMMIT;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN ---not sure if this is right
DBMS_OUTPUT.PUT_LINE ('DUPLICATE RECORD - ' || SQLERRM);
ROLLBACK;
END;
Max points because of urgency.
Answer : Exception handling for insert statement
Bit tricky. Are the servers members of a domain?
I'm thinking that if you get php to run under a user account, you can add that user's perms to the network share permissions:-
http://support.microsoft.c
om/default
.aspx?scid
=kb;en-
us;
Q124184
Random Solutions
Copy Folder / Files From Corrupt Disk In Linux (Kubuntu)
2GB of RAM laptop only recognizing 1GB
how to use iscsi from backup exec with Dell TL2000
Web Services or WCF
Slow copy from VMware Esxi 3.5i onto Ext USB Drive
Access / how many users connected?
PL/SQL - how to dynamically retrieve next 5 years from sysdate
Downgrade office 2010 to office 2007
Access VBA - best way to get field value based on ID
OCS 2007 R2