Problem doing insert from one schema to another

Hi all;
I have table test on schema A, and i want to create a trigger TEST_TRIG on table test, the trigger must insert data into a table X, and Y in schema B,
when i create the trigger in Aqua i got
Warnings: --->
W (1): Warning: execution completed with warning
<---
0 record(s) affected
and doing an insert on table A gives the following
ORA-04098: trigger 'A.TEST_TRIG' is invalid and failed re-validation
the trigger is
CREATE OR REPLACE TRIGGER A.TEST_TRIG
AFTER INSERT OR UPDATE OR DELETE ON A.TEST
FOR EACH ROW
DECLARE
l_auditId NUMBER(10,0);
l_auditAction VARCHAR2(1);
l_auditPK VARCHAR2(100) := :NEW.FEILD_A;
l_logInserted BOOLEAN := FALSE;
PROCEDURE auditLog
( p_column IN VARCHAR2,
p_oldval IN VARCHAR2,
p_newval IN VARCHAR2 ) IS
BEGIN
IF NOT l_logInserted THEN
INSERT INTO B.X
( auditId, auditTable, auditPK, auditAction, auditUser, auditDate )
VALUES
( B.AUDIT_LOG_SEQ.NEXTVAL,'TEST',l_auditPK,l_auditAction,'test',SYSDATE )
RETURNING auditId INTO l_auditId;
l_logInserted := TRUE;
END IF;
INSERT INTO B.Y
( auditId, auditColumn, valueOld, valueNew )
VALUES
( l_auditId, p_column, p_oldval, p_newval );
END auditLog;
BEGIN
IF INSERTING THEN
l_auditAction := 'I';
ELSIF UPDATING THEN
l_auditAction := 'U';
ELSIF DELETING THEN
l_auditAction := 'D';
l_auditPK := :OLD.FEILD_A;
END IF;
IF :NEW.FEILD_A != :OLD.FEILD_A
OR (:NEW.FEILD_A IS NULL AND :OLD.FEILD_A IS NOT NULL)
OR (:NEW.FEILD_A IS NOT NULL AND :OLD.FEILD_A IS NULL)
THEN
auditLog('FEILD_A',:OLD.FEILD_A,:NEW.FEILD_A);
END IF;
IF :NEW.FEILD_B != :OLD.FEILD_B
OR (:NEW.FEILD_B IS NULL AND :OLD.FEILD_B IS NOT NULL)
OR (:NEW.FEILD_B IS NOT NULL AND :OLD.FEILD_B IS NULL)
THEN
auditLog('FEILD_B',:OLD.FEILD_B,:NEW.FEILD_B);
END IF;
END;
GO

doing select * from user_errors where name = 'TEST_TRIG' returns nothing to me.
i think there is some privilege problem cause if i create tables x and y inside schema A everything works perfectly. Any suggestion

