Error insert data over db link in table covered by materialized view

Hello together,
following problem:
I got a table called LOCATION_INFO which is defined:
create table LOCATION_INFO
LOCATION_ID VARCHAR2(40) not null,
PLANT VARCHAR2(4) not null,
PRODUCT VARCHAR2(3),
AREA VARCHAR2(1),
LINE NUMBER(10),
STATION NUMBER(10),
STATINDEX NUMBER(10),
FU NUMBER(10),
WP NUMBER(10),
TP NUMBER(10),
LOCATION_LEVEL NUMBER(1) not null,
LOCATION_PARENT_ID VARCHAR2(40),
TIME_STAMP TIMESTAMP(6) WITH TIME ZONE not null
I try to load data over PL/SQL procedure from another database using database link:
INSERT INTO LOCATION_INFO
(LOCATION_ID,
PLANT,
PRODUCT,
AREA,
LINE,
STATION,
STATINDEX,
FU,
WP,
TP,
LOCATION_LEVEL,
LOCATION_PARENT_ID,
TIME_STAMP)
SELECT LOCATION_ID,
PLANT,
PRODUCT,
AREA,
LINE,
STATION,
STATINDEX,
FU,
WP,
TP,
LOCATION_LEVEL,
LOCATION_PARENT_ID,
GetUTCDateTime(TIME_STAMP) AS time_Stamp
FROM LOCATION_INFO@SOURCE_MMPDDB
WHERE ROWNUM < 100;
This works fine (If i do select count(*) from location_info the data is present) but if set a commit
ORA-00603 appears and the session is terminated.
The point is i got a materialized view MVIEW_LOCATIONS in another schema in the database reading the data from my table location_info and a corresponding MVIEWLOG.
create table MLOG$_LOCATION_INFO
LOCATION_ID VARCHAR2(40),
SNAPTIME$$ DATE,
DMLTYPE$$ VARCHAR2(1),
OLD_NEW$$ VARCHAR2(1),
CHANGE_VECTOR$$ RAW(255)
CREATE MATERIALIZED VIEW MVIEW_LOCATIONS
REFRESH FAST ON COMMIT
ENABLE QUERY REWRITE
AS
SELECT "LOCATION_INFO"."LOCATION_ID" "LOCATION_ID","LOCATION_INFO"."PLANT" "PLANT","LOCATION_INFO"."PRODUCT" "PRODUCT","LOCATION_INFO"."AREA" "AREA","LOCATION_INFO"."LINE" "LINE","LOCATION_INFO"."STATION" "STATION","LOCATION_INFO"."STATINDEX" "STATINDEX","LOCATION_INFO"."FU" "FU","LOCATION_INFO"."WP" "WP","LOCATION_INFO"."TP" "TP","LOCATION_INFO"."LOCATION_LEVEL" "LOCATION_LEVEL","LOCATION_INFO"."LOCATION_PARENT_ID" "LOCATION_PARENT_ID","LOCATION_INFO"."TIME_STAMP" "TIME_STAMP" FROM "CP4MMPDNEW"."LOCATION_INFO" "LOCATION_INFO";
What do I need to do to make the insert working properly without deleting my mviews?
Can anyone help me?
Thanks, Matthias

Helllo,
Can you change this on your Materialized View DDL:
REFRESH FAST ON COMMITTo:
REFRESH FAST ON DEMANDThen, if your INSERT and COMMIT works OK then, can you try:
exec DBMS_MVIEW.REFRESH('MVIEW_LOCATIONS')

