Great! Atleast it worked there. Now I have some confidence. Definitely there should be some problem in my environment.
Here also I tried but again failed. I put all code in file and executed, but no good results. The file looks like this
set echo on;
drop database link lptp_link ;
create database link lptp_link connect to system identified by partha using 'lptp';
CREATE OR REPLACE TRIGGER mir_sto_insert
AFTER INSERT ON mir_stores
FOR EACH ROW
BEGIN
insert into
mir_stores@lptp_link values (
:NEW.id,
:NEW.name,
:NEW.address1,
:NEW.address2,
:NEW.city,
:NEW.state,
:NEW.zip ) ;
DBMS_OUTPUT.PUT_LINE('Success add the row into Compaqlptp db!!!!');
DBMS_OUTPUT.PUT_LINE('The two DBs in FRYS and LPTP are in SYNC');
END;
/
select object_name, object_type, status from user_objects
where status <> 'VALID';
select object_name, object_type, status from user_objects
where object_name = 'MIR_STO_INSERT';
desc mir_stores@lptp_link;
desc mir_stores;
select * from mir_stores@lptp_link;
select * from mir_stores;
insert into mir_stores values ( 1,'BestBuy','1234','Cedar Mills Road','Beaverton','OR','97006');
The results are as below: [it fails in the insert!]
SQL> ed new_trig
SQL> @new_trig
SQL> drop database link lptp_link ;
Database link dropped.
SQL> create database link lptp_link connect to system identified by partha usin
g 'lptp';
Database link created.
SQL> CREATE OR REPLACE TRIGGER mir_sto_insert
2 AFTER INSERT ON mir_stores
3 FOR EACH ROW
4 BEGIN
5 insert into
6 mir_stores@lptp_link values (
7 :NEW.id,
8 :NEW.name,
9 :NEW.address1,
10 :NEW.address2,
11 :NEW.city,
12 :NEW.state,
13 :NEW.zip ) ;
14 DBMS_OUTPUT.PUT_LINE('Success add the row into Compaqlptp db!!!!');
15 DBMS_OUTPUT.PUT_LINE('The two DBs in FRYS and LPTP are in SYNC');
16 END;
17 /
Trigger created.
SQL> select object_name, object_type, status from user_objects
2 where status <> 'VALID';
no rows selected
SQL>
SQL> select object_name, object_type, status from user_objects
2 where object_name = 'MIR_STO_INSERT';
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE STATUS
------------------ -------
MIR_STO_INSERT
TRIGGER VALID
SQL>
SQL> desc mir_stores@lptp_link;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NOT NULL NUMBER(38)
NAME NVARCHAR2(30)
ADDRESS1 NVARCHAR2(30)
ADDRESS2 NVARCHAR2(30)
CITY NVARCHAR2(30)
STATE NVARCHAR2(2)
ZIP NVARCHAR2(10)
SQL> desc mir_stores;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NOT NULL NUMBER(38)
NAME NVARCHAR2(30)
ADDRESS1 NVARCHAR2(30)
ADDRESS2 NVARCHAR2(30)
CITY NVARCHAR2(30)
STATE NVARCHAR2(2)
ZIP NVARCHAR2(10)
SQL> select * from mir_stores@lptp_link;
no rows selected
SQL> select * from mir_stores;
ID NAME ADDRESS1
---------- ------------------------------ ------------------------------
ADDRESS2 CITY ST ZIP
------------------------------ ------------------------------ -- ----------
13 Trigger Test Trigger address
Trigger_address2 Beaverton OR 97006
144 Trigger Test Trigger address
Trigger_address2 Beaverton OR 97006
SQL> insert into mir_stores values ( 1,'BestBuy','1234','Cedar Mills Road','Beav
erton','OR','97006');
insert into mir_stores values ( 1,'BestBuy','1234','Cedar Mills Road','Beaverton
','OR','97006')
*
ERROR at line 1:
ORA-04098: trigger 'SYSTEM.MIR_STO_INSERT' is invalid and failed re-validation
ORA-02063: preceding line from LPTP_LINK
ORA-06512: at "SYSTEM.MIR_STO_INSERT", line 2
ORA-04088: error during execution of trigger 'SYSTEM.MIR_STO_INSERT'
SQL>
SQL>
What env differences could be there.
Configurations of my machines [later pgms will be moved to unix and linux]
M/c 1 : PII - 256 MB, Oracle 9i.
M/c 2 : PIV - 784 MB, Oracle 9i.
I don't want to give-up since your effort & suggestions hasve given lot of confidence. Anyways, if you think that any other difference may be causing this, pls let me know.
Thanks very much.
Partha