Similar Messages

  • How do I move a table from one schema to another schema on Oracle XE?

    How do I move a table from one schema to another schema on Oracle XE?

    Hi,
    I tried to use the insert/select statement that you had given, it did not work.
    The error is ORA-00913: too many values.
    But finally what I did was, I went into the system schema where the table was and generated the DDL through the utilities and afterwards I imported them into the schema that I am currently working on. It solved the problem!
    However I am still curious to know why the insert/select statement did not work? Do you know any site/tutorial which gives a real time example?
    Thank you
    Skye

  • Copy data from one schema to another schema tables

    Hi,
    I was doing a copy using sql developer copy feature, data copy worked perfect but for few table data didn't move there are about 30 tables from schema prod to schema dev i need to move tables are already created only data needs to be moved from prod to dev
    Can you suggest me any method were I can move all the tables data at a time from one schema to another. Please suggest.
    Thanks
    Sudhir

    Hi,
    If table structure is the same then:
    insert into dev.table_name
    select
    from
      prod.table_name  --if prod is in another database change to prod.table_name@db_link_to_prod_db
    commit
    ;Hope this helps. Otherwise give some more info about where these schema's are.
    Regards,
    Peter

  • How do I move a table from one schema to another schema?

    How do I move a table from one schema to another schema?

    Grant access to the table from the source schema to destination schema.
      GRANT SELECT ON <TABLE_NAME> TO  <DESTINATION SCHEMA>A simple way would be to use CREATE Table with select syntax (in destination schema)
      CREATE TABLE <TABLE_NAME> AS SELECT * FROM <SOURCE SCHEMA>.<TABLE_NAME><li>However, you would be in <b><u>trouble when the table has index,constraints and triggers</u></b>.
    So you can better of grab the DDL statement of the table(and any additional components) andd then create the table in the destination schema.You can use SQL developer, Toad or Apex's Object browser for this.
    After the table is created, Insert the records using SELECT.
    INSERT INTO <TABLE_NAME> SELECT * FROM <SOURCE SCHEMA>.<TABLE_NAME>This question is discussed in great detail in this <b>AskTom thread</b>

  • Moving procedures and sequences from one schema to another

    Hi all,
    Is there any way to export the procedures and sequences alone from one schema to another? If not is there any way to generate the procedure creating scripts from the source schema.
    I used the following script SET HEADING OFF
    SET PAGESIZE 999
    SET LINESIZE 100
    SELECT DBMS_METADATA.GET_DDL('PROCEDURE', NAME, owner) || '/' FROM ALL_SOURCE WHERE
    OWNER='SCOTT' AND TYPE='PROCEDURE'
    SPOOL C:\A.SQL
    SPOOL OFF
    [/CODE]
    But the problem is in the out put script it is cutting the line .. for egCREATE OR REPLACE PROCEDURE "QC_PFIZER_REL5"."SPGETNEXTDS
    S_ID"
    ( V_ID OUT NUMBER )
    IS
    BEGIN
    SELECT SEQUENCE_DSS_Id.NEXTVAL INTO V_ID FROM DUAL;
    END ;
    i experimented with increasing linesize but it is not helping. I am using 9.2.0.5 on windows 2003.
    Thanks
    Muneer

    Similar to getting the code from user_source, you could get sequences from user_sequences.
    SQL> select dbms_metadata.get_ddl('SEQUENCE', sequence_name) from user_sequences ;
    DBMS_METADATA.GET_DDL('SEQUENCE',SEQUENCE_NAME)
       CREATE SEQUENCE  "SCOTT"."SEQ"  MINVALUE 1 MAXVALUE 1.00000000000000E+27 INCR
    EMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE
    1 row selected.
    SQL>

  • Best LKM to move data from with in Oracle from one schema to another Schema

    Hi Gurus,
    What is the best KM to move data from one schema to another schema within same oracle database.
    Thanks in advance

    Dear,
    If your source and target are on the same database server then you dont need LKM.
    You have to 1. create one data server for the database server
    2. Create one physical schema for your source and another physical schema for your target under the above created data server.
    3. Then create models for each above created physical schema
    In this case you just need IKM knowledge module
    Please refer http://oditrainings.blogspot.in/2012/08/odi-interface-source-target-on-same.html
    If your source and target are on different server then you must create two different data servers in topology. You have to use LKM.
    The best LKM to use is LKM oracle to Oracle dblink. But you should have proper grants to use it
    If your source has very few records you can go with LKM SQL to Oracle other wise use LKM oracle to Oracle dblink

  • Copying data contianing long datatype from one schema to another

    I'm using Oracle 8.1.7 and trying to move copy data from one schema to another.
    Usually an easy task. This time the data contains longs so I can't use standard SQL. The data in the long is too long for a PL/SQL long datatype so that's not worked.
    I've tried the COPY FROM command but get the invalid sql command error.
    Can anyone save my hair?

    The COPY command doesn't have to be all on one line. The continuation character for SQL*Plus commands is a hyphen.
    SQL> prompt "Hello"
    "Hello"
    SQL> prompt -
    "Hello""Hello"
    SQL>Metalink is the website for customers that pay for Oracle support. Go to www.oracle.com and click on the metalink button on the top left of the screen. It's called Metalink because Oracle support levels are named after metals: bronze, silver, gold.

  • Problem moving mail from one computer to another...

    Hello.
    I'm trying to move a specific mailbox from one computer to another computer. I'm doing this to 2 pairs of machines and with the first pair I had no issues. But, then second pair I get errors.
    On the first computer I just copied the .mbox folder (which contains the sub "Messages" folder & info.plist file) from the one computer to the other. Then, in mail.app I "import" the messages via the Import option (importing mail from Mac OS X). No problem and all messages are imported.
    On the second pair of computers, I did the same thing, but when I try and Import the messages onto the second machine, it says it can't find any OS X mail messages to import.
    I really need to get these messages from one machine to another. "Forwarding" or "Redirecting" all the messages from one machine to another isn't an option.
    Can anyone suggest what might be wrong, or another way of migrating the single folder of messages (not the entire account) from one machine to another?
    Thanks,
    Kristin.

    Hi Kristin,
    I stay away from mbox files because it has never worked for me, but I may have a solution. This may not be THE award winning answer, but you could consider it when the other options don't work:
    I assume you want to import a mailbox that is NOT part of an IMAP account, because otherwise you would not have this problem (right?) (otherwise just open that IMAP account on the computer you want the messages on).
    But if you have an IMAP account, besides the POP account that contains the mailbox in question, you can use that account to fix your problem:
    Go to the compu that has the desired mailbox, make a new folder in the IMAP account called 'backup' or whatever. Copy all messages from the desired mailbox to that new IMAP folder (depending on size this may take a while, because you are uploading via your internet connection). Now go to the other compu, make a new 'local folder' in mail.app. Open the IMAP account in mail.app and open the 'back up folder'. Now copy all messages to the new, local folder.
    If you don't have an IMAP account, you can always open a free one with gmail.
    I know, it's not very elegant, but this will work guaranteed.
    Good luck,
    Feddeg

  • Problem in Navigation from one tab to another

    Hi All,
    In my forms, I have three tabs. In one tab, i have a set of records displayed(like table) in which all columns are bound to a table. I want to sort the records in the tab based on one column. So i wrote the following code in WHEN-TAB-PAGE-CHANGED trigger in form level. It works fine when i click on the particular tab. But when i try to navigate from one tab to another tab which i want to sort, the records in the tab are not sorted. The buton i used to navigate from one tab to another is tab in key board.
    DECLARE
    l_order_by VARCHAR2 (70) := '(select code from emp)';
    BEGIN
    IF (:SYSTEM.tab_new_page) = 'PAGE1' OR :SYSTEM.cursor_block = 'BLOCK1' THEN
    SET_BLOCK_PROPERTY ('BLOCK1', order_by, l_order_by);
    GO_BLOCK ('BLOCK1');
    EXECUTE_QUERY;
    END IF;
    END;
    please help asap.
    Thanks,
    Gopi.

    Gopi,
    Based on your sample code, the only data block that you are modifying the sort on is "BLOCK1". Rather than combine all of your logic into the When-Tab-Page-Changed (WTPC) trigger, I suggest you simply use the WTPC trigger to set the cursor to the block associated with the selected tab page and then set your block properties and query your block in the When-New-Block-Instance (WNBI) trigger for each block. For example:
    /* Sample When-Tab-Page-Changed trigger */
    DECLARE
       tp_nm    VARCHAR2(30);
    BEGIN
       tp_nm := :SYSTEM.TAB_NEW_PAGE;
       IF ( tp_nm = 'PAGE1' ) THEN
          Go_Block('BLOCK1');
       ELSIF ( tp_nm = 'PAGE2' ) THEN
          Go_Block('BLOCK2');
       ELSIF ( tp_nm = 'PAGE3' ) THEN
          Go_Block('BLOCK3');
       END IF;
    END;Bare in mind, that clicking on a Tab Page does not move the navigation cursor the block associated with the tab page displayed. You must manually perform the navigation as demonstrated above. Now, in your WNBI triggers you would write something like the following:
    /* Sample When-New-Block-Instance trigger */
    DECLARE
       l_order_by VARCHAR2 (70) := '(select code from emp)';
    BEGIN
       SET_BLOCK_PROPERTY ('BLOCK1', order_by, l_order_by);
       EXECUTE_QUERY;
    END;You could combine this code into the WTPC trigger if you don't want to seperate the code and orgainze it according to your data blocks. The key, however, is that cursor navigation doesn't occur when you click on a tab, you have to perform the navigation yourself.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Problem transferring website from one PC to another.

    I’m trying to transfer a site from one PC to another, but it won’t open on the second PC. I’ve tried exporting the site definition and also transferring individual files, all to no avail.
    It’s the same copy of Dreamweaver CS4 on both machines (version 10.0, build 4117) but it acts as though Dreamweaver doesn’t exist on the second PC, even when I have it open first.
    Would the fact that the first PC is running Windows 7 while the second PC is running Windows XP have any bearing on it? Or am I doing something else wrong?

    Murray,
    I export to a memory stick and then import it from that. It loads the folder into DW local files on the second PC, but there's nothing inside the folder. It's just empty.
    John,
    I purchased one copy and installed on both machines. They're not networked. I had hoped to keep one PC offline and just transfer files to the other one and use it for connecting to the Internet.

  • Migrating EUL from one schema to another

    Hi All,
    We have a custom EUL XX_EUL_US defined in the APPS schema and so, cant use discoverer viewer and discoverer plus with it. We are planning to migrate this EUL to a new owner of name say, XX_EUL_US itself so we can then use all the features of discoverer.
    1. What is the best way of migrating the EUL from one owner schema to another ?
    2. We have several hundred reports owner by users, who use their apps login and responsibilities on this EUL. I would like to know the best practices around this migration with minimal disruption to users. Any documentation or suggestions are welcome.
    Regards,
    Vinayaka

    Hi Vinayaka
    This is a straightforward task. You build out a new Apps mode EUL complete with an assignment to say teh SYSADMIN user. If you're not 100% familiar with doing this please look at the free white paper on my website at this location: http://ascbi.com/downloads/downloads.htm
    With the EUL in situ you got to your old EUL and use File | Export to take a complete export. This will include your workbooks.
    Next, you got to the new EUL and use File | Import to bring it in. On the import screen I recommend you set these switches:
    For resolving what to do when two objects match - use Refresh the object
    For matching up items - use Match items up by Display Name
    For who should own the workbooks - use Only take ownership if original owner cannot be found
    You may well find that not all of the links and cross references get imported the first time because of a round robin type situation for things like folders have joins between them but joins can't be imported until the folders exist. To resolve this and make the import complete you just import again. Any missing cross references will now be imported.
    Best wishes
    Michael

  • Export data from one schema to another schema through sql

    Hello.
    I have 2 schemes. One is called MICC_ADMIN and the other one is called MICC_PROD. What I want is to export from MICC_ADMIN to import in MICC_PROD. I tried to do it with the Data Workshop tool, but one of the table has around 19.000 records, so it gets frozen when is trying to export the data. So I'm wondering if is there any way to do it through sql command. Thanks.
    Regards, Bernardo.

    I am going to assume that you:
    1) want to export DB objects from the source schema (MICC_ADMIN) to your target schema (MICC_PROD)
    2) awant to export the data held in the aforementioned tables between the two schemas
    Firstly, generate the relevant DDL for your DB objects (you can do this in APEX as well - Home>Utilities>Generate DDL then complete the wizard) and run the DDL script in your target schema.
    Secondly, grant access to the relevant tables in the source schema to your target schema and compose DML insert statements to transfer the data from one to another (remembering to disable the relevant constraints/triggers during the process).
    Thereafter, revoke access to your source schema.
    You can, of course execute this in a single script, although better to do so in a test environment first if you can!

  • Transferring data from one schem to another

    Hi:
    I am looking for an efficient way to transfer all the records from one table in a certain schema to it's identical counterpart in another schema. Both schemas are in the same Instance. The tables are "identical" in that they have the same columns as metadata. Any suggestions?
    I would like this to be as quick a transfer as possible, so, if it would speed things up, I would like to consider deferring update of indexes of the receiving table until after the records have moved. Is that sort of thing possible? A less attractive approach would be to drop all the indexes, then transfer the records, then recreate all the indexes.
    The receiving table will be truncated just prior to the transfer, so perhaps all forms of journaling/undo can be shut off (no need to recover if the transfer failed)
    Thanks for any help

    You could certainly drop and recreate the indexes as another part of the answer, but the fastest transfer would be a direct-path insert:
    insert /*+ append */ into target
      select * from source;

  • Move Business Area and EUL from one schema to another

    Hi,
    I need to take a EUL from the schema where it is now and bring it to another schema. I use Oracle Discoverer 3.1 Admin Edition to Export Business Area then import it in the new schema. Everything works fine except the fact that workbooks (.dis file) created in the original schema returns no data (as it does in the original schema).
    Anybody can help ?

    Hi,
    There could be a number of reasons for this, but the first thing to check is whether Discoverer is generating the same SQL when the report is run in the two EULs.
    If the SQL is the same Discoverer could still return different data if for example there were user specific conditions in the query or language specific conditions in the query and the default language was different in the EULs.
    Are you using an Apps or database mode EUL? What is in the workbook query that you are running?
    Rod West

  • Problems in navigating from one report to another in Obiee 10g

    Hi,
    I am trying to navigate from One report another report.
    In the first report, the filters are being passed using the presentation variable.
    In the second report, the filter are also based on presentation variable.
    In the first report, filters are being passed but when I navigate to second report I face the problem.
    The presentation variable are not getting passed.
    Kindly help with you suggestions.
    Regards,
    Biswadeep

    Hi Biswadeep,
    in your first report you use the presentation variables to filter data. But in your second report, you must include all fields where you want filter data and in the properties of each field you indicate that these fields are prompted.
    Hope it helps,
    Benoit

Maybe you are looking for

  • VM experts, please resolve dispute re

    Over in "Advanced Topics", http://forum.java.sun.com/thread.jsp?forum=4&thread=167222 dnoyeB and I are having a spirited discussion about the mechanics of thread working copies vs. main mem's master copy. It's a very long discussion that spawned off

  • Issue with FDM load to Essbase

    I have an FDM app setup to load HFM data to Essbase which then runs a calc script after the data load. Everything works fine if I bypass our load balancer when logging into FDM to run the data load. If I login to FDM through our load balancer, when I

  • Auto mailers in recruiter's page ( E - Recruitment )

    Hi , I have one client requirement. In the format  of sending interview invite to candidate the format of the letter should have a check box or radio button of attending , by which he can confirm the recruiter that he is attending the interview. Basi

  • Custom print order in Address Book

    HI all, I want to print an member List for my organization in address book with a Custom Sort Order.   I don't know how to do it.   Here is the thing:  I made a contact list of the members of the organization so that I can have on File.   Select my C

  • Calling Substitution Strings in Supporting Object Installs

    So, for lack of a better way of putting it, I have a need to have user input durring the script install part of the supporting objects. I would like to use the Substitution String prompts but can not figure out where it stores the values durring inst