2 Replies Latest reply: Aug 12, 2008 5:48 AM by gwilkinson RSS

    view snapshot

      can i make snapshot for a view created with multiple tables? what should i do? i still don't understand what is the function of base tables, when i should set the base tables? when i include a view in snapshot, must i include the tables which make it?
        • 1. Re: view snapshot
          If you create a view using several tables, you need to have column.table which can be use to create the virtual PK for the Publication item based on the view.
          Here an example:

          create view TEST as select dept.deptno, emp.empno from scott.departement dept, scott.employee emp

          In this simple example, you can use as base table scott.emp or scott.dept, as deptno and empno are their PK.

          • 2. Re: view snapshot
            If you want to create a snapshot/publication item based on a view then there are a few considerations

            1) as Marc said you will need a base table to derive the PK values from, and these will need to be unique otherwise you will get constrain violation errors coming from the out queue tables. The reason for this is that all publication items are actually created as tables on the client, no matter what they are on the server, and therefore need a valid PK value.

            2) when you publish the view based publication item, in the mobile server you should see a list of all of the tables the view is based on, not just the defined base table. If you are going to use fast refresh on the publication item, you need to make sure that all of the base tables are included as publication items within the same application, otherwise changes will not be loged and trigger the compose process. simplest way to do this if you do not want these tables on the client is to create them as fast refresh with a select statement of 'select * from table where 1=2'

            3) if the view is updateable, you will need to create instead of insert/update/delete triggers on the server side database in order to handle the data updates

            If you want a real view on the client database (as opposed to a replicated object), look at the use of the scripts to create local client side objects like views and sequences