Similar Messages

  • How to insert data from JTable to mysql Table....

    hello everybody
    i need help about how to insert data from JTable to mysql table... i know about how to create Table model...facing problem about how to insert data from JTable to mysql table....any helping link or code ... ill be thankfulll....for giving me solution...

    table1.getValueAt(table1.getSelectedRow(),0)you are getting the value of a selected row... or if you want you can just use a loop..
    for(.....){
    table1.getValueAt(x,y);
    }I think you know INSERT STATEMENT.. here on it just string concat
    sample e.g. (This not insert)
    "delete from accrule " +
                    "where ruleid= " + tblRA.getValueAt(tblRA.getSelectedRow(),0)+
                    " and accountname='"+tblRA.getValueAt(tblRA.getSelectedRow(),1)+"'"

  • Error inserting data into database

    Hello I am having error inserting data into database through a servlet.Please I am very new to Java Technology and need your immediate help. beloww is the codea nd the error
    Apache Tomcat/4.0.3
    ERROR: Problems with adding new entry
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6106)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6263)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2525)
         at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
         at Register.insertIntoDB(Register.java:71)
         at Register.doPost(Register.java:53)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
         at java.lang.Thread.run(Thread.java:536)
    COde:
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    public class Register extends HttpServlet
         public static Statement statement;
         private Connection DBConn;
         public void init(ServletConfig config) throws ServletException
              super.init(config);
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   DBConn=DriverManager.getConnection("jdbc:odbc:Challenge");
              catch(Exception e) {
                   e.printStackTrace();
                   DBConn=null;
         public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException
                   String user_id,FirstName,LastName, Email, Login, Password;
              FirstName = req.getParameter("FirstName");
              LastName = req.getParameter("LastName");
              Email = req.getParameter("Email");
              Login = req.getParameter("Login");
              Password = req.getParameter("Password");
              PrintWriter output = res.getWriter();
              res.setContentType("text/html");
              if (user_id.equals("")||
              FirstName.equals("") ||
                   LastName.equals("") ||
                   Email.equals("") ||
                   Login.equals("") ||
                   Password.equals(""))
                        output.println("<H3>Please click back " + "button and fill in all " + "fileds.</H3>");
                        output.close();
                        return;
                   boolean success = insertIntoDB("'" + FirstName + "','" + LastName + "','" + Email + "','" + Login + "','" + Password + "'");
                   if (success)
                        output.print("<H2>Thank You " + FirstName + " for registering.</H2>");
                        res.sendRedirect("file:///Register.html");
                   else
                        output.print("<H2>An error occured. " + "Please try again later.</H2>");
                        output.close();
              private boolean insertIntoDB(String stringtoinsert)
                   try
                        statement = DBConn.createStatement();
                        statement.execute("INSERT INTO Users(user_id,FirstName,LastName,Email,Login,Password) values (" + stringtoinsert + ");");
                        statement.close();
                   catch (Exception e)
                        System.err.println("ERROR: Problems with adding new entry");
                        e.printStackTrace();
                        return false;
                   return true;
              public void destroy()
                   try
                        DBConn.close();
                   catch(Exception e)
                        System.err.println("Problem closing the database");
    Your Help will be very much appreciate.I am using SQL Server database

    The error concerns these two lines:
    boolean success = insertIntoDB("'" + FirstName + "','" + LastName + "','" + Email + "','" + Login + "','" + Password + "'");
    statement.execute("INSERT INTO Users(user_id,FirstName,LastName,Email,Login,Password) values (" + stringtoinsert + ");");
    In the first line above, you have a string which represents the VALUES which you are inserting. There are 5 values. However in the second line above this is your actual SQL execution you are specifying 6 columns of data. If the column "user_id" is an identity or auto-incrementing field in the database, just remove it from this line. If not then you need to supply the "UserID" into the VALUES.
    This should fix the problem.

  • Find record insert date and time in a table

    Hi All,
    I want to get record insert date and time in a table. There is no datetime column in my table. Are there any possibility to get date and time for each record?
    Thank You

    Thats not easy. If your transaction info still resides on active portion of the log you can use fn_dblog to read out the time at which the transactions occurs. This is useful only if you try it shortly after transaction.
    the code would look like this
    SELECT *
    FROM fn_dblog(null,null)
    WHERE [Transaction Name] LIKE 'INSERT%'
    OR [Transaction Name] LIKE 'UPDATE%'
    Also see
    http://www.mssqltips.com/sqlservertip/3076/how-to-read-the-sql-server-database-transaction-log/
    http://solutioncenter.apexsql.com/read-a-sql-server-transaction-log/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • I want to use the SQL query IF EXIST to update or insert data in a ms access table, but it doesn´t work

    Hi,
    I want to use the SQL query IF EXIST to update or insert data in a ms access table, but it doesn´t work
    (fault number -2147217900)
    I want to search for a value in a ms access table , if it exist i want to update it, if not i want to insert a new row.
    Working with LabView 7.1, database con. toolset.
    Who can HELP?
    Thanks a lot
    Marco

    Hello,
    I think that If exist is not a standar SQL command (I know it exists I think in Oracle and SQL server), MS access doesn't support it, so I think the best way to do it is first make a Select and then either an Update or an insert, sorry...
    Paulo

  • *HOW TO INSERT DATA MANUALLY INTO A BW TABLE*

    Dear experts,
    I'm working in BW 3.5 version.
    Since I need to test some tables which are going to be load manually, please could anyone explain me which are the steps to insert data manually into a BW table.
    Thank you very much in advance,
    Jorge

    Hi Jorge,
    You can maintain the TMG(Table maintenance generator) and then enter the data manually. TMG creation Tcode is se55. and to view and maintain TMG it is sm30 .
    Or if you have the data in excel. You can write a simple excel uploading ABAP program which will load your excel data to the table .
    Hope the above reply was helpful.
    Thanks & Regards,
    Ashutosh Singh
    Edited by: Ashutosh Singh on Apr 30, 2011 6:45 AM

  • Table Operator Vs Materialized View Operator

    Hi All,
    Could you please give the differences between Table Operator and Materialized view Operator in Oracle Warehouse Builder 11g.
    Regards,
    Subbu

    Below an extract of my notes of the Materialized view. The complete notes are here :
    http://gerardnico.com/wiki/dw/aggregate_table
    =====Notes=====
    Materialized views are the equivalent of a summary table. (Materialized views can be also use as replica).
    In a olap approach, each of the elements of a dimension could be summarized using a hierarchy.
    The end user queries the tables and views in the database. The query rewrite mechanism in a database automatically rewrites the SQL query to use this summary tables.
    This mechanism reduces response time for returning results from the query. Materialized views within the data warehouse are transparent to the end user or to the database application.
    This is relatively straightforward and is answered in a single word - performance. By calculating the answers to the really hard questions up front (and once only), we will greatly reduce the load on the machine, We will experience:
    * Less physical reads - There is less data to scan through.
    * Less writes - We will not be sorting/aggregating as frequently.
    * Decreased CPU consumption - We will not be calculating aggregates and functions on the data, as we will have already done that.
    * Markedly faster response times - Our queries will return incredibly quickly when a summary is used, as opposed to the details. This will be a function of the amount of work we can avoid by using the materialized view, but many orders of magnitude is not out of the question.
    Materialized views will increase your need for one resource - more permanently allocated disk. We need extra storage space to accommodate the materialized views, of course, but for the price of a little extra disk space, we can reap a lot of benefit.
    Also notice that we may have created a materialized view, but when we ANALYZE, we are analyzing a table. A materialized view creates a real table, and this table may be indexed, analyzed, and so on.
    Success
    Nico

  • Inserting Blob over db link issue

    Hi,
    We have a customer who has a db link which links from a 9.2.0.5.0 oracle database to a 10.2.0.2.0 oracle database. We also have the exact same setup here internally (9.2.0.5.0 -> 10.2.0.2.0). The issue is that when we try to do a SELECT FROM table (INSERT INTO table@dblink); on our customers system the row is inserted correctly apart from one column which is of type BLOB. No errors are raised but the content of the BLOB field is always empty, all other fields are inserted correctly.
    When we try the same thing on our system internally, the BLOB inserts across the db link fine. To add further complication on both our system and our customers system we can successfully select blob content from the 10g database to the 9i database with no problems.
    It appears that the problem is only when inserting from the 9i database to the
    10g database, and only on our customers system. We cannot replicate this issue.
    This has always worked on our system, we have only ever had brief intermittent
    success with their system and we don't know why.
    Has anyone had similar experiences or problems when using dblinks and blobs?
    Does anyone know if we can enable debug/trace in a way such that it will capture the unsuccessful BLOB insert?
    Could there potentially be any additional contributing factors, or operating system/network related influences that are preventing the BLOB data from being inserted?
    If anybody has any relevant answers to any of these questions we would really appreciate it.
    Thanks in advance,
    Lee.

    Hi, could anyone help me with this?

  • Error Inserting Data from Procedure ODI 11g (No data)

    Hi everyone!
    I have a problem inserting data from a procedure, the procedure works "fine" (no errors), on the log counter shows the number of rows inserted, but, on the database rows does not exists, an easy sample is:
    TARGET: ORACLE
    insert into table_t
    (desc)
    values
    (:description)
    SOURCE: ORACLE
    select description from table_s
    I check (ODI), the conection (works fine), modules (works fine), "select from table" (works fine).
    I check (Database), inserting rows direct (works fine).
    What can i check?
    Thanks for your response.

    Hi
    Try below 2 things
    First
    In target:oracle
    insert into table_t
    (desc)
    values
    ('#descpt');
    Second
    In target:oracle
    insert into table_t
    (desc)
    values
    ('#Proc_Var');
    Note: For alias name (*descpt* ) or Project variable (*Proc_Var*) with # symbol and single quotes
    Regards,
    Phanikanth

  • How can I Insert data into my msaccess Database table

    Hello all,
    I am new to Java programming and I have problem that how can i insert name into my database table.
    The code which i have written is following:
    String filename = "d:/test.mdb";
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    database+= filename.trim() + ";DriverID=22;READONLY=true}";
    Connection con = DriverManager.getConnection(database,"","");
    String s = String.valueOf(text.getText());
    int k =10;
    Statement st = con.createStatement();
    st.execute("create table Test123(name text)");
    st.execute("INSERT INTO Test123 values" +s);
    on the INSERT program throws exception???
    can any one help me how to insert data into tabel.
    Thanks

    he INSERT program throws exception???
    can any one help me how to insert data into tabel.I have never used the jdbc driver to access, but what do you think that the flag READONLY=true means? An insert is not a read.
    Kaj

  • How can I insert data into the standard CRM tables ?

    Hi Experts,
    Scenario----
    I need to download few attributes (fields) from SAP MDM to SAP CRM via SAP XI. I'm using the 'COMT_PRODUCT_MAINTAIN_API' API for it.
    The attributes(fields) that are present in the strucutres of API are downloaded into CRM system (by executing the Inbound proxy that is created based on the Message Interface created on XI) by calling the functions present in the API.
    And for those fields that are not present in CRM, but need to be downloaded into CRM, I'm creating the Set Type attributes in CRM, which get appended to the API.
    My query is:
    There are fields in CRM into which I need to insert the values. But they are not listed in the API. So, how can I insert(/download) the values into these standard fields?
    Regret the long description. Intended to be clear.
    TIA. Points will be awarded.
    Regards,
    Kris
    Edited by: Kris on Jul 21, 2008 8:00 AM

    he INSERT program throws exception???
    can any one help me how to insert data into tabel.I have never used the jdbc driver to access, but what do you think that the flag READONLY=true means? An insert is not a read.
    Kaj

  • Can select from table across db link but cannot create a materialized view

    dblink1 is a private db link (it could also be public)
    select count(*) from t1@dblink1;
    -->
    COUNT(*)
    5276
    create materialized view v1 as
    select * from t1@dblink1;
    -->
    select * from t1@dblink1;
    ERROR at line 2:
    ORA-00942: table or view does not exist
    This only applies to this particular db link. For another db link called "dblink2",
    create materialized view v2 as
    select * from t2@dblink2;
    -->
    Materialized view created.
    What gives? dblink1 and dblink2 are 2 different databases on 2 different machines.

    This is the simplest cause:
    dblink2 points to a database that has not a t1 table (as the message says, the table does not exist)
    This is the following simple cause:
    dblink2 uses a remote user user2, that can not select the t1 table because it exist in another schema, and user2 has not a synonym to the table (post the result of a query over dba_db_links that shows the remote users). Database objects has name and schema. If the objects are in your own schema you dont need to write the schema name, nor if you has a synonym to the object. But if the table t1 is in another schema, and you write t1, it means user2.t1 and fail.
    I hope this helps
    Regards,
    Alfonso

  • Inserting into a base table of a materialized view takes lot of time.......

    Dear All,
    I have created a materialized view which refreshes on commit.materialized view is enabled query rewrite.I have created a materialized view log on the base table also While inserting into the base table it takes lot of time................Can u please tell me why?

    Dear Rahul,
    Here is my materialized view..........
    create materialized view mv_test on prebuilt table refresh force on commit
    enable query rewrite as
    SELECT P.PID,
    SUM(HH_REGD) AS HH_REGD,
    SUM(INPRO_WORKS) AS INPRO_WORKS,
    SUM(COMP_WORKS) AS COMP_WORKS,
    SUM(SKILL_WAGE) AS SKILL_WAGE,
    SUM(UN_SKILL_WAGE) AS UN_SKILL_WAGE,
    SUM(WAGE_ADVANCE) AS WAGE_ADVANCE,
    SUM(MAT_AMT) AS MAT_AMT,
    SUM(DAYS) AS DAYS,
    P.INYYYYMM,P.FIN_YEAR
    FROM PROG_MONTHLY P
    WHERE SUBSTR(PID,5,2)<>'PP'
    GROUP BY PID,P.INYYYYMM,P.FIN_YEAR;
    Please help me if query enable rewrite does any performance degradation......
    Thanks & Regards
    Kris

  • Is it possible to refresh the table from a Materialized view

    Hi,
    Is it possible to update the underlying table on which a Materialized view is created when some changes in a Materialized view is done.Is this reverse compatibility possible in Materialized View?
    Thanks in Advance,
    V.Dennis

    If you created the materialized view as UPDATEABLE then changes to it should automatically be relected in the underlying table. If this is not occurring I suggest you check the replication jobs. You probably have a stack of errors in DEFERROR.
    Cheers, APC

  • Altering a table in a materialized view environment

    Hello everybody!.
    My question is as simple as this:
    When I have a single master - multiple materialized views environment , and I want to alter the master table (usually adding a column) , how do I propagate the change to the materialized view sites ?
    In Oracle's documentation manuals it is written the process ONLY for the master sites.If I manually just alter the materialized views to the mat.views sites , the new columns DON'T take data from the master table!
    It would be very nice if someone could help me.
    Thanks everybody on advance!.
    Thanasis Avdis

    Hi,
    you must dorp and recreate materialized view.

Maybe you are looking for