Create Materialized View based on Results from LDAP Query

Hi -- I'm trying to create a materialized view based on results from an LDAP query. Unfortunately, it looks like a materialized view can't be created based on a stored procedure, which is where the LDAP results are obtained (using nested loops).
Does anyone have any idea how to do this without first kicking off a stored procedure that populates a temp table which would be used to create the materialized view? I'm trying to minimize the steps that the DBA's will need to go through when refreshing this new view.
Thanks,
~Christine

Can you give us more details about the stored procedure you're calling. It will help to know what parameters are involved and what data types they are.
Off the top of my head though it looks like, at the very least, you would need a stored function that calls the stored procedure. I don't think there is any way to call stored procedures from CREATE ... commands. If you're going to create a stored function anyway ... well, you might as well just create a procedure that inserts values into a regular table instead of fussing with functions and materialized views. You'll probably want to schedule your new procedure to run periodically since it sounds like you'll need the values refreshed from time to time.

Similar Messages

  • How to create materialized view based on a view?

    Hi,
    I hope this is not very far fetched idea.
    I have a very complex view and I would like to replicate it 'in place' that is I would like to make a materialized view that is based on this view complex view. I would like to use this materialized view (i.e table) to query data instead of using the original view, since it takes Oracle some 10-15 seconds to execute my query on the original view and I am not allowed to create indexes on most of the tables that are included in the original view.
    Can this be done?
    Best regards,
    Tamas Szecsy

    The best way to do this is to create a materialzed view based on the underlying code of the original view. If you don't have this handy, issue the following in sqlplus:
    select text
    from user_views
    where view_name = 'NAME_OF_VIEW'
    You can then cut and paste the sql statement into your create materialized view statement.
    Please note, you will probable have to set the long parameter to a higher value to reveal the complete statement for example:
    SQL> set long 2048

  • How to create materialized view based on a synonym

    Hi all,
    I am trying to create simple materialized view based on a synonym and that synonym is pointing a view in other database (using dblink). I am getting table or view not found error . I am able to select synonym if i use select but not in materialized view. Please help me.
    Thanks,

    The best way to do this is to create a materialzed view based on the underlying code of the original view. If you don't have this handy, issue the following in sqlplus:
    select text
    from user_views
    where view_name = 'NAME_OF_VIEW'
    You can then cut and paste the sql statement into your create materialized view statement.
    Please note, you will probable have to set the long parameter to a higher value to reveal the complete statement for example:
    SQL> set long 2048

  • Create Materialized View  based on another database table using db link?

    SQL> SELECT sysdate
    2 FROM dual@CBRLINK ;
    SYSDATE
    21-NOV-12
    SQL> CREATE MATERIALIZED VIEW USERCBR.V_T24_COUNTRY1
    2 REFRESH COMPLETE
    3 START WITH SYSDATE NEXT SYSDATE + (5/24)
    4 AS
    5 SELECT sysdate
    6 FROM dual@CBRLINK ;
    CREATE MATERIALIZED VIEW USERCBR.V_T24_COUNTRY1
    ERROR at line 1:
    ORA-04052: error occurred when looking up remote object SYS.DUAL@CBRLINK
    ORA-00600: internal error code, arguments: [ORA-00600: internal error code,
    arguments: [qksfroFXTStatsLoc() - unknown KQFOPT type!], [0], [], [], [], [],
    ORA-02063: preceding line from CBRLINK

    It works for me:orcl>
    orcl> CREATE MATERIALIZED VIEW scott.V_T24_COUNTRY1
      2  REFRESH COMPLETE
      3  START WITH SYSDATE NEXT SYSDATE + (5/24)
      4  AS
      5  SELECT sysdate
      6  FROM dual@l1 ;
    Materialized view created.
    orcl> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for 32-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    orcl>so there is no problem with the code. HTH.

  • Create materialized view across dblink gets ORA-980?

    Hi!
    Oracle 9.2.0.5. Creating a materialized view on on a synonym that points to a table across a dblink. I am getting a ORA-980 error that synonym translation is no longer valid. However selecting against the same synonym returns the rows or the count, etc. What am I missing here?
    This is the code that is being run:
    create materialized view gxp_sc_item as select * from sc_item_db2;
    Hints, tips, ideas, etc. gratefully accepted!
    Dave Venus

    Hi!
    Thanks for the reply!
    Yes that is a solution, however why does the synonym work for everything else? I can't find anything that says this should not work.
    Yes running 9.2.0.8 would be my first choice. The application vendor does not certify anything higher than 9.2.0.5.
    Thanks!
    Dave Venus

  • Can I create Materialized View base on a view?

    Dear all,
    I has a view named view01 base on scott.emp. Can I create Materialized View base on view01? How to do it.
    please help me.

    Yes, you can :
    create materialized view my_mview as select * from scott.view01;
    Of course this is the simplest syntax. You may want to add options, depending on the refresh mode and other things. For a complete documentation see
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_6002.htm#sthref4967

  • Problems in creating Materialized View from 10g R2  to 11g

    Hi,
    We have two databases in 10g Release 2. These databases are on two different servers and we use
    Materialized views to replicate data between these servers. We are currently using 64 bit version of
    oracle 10g release 2 for LINUX.
    Oracle Database 10g Release 10.2.0.1.0 - 64 bit Production
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    We use CENTOS 5 - 64 bit edition
    We upgraded one of the databases to 11g (We exported the data from old database and
    imported it in new database) . Then we tried to create a Materialized view with incremental refresh
    on it where the base table is in the second Oracle 10g database.
    The problem is that it is not letting us create the view with FAST Refresh. It kept on giving ORA-12028
    error. We tried different remedies suggested on forums like creating a view with ROWID, but still it
    continued giving us the same error. We also synchronized the characterset of Oracle 10g and Oracle 11g
    installations but still it did not work.
    Our base table size is pretty large (over 10 Million records) and if we do a full refresh, it takes hours to
    refresh it.
    Without incremental refresh, we will not be able to fucntion, and to upgrade both database simultaneously
    we will need a large down-time which also we can not afford.
    Please advise what should we do.
    Best Regards
    Madhup
    Edited by: Madhup on Mar 2, 2009 10:45 AM

    Hello,
    Yesterday I met the same problem and very sad about this, however, my story is much more complicated (I think so).
    I have 6 databases:
    2 - 11g
    2 - 10g
    2 - 9i
    Every database of each release has different characterset(UTF8 and AL16UTF16).
    I am trying to create Materialized view with FAST REFRESH on Oracle 11g, when master tables are located on 10g database and 9i database.
    Materialized view, which points to 9i database, was successfully created.
    Materialized view, which points to 10g database, gets ORA-12028
    Like you, I tried many notes from METALINK and thought at the begining that the problem is my characterset. But, when the materialized views were successfully built on Oracle 9i database, I understood that the problem is something else.
    Did you find the actual reason why this issue does not work??
    Thanks,
    Alex

  • Create materialized view from Designer9i

    Is there a way to create a materialized view from Oracle Designer 9i that will that have a header that look like this :
    CREATE MATERIALIZED VIEW XXXXXXXXX
    REFRESH COMPLETE ON DEMAND WITH PRIMARY KEY
    Instead of this :
    CREATE MATERIALIZED VIEW XXXXXXXXX
    REFRESHWITH ROWID
    Thanks
    Jérôme

    yes.
    as long as you have the privilege.
    but be careful, it may causing locking issue in the SQL Server side.

  • Error on creating Materialized view.

    Hi,
    I don't understand why it happens...
    When I tried to creating materialized view, it shows a error "ORA-01013: User requested cancel of current operation".
    I don't understand why it happens. I just waited it successfully created. But I didn't press any button.
    Does it matter of size of joining table? I had same issue before. At that time I just removed some tables from the joining condition, this error was gone.
    But at this time, I cannot exclude any other tables the select statement
    Can anyone help me this issue, please?

    Hi,
    11g ( 11.2.0.3 ) has a problem with materialized views based on ROWID, resulting in the problem you mentioned.
    A workaround is creating the MV's based on primary keyl.
    There is also a patch available on MOS, to solve the problem ( thanks to a very long SR from me :-) )
    It is known as bug 13657605 and the patch for it has the same number.
    Remember to read the README, as this patch is only for 11.2.0.3 !!
    Cheers
    FJFranken

  • Is it possible to create materialized view log file for force refresh

    Is it possible to create materialized view log file for force refresh with join condition.
    Say for example:
    CREATE MATERIALIZED VIEW VU1
    REFRESH FORCE
    ON DEMAND
    AS
    SELECT e.employee_id, d.department_id from emp e and departments d
    where e.department_id = d.department_id;
    how can we create log file using 2 tables?
    Also am copying M.View result to new table. Is it possible to have the same values into the new table once the m.view get refreshed?

    You cannot create a record as a materialized view within the Application Designer.
    But there is workaround.
    Create the record as a table within the Application Designer. Don't build it.
    Inside your database, create the materialized with same name and columns as the record created previously.
    After that, you'll be able to work on that record as for all other within the Peoplesoft tools.
    But keep in mind do never build that object, that'll drop your materialized view and create a table instead.
    Same problem exists for partitioned tables, for function based-indexes and some other objects database vendor dependant. Same workaround is used.
    Nicolas.

  • Create Materialized View with GROUP BY

    I have a table
    treecluster NUMBER(3)
    treenumber NUMBER(3)
    treedate DATE
    nestnumber NUMBER(3)
    eggs NUMBER(3)
    nestlings NUMBER(3)
    fledglings NUMBER(3)
    nestfate VARCHAR2(10)
    nestfailurecode NUMBER(2)
    I want to group the data by treecluster, treenumber, year, and nest number and get a max eggs, nestlings, fledglings. I am doing this with the following:
    SELECT treecluster, treenumber, to_char(nestchecksdate, 'YYYY'), nestnumber,
    max(eggs), max(nestlings), max(fledglings)
    FROM nestchecks
    GROUP BY treecluster, treenumber, to_char(nestchecksdate, 'YYYY'), nestnumber;
    This works fine.
    The last record for a year has a nestfate and nestfailurecode value.
    I need to group all information and then also get the nestfate and nestfailurecode for the year. How do I go about getting this information?
    I am really trying to create a summary materialized view based on a data table so the select I am trying to craft would be a part of a create materialized view as SELECT...
    so I want to be able to group the info and add in the nestfate and failurecode in one step.
    Thanks!

    try this:
    SQL> select * from table_tree;
    TREECLUSTER TREENUMBER NESTCHECK NESTNUMBER       EGGS  NESTLINGS FLEDGLINGS NESTFATE   NESTFAILURECODE
              4        167 17-MAY-00          2          0          0
              4        167 24-MAY-00          2          3          0
              4        167 30-MAY-00          2          3          0
              4        167 12-JUN-00          2          0          1            FAILURE                  2
    select a.treecluster, a.treenumber, to_char(a.nestyear,'YYYY') nestyear,
           a.nestnumber, a.eggs, a.nestlings, a.fledglings, a.nestfate, a.nestfailurecode
    from   (select max(treecluster) treecluster, max(treenumber) treenumber,
                   max(nestchecksdate) nestyear,
                   max(nestnumber) nestnumber, max(eggs) eggs, max(nestlings) nestlings,
                   nvl(max(FLEDGLINGS),0) FLEDGLINGS, max(NESTFATE) NESTFATE,
                   max(nestfailurecode) nestfailurecode
            from table_tree) a
    TREECLUSTER TREENUMBER NEST NESTNUMBER       EGGS  NESTLINGS FLEDGLINGS NESTFATE   NESTFAILURECODE
              4        167 2000          2          3          1          0 FAILURE                  2hope this helps

  • Create materialized view with specific column sizes

    Hi all,
    I'm trying to create a materialized view with a specific a column size. Something like
    create materialized view test_mv
    refresh force on demand
    as
    select id,
           cast(my_compound_field as nvarchar2(50))
    from ( select id,
                  field1 || field2 my_compound_field
           from   my_table);But Oracle seems to ignore the cast and takes the maximum size it finds for field1 || field2 in the select query. The resulting table has a column nvarchar2(44) instead of nvarchar2(50).
    This can give a problem when the view is refreshed... there could be new data that exceeds the current size, i.e. where length(field1 || field2) > 44.
    How can I override the column size of a field in a materialized view?
    Edit: Some additional info to clarify my case:
    field1 and field2 are defined as nvarchar2(25). field1 || field2 can theoretically have a length of 50, but there is currently no data in my table that results in that length, the max is 44. I am afraid that there will be data in the future that exceeds 44, resulting in an error when the MV is refreshed!
    Edited by: Pleiadian on Jan 25, 2011 2:06 PM

    Cannot reproduce what you are saying is happening.
    SQL> create table t (a nvarchar2(50), b nvarchar2(50));
    Table created.
    SQL> create materialized view tmv as
      2  select a, b, a || b c from t;
    Materialized view created.
    SQL> desc tmv
    Name                                      Null?    Type
    A                                                  NVARCHAR2(50)
    B                                                  NVARCHAR2(50)
    C                                                  NVARCHAR2(100)
    SQL> drop materialized view tmv;
    Materialized view dropped.
    SQL> create materialized view tmv as
      2  select a, b, substr(a || b, 1, 10) c from t;
    Materialized view created.
    SQL> desc tmv
    Name                                      Null?    Type
    A                                                  NVARCHAR2(50)
    B                                                  NVARCHAR2(50)
    C                                                  NVARCHAR2(10)
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    SQL>Edited by: 3360 on Jan 25, 2011 8:10 AM
    And with data
    SQL> insert into t values ('3123423423143hhshgvcdcvw', 'ydgeew  gdfwe   dfefde  wfjjjjjjj');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> desc tmv
    Name                                      Null?    Type
    A                                                  NVARCHAR2(50)
    B                                                  NVARCHAR2(50)
    C                                                  NVARCHAR2(10)
    SQL> select * from tmv;
    A
    B                                                  C
    3123423423143hhshgvcdcvw
    ydgeew  gdfwe   dfefde  wfjjjjjjj                      3123423423

  • Create a view based on a public synonym

    Hi I'm trying to create a view based on a public synonym, but getting "ORA-01031: insufficient privileges" error.
    When i retrieve records from the same public synonym, i could able to do so. But when i try to create a view based on that synonym, it is not possible. Why is it? Can anyone please explain?
    11:58:04 IT00053.it0053@SCOTT> connect sys as sysdba
    Enter password: ******
    Connected.
    11:58:14 IT00053.it0053@SYS> create role general_user_role;
    Role created.
    Elapsed: 00:00:00.14
    11:58:33 IT00053.it0053@SYS> connect scott
    Enter password: *****
    Connected.
    11:58:41 IT00053.it0053@SCOTT> select * from tab;
    TNAME TABTYPE CLUSTERID
    DEPT TABLE
    EMP TABLE
    BONUS TABLE
    SALGRADE TABLE
    DEPT_TAB SYNONYM
    Elapsed: 00:00:00.01
    11:58:47 IT00053.it0053@SCOTT> create public synonym scott_emp for scott.emp;
    Synonym created.
    Elapsed: 00:00:00.06
    11:59:14 IT00053.it0053@SCOTT> grant select on scott_emp to general_user_role;
    Grant succeeded.
    Elapsed: 00:00:00.14
    11:59:35 IT00053.it0053@SCOTT> connect sys as sysdba
    Enter password: ******
    Connected.
    12:00:13 IT00053.it0053@SYS> create user beginning_user
    12:00:31 2 identified by beginning_user
    12:00:38 3 default tablespace users
    12:00:45 4 temporary tablespace temp;
    User created.
    Elapsed: 00:00:00.04
    12:00:53 IT00053.it0053@SYS> grant connect, resource, create table, create view to beginning_user;
    Grant succeeded.
    Elapsed: 00:00:00.01
    12:01:13 IT00053.it0053@SYS> grant general_user_role to beginning_user;
    Grant succeeded.
    Elapsed: 00:00:00.01
    12:01:35 IT00053.it0053@SYS> connect beginning_user/beginning_user
    Connected.
    12:01:49 IT00053.it0053@SYS> connect beginning_user
    Enter password: **************
    Connected.
    12:02:01 IT00053.it0053@SYS> show user
    USER is "BEGINNING_USER"
    12:02:06 IT00053.it0053@SYS> select * from scott_emp;
    EMPNO ENAME JOB MGR HIREDATE SAL
    COMM DEPTNO
    7369 SMITH CLERK 7902 17-DEC-80 800
    20
    7499 ALLEN SALESMAN 7698 20-FEB-81 1600
    300 30
    7521 WARD SALESMAN 7698 22-FEB-81 1250
    500 30
    7566 JONES MANAGER 7839 02-APR-81 2975
    20
    7654 MARTIN SALESMAN 7698 28-SEP-81 1250
    1400 30
    7698 BLAKE MANAGER 7839 01-MAY-81 2850
    30
    7782 CLARK MANAGER 7839 09-JUN-81 2450
    10
    7788 SCOTT ANALYST 7566 19-APR-87 3000
    20
    7839 KING PRESIDENT 17-NOV-81 5000
    10
    7844 TURNER SALESMAN 7698 08-SEP-81 1500
    0 30
    7876 ADAMS CLERK 7788 23-MAY-87 1100
    20
    7900 JAMES CLERK 7698 03-DEC-81 950
    30
    7902 FORD ANALYST 7566 03-DEC-81 3000
    20
    7934 MILLER CLERK 7782 23-JAN-82 1300
    10
    14 rows selected.
    Elapsed: 00:00:00.21
    12:02:16 IT00053.it0053@SYS> create or replace view new_view_1 as select empno, ename, job from
    12:02:50 2 scott_emp;
    scott_emp
    ERROR at line 2:
    ORA-01031: insufficient privileges
    Why is this error?
    Your help will be much appreciated...
    Thanks and regards
    Muthu

    create any view privilege
    10:15:07 IT00053.it0053@SYS> connect sys as sysdba
    Enter password: ******
    Connected.
    10:22:27 IT00053.it0053@SYS>
    10:22:28 IT00053.it0053@SYS>
    10:22:28 IT00053.it0053@SYS> grant create any view to beginning_user;
    Grant succeeded.
    Elapsed: 00:00:00.00
    10:22:53 IT00053.it0053@SYS> connect beginning_user/beginning_user
    Connected.
    10:22:59 IT00053.it0053@SYS> create or replace view new_view_1 as select empno, ename, job from scot
    t_emp;
    create or replace view new_view_1 as select empno, ename, job from scott_emp
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ---> Same result
    But When creating a view, the owner must have granted the select directly.
    10:23:08 IT00053.it0053@SYS> connect scott/tiger
    Connected.
    10:25:43 IT00053.it0053@SCOTT> grant select on scott_emp to beginning_user;
    Grant succeeded.
    Elapsed: 00:00:00.07
    10:26:14 IT00053.it0053@SCOTT> connect beginning_user/beginning_user
    Connected.
    10:26:19 IT00053.it0053@SCOTT> create or replace view new_view_1 as select empno, ename, job
    10:26:25 2 from scott_emp;
    View created.
    Elapsed: 00:00:00.03
    This works. Thanks a lot for your timely help.
    danke shun herr bochum. thanks to mr.ankara

  • Create Materialized View question

    Hi all,
    I have a question about MV.
    Toad creation wizard of a new snapshots (materialized view) on "Refresh Info" tab I set
    Refresh mode: complete On demand
    With: ROWID (I can't use primary key because on my table there isn't PK)
    Writing teh query, next the Materialized View is successfully created and this is a toad script:
    CREATE MATERIALIZED VIEW ASDF
    TABLESPACE USERS
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH COMPLETE ON DEMAND
    WITH PRIMARY KEY
    AS
    select CDA_PART, DES_PART, DES_MAT, CDA_APPART, CDA_PROVEN
    from ldanapr01
    where dat_end>(sysdate-1);Why is specified WITH PRIMARY KEY if I created the view with ROWID option?
    Indeed if a drop a MV and directly run the create VM script above obtain error ORA-14012 table 'LDANAPR01' does not contain a primary key constraint.
    So, if I modify the script in this way
    CREATE MATERIALIZED VIEW ASDF
    TABLESPACE USERS
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH COMPLETE ON DEMAND
    WITH ROWID
    AS
    select CDA_PART, DES_PART, DES_MAT, CDA_APPART, CDA_PROVEN
    from ldanapr01
    where dat_end>(sysdate-1);the MV is successfully created!!
    What is difference between WITH PRIMARY KEY and WITH ROW ID... and why Toad show always the created MV script as WITH PRIMARY KEY ?

    >
    WITH PRIMARY KEY is used to create a primary key materialized view i.e. the materialized view is based on the primary key of the master table instead of ROWID (for ROWID clause). PRIMARY KEY is the default option. To use the PRIMARY KEY clause you should have defined PRIMARY KEY on the master table or else you should use ROWID based materialized views.
    Primary key materialized views allow materialized view master tables to be reorganized without affecting the eligibility of the materialized view for fast refresh.
    Rowid materialized views should have a single master table and cannot contain any of the following:
    * Distinct or aggregate functions
    * GROUP BY Subqueries , Joins & Set operations
    source : http://www.dbasupport.com/oracle/ora9i/mat_views2.shtml

  • CREATE MATERIALIZED VIEW LOG ON / SNAPSHOT LOG ON

    HI,
    Is there any difference between create materialized view log on and creat snapshot on.
    Did some googling, found out that: A snapshot log is a table associated with
    the master table of a snapshot and Is used for refresh the master table\'s snapshots.
    Materialized view log is a table associated with the master table of a materialized view. Seem like the same.
    By the way, are these tables important? Will my database function as normal without these view log.
    regards,
    becks

    Where did you pick up this syntax from ?
    The MV Log that will be created on DOCUMENT will be called MLOG$_DOCUMENT.
    So, the correct syntax is :
    create materialized view log on DOCUMENT with primary key;this will create a "table" called MLOG$_DOCUMENT which serves as the Materialized View Log on the real table called DOCUMENT. This will allow you to create one or more Materialized Views based on DOCUMENT, which can be fast refreshed because of the presence of the MV Log. For example :
    create materialized view MV_DOCUMENT refresh fast on demand as select DOC_ID, DOC_DATE from DOCUMENT;(i.e. assuming you want an MV that has only two columns from the table DOCUMENT.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

Maybe you are looking for

  • Write access to External Drives

    I am a brand new Apple user and am having some problems with my external drives. It seems I only have read access to the drives when I plug in to my MacBook Pro. I have set myself up as Admin and have allowed myself to administer my computer, but I'm

  • Service Support for Note 3 International version N900/N9000, Can it be activated on Verizon Network?

    i have the international version for the Note 3 N900/N9000 Model and i want to know if it can be activated on Verizon

  • AirPlay mirroring issue after iOS 8.1 upgrade on iPhone 6

    I just purchased an Apple TV. When trying to mirror my iPhone 6 on iOS 8.1 to the tv, I get a black screen. If I reboot the iPhone I can use mirroring but it stops working if I disconnect from the Apple TV. My partners iPhone 5s on iOS 8.1 connects f

  • Downloading itune windows 8.1

    why am i having trouble downloading itunes on my Lenovo lap top and before i downloaded it but it wouldnt open

  • RTSP in AIR

    Hello everybody! I have one question. Is it possible to implement RTSP Server as AIR application (with using Flex) and RTSP Client as other AIR Application? This two app's will be runed on the same PC and one will act as Server and other as Client fo