Schema level

The one you suggest the steps of level schema statistics collection?

See the statistics of optimizer gathering in doc PL/SQl Packages and Types
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28419/d_stats.htm

There is a section for GATHER_SCHEMA_STATS procedures with an example
See table 127-43 GATHER_SCHEMA_STATS procedure parameters to the default values for each parameter

>
Examples

Apply a filter to the object list

The following example specifies that any table with the prefix "T" in the EXAMPLE of schema and any table in the SYS schema, if bland, statistics collected on him.

DECLARE
filter_lst, DBMS_STATS. OBJECTTAB: = DBMS_STATS. OBJECTTAB();
BEGIN
filter_lst.extend (2);
filter_lst (1) .ownname: = "SAMPLE";
filter_lst (1) .objname: = '% t';
filter_lst (2) .ownname: = "SYS."
DBMS_STATS. GATHER_SCHEMA_STATS (NULL, obj_filter_list,-online filter_lst,
options of-online 'gather_stale');
END;
>
You have any specific questions?

Tags: Database

Similar Questions

  • Syntax to create the Type of registration at the schema level.

    Hello

    Could you let me know the syntax to create the type of registration at the schema level.

    I tried to help below.

    create or replace

    TYPE "SR_TBL_TYPE" AS THE SR_REC_TYPE TABLE;

    ----------------------------------------------------------------------------------------------------------------

    create or replace

    BODY OF TYPE 'SR_REC_TYPE' AS

    CONSTRUCTOR FUNCTION SR_REC_TYPE RETURN SELF AS RESULT

    IS

    BEGIN

    task_status: = NULL; -jtf_task_statuses_tl. Name % type

    task_type: = NULL; -jtf_task_types_tl. Name % type

    jt_new_res_id: = NULL; --jtf_task_assignments_audit_b.new_resource_id%type

    jt_source_name: = NULL; --jtf_rs_resource_extns.source_name%type

    jt_sch_start_date: = NULL; -VARCHAR2 (50)

    jt_task_number: = NULL; --jtf_tasks_b.task_number%type

    jt_appointment_scheduled_agent: = NULL; --fnd_user.user_name%type

    cs_old_prblm_code: = NULL; --cs_incidents_audit_b.old_problem_code%type

    cs_problem_code: = NULL; --cs_incidents_audit_b.problem_code%type

    qa_scenario_estimate_rec: = qa_scenario_est_type();

    qa_recall_rec: = qa_recall_type();

    RETURN;

    END SR_REC_TYPE;

    PROCEDURE of MEMBER log_sr_rec_values (SELF IN SR_REC_TYPE)

    IS

    BEGIN

    NULL;

    END log_sr_rec_values;

    END;

    Thank you

    Could you let me know the syntax to create the type of registration at the schema level.

    You do not have - record types are PL/SQL. In SQL, you create OBJECT types. It works for me:

    create or replace TYPE AS OBJECT SR_REC_TYPE)
    task_status varchar2(1),--jtf_task_statuses_tl.name%TYPE
    task_type varchar2(1),--jtf_task_types_tl.name%TYPE
    jt_new_res_id varchar2(1),--jtf_task_assignments_audit_b.new_resource_id%TYPE
    jt_source_name varchar2(1),--jtf_rs_resource_extns.source_name%TYPE
    qa_scenario_estimate_rec emp_table_type,
    qa_recall_rec emp_table_type,
    CONSTRUCTOR FUNCTION SR_REC_TYPE RETURN SELF AS RESULT
    )
    /

    create or replace TYPE of BODY SR_REC_TYPE AS
    CONSTRUCTOR FUNCTION SR_REC_TYPE RETURN SELF AS A RESULT
    BEGIN
    Self.task_status: = null;


    Self.task_type: = null;
    Self.jt_new_res_id: = null;
    Self.jt_source_name: = null;
    Self.qa_scenario_estimate_rec: = emp_table_type();
    Self.qa_recall_rec: = emp_table_type();
    return;
    END;
    END;
    /

    create or replace TYPE SR_TBL_TYPE AS TABLE OF SR_REC_TYPE;

    See 'Definition and Implementing User-Defined constructors' in the object-relational doc

    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28371/adobjadv.htm#sthref751

  • Merits and demerits of the replication of schema-level and Table

    Hello

    We evaluate the streams for our needs of replication. We reproduce nearly 2000 two-way tables. Most of the tables are in a schema. The main schema has a few tables that are not replicated.

    Replicate us schema level? Or at the level of the table? What are the advantages and disadvantages?

    Replication of level schema included with a handful of exclusionary rules seems simpler.

    In water courses at the level of the tables as well as creating 2000 table rules in the beginning, add a new table to an existing configuration of streams, will require additional steps to stop capture/apply/spread, creating new rules for the new table and restart replication. However, it seems that level replication table offering flexibility in terms of group tables. We wanted to group tables about 10 groups of 20 to 300 tables in each group. Each group will have its own capture, propagate and apply. In this way, we can isolate large groups of those unimportant?

    Who is a better setup in terms of maneuverability, flexibility, parallelism and performance?

    Thank you.

    Hello Stargaze,

    OK, so I understand that the grouping is based on the type of transactions and its importance. In this case the grouping would help you in many ways such as:

    1. If you encounter a problem or a bug with one of the processes of capture/apply then the other groups would work fine. Therefore, you have the opportunity to shoot a game of capture, propagation and applies until solve you the problem.

    2. in case if you perform any load batch where the transaction will affect over 10000 + records then it is possible that you could get stuck at 'SUSPENDED for FLOW CONTROL' on any of the feed items. With different groups would give you more flexibility to solve this problem by activating and deactivating groups.

    For more information on this please check the following:

    Apply process is active, inactive, and just stopped in change application

    3. with the schema level replication even if you have the advantage of being simple and have fewer rules in the set of rules, you must consider the 2 points above before you implement it. You need to test both diagrams and tables with a typical load (simulation of the production) and need to identify potential problems in both. Some more points to consider:

    -apply the game patches 10.2.0.4 or at least 10.2.0.3
    -apply all the patches required streams (Note: 437838.1> on metalink)
    -follow the recommendations as indicated:
         Note: 418755.1 broadcast 10.2.0.x.x of recommendations
         Note: 335516.1 Performance of flow recommendations
    Note: 413353.1 10.2 best practices for streams in RAC environment

    Thank you
    Florent

  • Tablespace level export, import of schema level - is it possible?

    Hello

    If I have an export level DataPump tablespace (played to = < the tablespaces list > STORAGE space), it is possible to import only tables and dependent objects to a specific schema residing in exported tablespaces? DB version is 11.2.0.3.0. According to the documentation, it should be possible: http://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_import.htm#i1011943 : a schema import is specified using the SCHEMAS. Source can be a full, table, tablespace, or schema mode export dump file set or another database.  

    Perform a quick test seems, however, that it is not so:

    (1) source DB - I have two tablespaces (TS1, TS2) and two schemas (USER1, USER2):

    SQL > select nom_segment, nom_tablespace, segment_type, owner

    from dba_segments

    where owner in ("USER1", "User2");

    2 3

    OWNER NOM_SEGMENT SEGMENT_TYPE TABLESPACE_NAME

    ------ --------------- ------------------ ----------------

    USER1 UQ_1 INDEX TS1

    USER1 T2 TABLE TS1

    USER1 T1 TABLE TS1

    USER2 T4 TABLE TS2

    USER2 T3 TABLE TS2

    (2) I am not a tablespace level to export:

    Expdp system directory $ = dp_dir = ts1 tablespaces, ts2 dumpfile = test.dmp

    Export: Release 11.2.0.3.0 - Production on Fri Jul 11 14:02:54 2014

    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

    Password:

    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    Start "SYSTEM". "" SYS_EXPORT_TABLESPACE_01 ": System / * Directory = dp_dir tablespaces = ts1, ts2 dumpfile = test.dmp

    Current estimation using BLOCKS method...

    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

    Total estimation using BLOCKS method: 256 KB

    Object type TABLE_EXPORT/TABLE/TABLE processing

    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

    Object type TABLE_EXPORT/TABLE/CONSTRAINT/treatment

    Object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS of treatment

    . . exported "USER1". "" T1 "5,007 KB 1 lines

    . . exported "USER1". "" T2 "5,007 KB 1 lines

    . . exported "user2". "" T3 "5,007 KB 1 lines

    . . exported "user2". "" T4 "5,007 KB 1 lines

    Main table 'SYSTEM '. "' SYS_EXPORT_TABLESPACE_01 ' properly load/unloaded

    ******************************************************************************

    "(3) I'm trying to import only the objects belonging to User1 and I get the 'ORA-39039: schema '(' USER1')' expression contains no valid schema" error: "

    Impdp system directory $ = dp_dir patterns = USER1 dumpfile = test.dmp

    Import: Release 11.2.0.3.0 - Production on Fri Jul 11 14:05:15 2014

    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

    Password:

    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    ORA-31655: no data or metadata of objects selected for employment

    ORA-39039: pattern Expression "(' USER1')" contains no valid schema.

    (4) However, the dump file contains clearly the owner of the tables:

    Impdp system directory = dp_dir dumpfile = test.dmp sqlfile = imp_dump.txt

    excerpt from imp_dump.txt:

    -path of the new object type: TABLE_EXPORT/TABLE/TABLE

    CREATE TABLE "USER1". "" T1 ".

    ("DUMMY" VARCHAR2 (1 BYTE)

    )

    So is it possible to somehow filter the objects belonging to a certain pattern?

    Thanks in advance for any suggestions.

    Swear

    Hi swear,.

    This led a small survey of me I thought I was worthy of a blog in the end...

    Oracle DBA Blog 2.0: A datapump bug or a feature and an obscure workaround

    Initially, I thought that you made a mistake, but that doesn't seem to be the way it behaves. I've included a few possible solutions - see if one of them responds to what you want to do...

    See you soon,.

    Rich

  • Schema-level permissions

    Select * from dba_role_privs where in('SCHEMA1','SCHEMA2') dealer.

    DEALER GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE

    ------------------------------ ------------------------------           ------------                     ------------

    SCHEMA1                   CONNECT                                     NO                     YES

    SCHEMA1 RESOURCE NO YES

    SCHEMA1 SCHEDULER_ADMIN NO YES

    SCHEMA2                   CONNECT                                    NO                     YES

    SCHEMA2 SCHEDULER_ADMIN NO YES

    SCHEMA2 RESOURCE NO YES

    SCHEMA2                   DBA                                              NO                     YES

    I created a schema3 procedure. I am able to run the process of with on SCHEMA2 licensing, SCHEMA1 unable to carry out the procedure which is schema3 (after licensing it's possible).

    Can someone let me know what is the difference between SCHEMA1 and SCHEMA2.

    Please let me know if you need additional information.

    Hello

    Aswadhati NAG wrote:

    Select * from dba_role_privs where in('SCHEMA1','SCHEMA2') dealer.

    DEALER GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE

    ------------------------------ ------------------------------           ------------                     ------------

    SCHEMA1                   CONNECT                                     NO                     YES

    SCHEMA1 RESOURCE NO YES

    SCHEMA1 SCHEDULER_ADMIN NO YES

    SCHEMA2                   CONNECT                                    NO                     YES

    SCHEMA2 SCHEDULER_ADMIN NO YES

    SCHEMA2 RESOURCE NO YES

    SCHEMA2                   DBA                                              NO                     YES

    I created a schema3 procedure. I am able to run the process of with on SCHEMA2 licensing, SCHEMA1 unable to carry out the procedure which is schema3 (after licensing it's possible).

    Can someone let me know what is the difference between SCHEMA1 and SCHEMA2.

    Please let me know if you need additional information.

    It looks like schema2 a dba role.  Check out dba_sys_privs to see what system privilegeshave been given to this role:

    SELECT *.

    OF dba_sys_privs

    Dealer WHERE = "DBA".

    ORDER BY privilege;

    Normally, the dba role has the privilege system EXECUTE a PROCEDURE that allows the holder to perform any procedure in any schema, without explicit procedure privileges.

  • Moving all the newspapers and Materialized View at the schema level using the data pump in

    Hi Experts,

    Please help me on how I can exp/imp all materialized views andMV logs (as are some MVs) only the full scheme of other databases. I want to exclude everything else.

    Concerning
    -Samar-

    Using DBMS_METADATA. Create the following SQL script:

    SET FEEDBACK OFF
    SET SERVEROUTPUT ON FORMAT WORD_WRAPPED
    SET TERMOUT OFF
    SPOOL C:\TEMP\MVIEW.SQL
    DECLARE
        CURSOR V_MLOG_CUR
          IS
            SELECT  DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW_LOG',LOG_TABLE) DDL
              FROM  USER_MVIEW_LOGS;
        CURSOR V_MVIEW_CUR
          IS
            SELECT  DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW',MVIEW_NAME) DDL
              FROM  USER_MVIEWS;
    BEGIN
        DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE);
        FOR V_REC IN V_MLOG_CUR LOOP
          DBMS_OUTPUT.PUT_LINE(V_REC.DDL);
        END LOOP;
        FOR V_REC IN V_MVIEW_CUR LOOP
          DBMS_OUTPUT.PUT_LINE(V_REC.DDL);
        END LOOP;
    END;
    /
    SPOOL OFF
    

    In my case the script is saved as C:\TEMP\MVIEW_GEN. SQL. Now I will create a journal mview and mview in schema SCOTT and run the script above:

    SQL> CREATE MATERIALIZED VIEW LOG ON EMP
      2  /
    
    Materialized view log created.
    
    SQL> CREATE MATERIALIZED VIEW EMP_MV
      2  AS SELECT * FROM EMP
      3  /
    
    Materialized view created.
    
    SQL> @C:\TEMP\MVIEW_GEN
    SQL> 
    

    Run the C:\TEMP\MVIEW_GEN script. SQL generated a C:\TEMP\MVIEW queue. SQL:

      CREATE MATERIALIZED VIEW LOG ON "SCOTT"."EMP"
     PCTFREE 10 PCTUSED 30 INITRANS
    1 MAXTRANS 255 LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1
    MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "USERS" 
    
    WITH PRIMARY KEY EXCLUDING NEW VALUES;
    
      CREATE MATERIALIZED VIEW "SCOTT"."EMP_MV" ("EMPNO", "ENAME", "JOB", "MGR",
    "HIREDATE", "SAL", "COMM", "DEPTNO")
      ORGANIZATION HEAP PCTFREE 10 PCTUSED 40
    INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576
    MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE
    "USERS"
      BUILD IMMEDIATE
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
    
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE
    DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "USERS"
      REFRESH FORCE ON
    DEMAND
      WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
      USING ENFORCED
    CONSTRAINTS DISABLE QUERY REWRITE
      AS SELECT "EMP"."EMPNO"
    "EMPNO","EMP"."ENAME" "ENAME","EMP"."JOB" "JOB","EMP"."MGR"
    "MGR","EMP"."HIREDATE" "HIREDATE","EMP"."SAL" "SAL","EMP"."COMM"
    "COMM","EMP"."DEPTNO" "DEPTNO" FROM "EMP" "EMP";
                                   
    

    Now, you can run this on the database. You may need to adjust the tablespace and storage clauses. Or you can add more DBMS_METADATA. SET_TRANSFORM_PARAM calls to C:\TEMP\MVIEW_GEN. SQL to force DBMS_METADATA not to include the tablespace or / and the terms of storage.

    SY.

  • Table nested @ schema - level how to extract the first clue?

    Hello

    My version of oracle database: 11g

    I present to you the code here and here are the steps by which I created a table and theres a regular column to the number, but the 2nd column is a nested table.

    (1) create or replace type s_def_NT_DepEmployees is table of the varchar2 (100);

    2)

    create the table employees_NT_test

    (number of department_id

    c_of_s_def_NT_DepEmployees s_def_NT_DepEmployees)

    nested as NTs_c_of_s_def_NT_DepEmployees table c_of_s_def_NT_DepEmployees store

    (3) now, I inserted 2 records:

    insert into employees_NT_test values (1, s_def_NT_DepEmployees ('Rahul', 'Myra'));

    insert into employees_NT_test values (2, s_def_NT_DepEmployees ('Rashi', 'Gaurav'));

    (4) now get me this sql allows employees of department_id: 1

    Select column_value

    table (select c_of_s_def_NT_DepEmployees in the employees_NT_test where department_id = 1);

    Output:

    Rahul

    Myra

    Now my question: I want to just choose the first clue: IE: rahul (and not myra) and it should be compatible such that if I select the two departments I should get my output like:

    Department_id | employees

    1                    | Rahul

    2                    | Rashi

    PS: I am looking for a sql query, I hope I presented my question clearly, if there are doubts please let me know.

    Thanks in advance

    Rahul

    Now my question: I want to just choose the first clue: IE: rahul(and not myra) and should be consistent

    You can only do in a deterministic manner, given the current design.

    Unlike PL/SQL, SQL has no way to access the items in the collection of their indices.

    We can think about using ROWNUM (or ROW_NUMBER) in a subquery, but the SCOREBOARD operator and later join operations do not guarantee that the order will remain the same in the different calls.

    You must redefine the collection 's_def_NT_DepEmployees' as an array of objects, and this object would include an index attribute explicitly on which you can filter.

    The alternative is to create a function that takes the collection and the index for the arguments and returns the element at index - but even in this case I'm not sure that oracle could rebuild deterministically collection either.

    Why use a table nested at all?

  • Table schema level insert

    Could you please suggest what happens in the script below?

    User A user B

    Table T T

    Proc P1

    (insert into T values (...) ;)

    Proc P1 has execute priv on user B

    exec A.P1 ();

    If we execute the Proc P1 in diagram B, it will fill T table a or B?

    Hello

    It is based on the right of the author and the Summoner (AUTHID CURRENT_USER AS).

    By default the PROCEDURE executes with the right to DEFINE (who created the procedure and the laws on the only definers object)

    If we specify AUTHID CURRENT_USER in the procedure, then the one who executes the procedure, must act on the user object who invoked the procedure.

    In your case, if you specify authid clause in Proc P1 then it will fill table T which is this one, regardless of the user running it.

    See the link below:

    http://docs.Oracle.com/CD/B19306_01/AppDev.102/b14261/subprograms.htm#i18574

  • Enable auditing to the schema at the level

    Oracle 11g

    UNIX

    Hi DBAs,

    I'm trying to enable auditing on a schema for all of the Select statements / Insert shot of this schema objects.

    SQL > select Audit on abc_owner by access;

    Audit select on abc_owner by access

    *

    ERROR on line 1:

    ORA-00942: table or view does not exist

    From there, I understand that I'll have to talk about the objects of this scheme. But I have about 500 objects in this schema.

    Y at - it an option whereby I can enable auditing at the schema level?

    Thank you

    AKPT

    AKPT wrote:

    Hi guys,.

    What will be the reason behind this, this level of auditing schema type is not available?

    Thank you

    There is no because it is impossible to implement.

    for the sake of discussion say that could allow "audit schema level.

    Which must take place within the DB when a new object is created in this schema?

    How Oracle will remember that this new object must be audited & as well as the types of access?

  • Creating a collection of level schema using % ROWTYPE

    Hi all
    is it possible to create a record of the collection at the schema level using % ROWTYPE? I try to do this:
    SQL> create or replace type some_type is table of hr.employees%rowtype;
      2  /
    
    Warning: Type created with compilation errors.
    
    SQL> sho err
    Errors for TYPE SOME_TYPE:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    0/0      PL/SQL: Compilation unit analysis terminated
    1/31      PLS-00329: schema-level type has illegal reference to
          HR.EMPLOYEES
    I was complaining ' illegal reference to the hr.employees table (I used the hr sample schema).» Any ideas?

    Best regards
    Val

    Valerie Debonair wrote:

    is it possible to create a record of the collection at the schema level using % ROWTYPE? I have

    No. + % RowType + is a macro compiler of PL/SQL used by the PL/SQL engine to generate a record structure.

    The SQL engine does not support PL/SQL data types - just as the engine SQL does not support C/C++ or Java or c# data types.

    PL/SQL, however, integrates SQL - and if it supports all SQL data types. SQL is SQL SQL... it does not support the 3rd languages like PL/SQL or Java or C/C++.

    So if you want to have a definition that you specify, it must be a "pure" SQL data type (not PL/SQL). And this data type that results can be used in PL/SQL and C/C++ and Java, and so on.

  • Migration of level diagram GG?

    Our scheme has thousands of tables/indexes, etc.

    Can I use GG to migrate schema level?

    Yes, you can

    Please take a look here for some ideas

    http://gavinsoorma.com/2010/02/Oracle-GoldenGate-Tutorial-4-performing-initial-data-load/

    Be sure to mark your answers questions once you get your answer in order to clean up the forum.

    Greetings,
    NACEUR

  • schema tablespace

    Hello

    When we run schema level exp and imp is both users should have the same tables... ?

    Ex:

    User1 is to have default tablespace tbs1 and user2 with default tbs2 tablespace. Now if we make exp and imp from User1 to User2, the object moves to tbs2 or tbs1.

    Please clear my doubt.

    Thank you!

    899329 wrote:
    Hello

    When we run schema level exp and imp is both users should have the same tables... ?

    Ex:

    User1 is to have default tablespace tbs1 and user2 with default tbs2 tablespace. Now if we make exp and imp from User1 to User2, the object moves to tbs2 or tbs1.

    Please clear my doubt.

    Thank you!

    After 150 positions, you should know by now that its very important to mention your information 4-digit db version and the operating system as well as all positions. As for your question, how about shooting a session of import/export and check?

    Aman...

  • Trigger on Truncate statement with exception

    Hello

    I wrote a trigger to truncate at the schema level. Which works very well.

    But we can write the trigger in a way, so that I can exclude some specific tables. If the table name is like '% TMP', truncate table instructions should work.

    Can write to us in this way? I'm not sure.

    Could you please suggest?

    Maybe something like this can help you

    Declare
      v_error varchar2(250);
    begin
      For i IN (SELECT USERNAME UN FROM USER_USERS)
      LOOP
        execute immediate ('CREATE OR REPLACE TRIGGER TRG_'||I.UN||' BEFORE TRUNCATE ON SCHEMA
        BEGIN
          if ora_dict_obj_name not like ''%TMP'' then
            Raise_Application_Error(-20099, ''Cannot truncate any table in this Schema'');
          end if;
        END;
        ');
      END LOOP;
    END;
    /
    

    BTW what you want to achieve with your loop? There is only one line in user_users, the current user.

    It is perhaps best not to create triggers on the fly. Instead, I prefer to generate a script (create_trigger.sql) to do the same.

    You can check if it is ok before the race and you can save it in your project documentation.

  • Serving recyclbe sure bin?

    RDBMS Version: 11.2.0.4

    Platform: Oracle Linux 6.5

    Many of our Prod DBs have active recyclebin and we noticed that there are several items to the trash level schema and DB level basket.

    Question1. Is it safe emptying the trash (levels of schema and DB) in production? Besides the fact that I can't use the FLASHBACK DROP feature, are there other risks?

    Question2. If I purge recyclebin level DB, it will cover recyclebins schema level too. Right?

    1 - Yes its safe. No, there aren't any risks

    2 - the documentation explains it - https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9018.htm

  • Need help to identify the type of object in the loop of pl/sql

    Hello

    I need help to identify the Type of object declared beneath a procedure as shown below:

    I need to pass the parameter to the procedure as a TYPE of OBJECT and also refer to variables of Type Object in a loop

    create or replace type TEST_VALIDATION_REC is RECORD (order_num varchar2 (30),)

    number of inventory_item_id

    reserved_YN varchar2 (1).

    error_flag varchar2 (1).

    Error_message varchar2 (2000)

    );

    CREATE OR REPLACE TYPE VALD_TBL AS VARRAY (10000) OF TEST_VALIDATION_REC;

    PROCEDURE ADD_TO_ORD)

    p_lot_number_list IN VALD_TBL,

    p_ord_number IN Varchar2,

    p_user_id in NUMBER: = fnd_profile.value ('USER_ID'),-change 1.10

    p_responsibility_id in NUMBERS: = fnd_profile.value ('RESP_ID'),-change 1.10

    p_application_id IN VARCHAR2: = 'PO',-change 1.10

    x_error_flag OUT Varchar2,

    x_error_msg OUT Varchar2

    )

    In the above procedure, I had the VALD_TBL. Is it OK?

    And how in the loop if the records if I use:

    FOR indx1 IN 1.p_lot_number_list. COUNTY

    LOOP

    BEGIN

    SELECT

    inventory_item_id

    IN

    ln_item_id

    Of

    dummy_lot_tab

    WHERE

    lot_number = p_lot_number_list (indx1); - > how direct the item here?

    EXCEPTION

    WHILE OTHERS THEN

    ln_item_id: = NULL;

    END;

    Records are PL/SQL objects.  They are not the SQL objects.  You can create a SQL TYPE (schema level) as a collection (variable-tables only, tables nested).

    So therefore your first statement is syntactically incorrect

    CREATE OR REPLACE TYPE TEST_VALIDATION_REC IS RECORD
    (order_num VARCHAR2(30),
    inventory_item_id NUMBER,
    reserved_YN VARCHAR2(1),
    error_flag VARCHAR2(1),
    Error_message VARCHAR2(2000)
    );
    

    You must put in an anonymous PL/SQL block or the stored procedure

    DECLARE
    
       TYPE test_validation_rec IS RECORD
       (
        order_num VARCHAR2(30),
        inventory_item_id NUMBER,
        reserved_YN VARCHAR2(1),
        error_flag VARCHAR2(1),
        error_message VARCHAR2(2000)
       );
    
       TYPE vald_tbl iS VARRAY(10000) OF test_validation_rec;
    
       lv_tbl vald_tbl;
    
    BEGIN
    
       lv_tbl := vald_tbl();
      -- insert your code here 
    
    END;
    

Maybe you are looking for