DBMS_DDL.CREATE_WRAPPED

I have windows XP with 10.2.0.1.0
I am writing a store procedure, something as below, the purpose is wrapping the store procedure MY_TEST. How to do a select statement and return a string ?
DECLARE
package_text VARCHAR2(32767);
BEGIN
package_text := 'select text from all_source where name= ''MY_TEST'' and type = ''PACKAGE BODY'' order by line';
DBMS_DDL.CREATE_WRAPPED(package_text);
END;
Thanks

Check below link with clear explanation and code in action :
http://psoug.org/reference/dbms_ddl.html
More details @ http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_ddl.htm
Regards
Girish Sharma

Similar Messages

  • Determine wrapped objects in Oracle

    Hi,
    I am using a procedure which uses DBMS_DDL.CREATE_WRAPPED to wrap a few user_objects which are existing in the schema.
    I might need to run this procedure by different users and do not want to wrap the objects which are already wrapped.
    How can I know which are user_objects which are not wrapped/wrapped?
    Thanks,
    Sharmin

    Sharmin Jose wrote:
    How can I know which are user_objects which are not wrapped/wrapped?Well, there are no data dictionary views that show such info. However you can get it from data dictionary tables. Keep in mind data dictionary table structure is not documented, and therefore can change between versions:
    SQL> CREATE OR REPLACE PROCEDURE P_NOT_WRAPPED IS BEGIN NULL; END;
      2  /
    Procedure created.
    SQL> exec DBMS_DDL.CREATE_WRAPPED('CREATE OR REPLACE PROCEDURE P_WRAPPED IS BEGIN NULL; END;');
    PL/SQL procedure successfully completed.
    select  owner,
            object_name,
            case bitand(options,2) when 0 then 'NOT WRAPPED' else 'WRAPPED' end wrapped
      from  sys.procedure$,
            dba_objects
      where object_id = obj#
        and owner = USER
        and object_name in ('P_WRAPPED','P_NOT_WRAPPED')
    OWNER                          OBJECT_NAME                    WRAPPED
    SCOTT                          P_NOT_WRAPPED                  NOT WRAPPED
    SCOTT                          P_WRAPPED                      WRAPPED
    SQL> Another method would be looking for word wrapped in DBA_SOURCE. Something like:
    select  owner,
            name,
            case when regexp_like(UPPER(text),'^PROCEDURE ' || name || ' WRAPPED') then 'WRAPPED' else 'NOT WRAPPED' end wrapped
      from  dba_source
      where owner = USER
        and name in ('P_WRAPPED','P_NOT_WRAPPED')
        and line = 1
    OWNER                          NAME                           WRAPPED
    SCOTT                          P_NOT_WRAPPED                  NOT WRAPPED
    SCOTT                          P_WRAPPED                      WRAPPED
    SQL> SY.

  • Where do i see the results for dbms_ddl.analyze_object?

    hi All
    I executed the following procedure
    begin
    dbms_ddl.analyze_object('TABLE','OPS$MBPCONT1','IKS_STORAGE_SIGNED_CARDS','COMPUTE');
    end;
    And it executed successfully with result
    PL/SQL procedure successfully completed.
    Could you please let me know whree can i see the results?
    Thank you
    Poonam

    Hi,
    There will be an attribute named last_analyzed in user_tables and user_indexes . You could use this to find out whether the object is analyzed or not.
    Vijay

  • Dbms_ddl

    Hi all
    DBMS_DDL.ANALYZE_OBJECT is to analyze a single object. But i could not understand the meaning of analyzing an object. ??
    can somebody explain me?? what it do??

    COMPUTE - calculate statistic using all rows in a tabel (i.e you have 1 000 000 rows in a tabel all rows will be used to calculate statistics)
    ESTIMATE - use a sample of rows in a table to compute statistics, you can specify a sample by estimate_percent (i.e. 10 - you will use 10 percent of all rows in a table) or estimate_rows (i.e. 1000 means use 1000 of rows of your table to compute statistics)
    DELETE - deletes computed earlier statistic
    Best Regards
    Krystian Zieja / mob

  • Invalid objects in APEX Schemas after import.

    Hi,
    After importing the APEX_040100 user in the database I got several invalid objects that are causing APEX not to work.
    I gave up to compile them. After using all kind of tricks such as compile one schema at a time or compile all of them using the utlprp.sql script
    or using EXEC DBMS_DDL.alter_compile('PACKAGE', 'MY_SCHEMA', 'MY_PACKAGE');
    or one object art a time using command sililar to:
    ALTER PACKAGE my_package COMPILE;
    ALTER PACKAGE my_package COMPILE BODY;
    ALTER PROCEDURE my_procedure COMPILE;
    ALTER FUNCTION my_function COMPILE;
    ALTER TRIGGER my_trigger COMPILE;
    ALTER VIEW my_view COMPILE;
    I can't find any documentation to show how to recompile them properly.
    So I am asking:
    1. How can we recompile all objects in APEX?
    2. How can we re-install APEX?
    3. How can we revert to previous version if both have problems?
    Thanks
    Yannis
    Here is the list of invalid objects:
    APEX_040100     PACKAGE     WWV_FLOW_DYNAMIC_EXEC     INVALID
    APEX_040100     PACKAGE     WWV_FLOW_LOAD_DATA     INVALID
    APEX_040100     PACKAGE     WWV_FLOW_SAMPLE_APP     INVALID
    APEX_040100     PACKAGE     WWV_FLOW_UTILITIES     INVALID
    APEX_040100     PACKAGE BODY     APEXWS     INVALID
    APEX_040100     PACKAGE BODY     HTMLDB_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_4000_UI     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_ADMIN_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_ADVISOR     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_AJAX     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_APPLICATION_INSTALL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_ASFCOOKIE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_AUDIT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_AUTHENTICATION     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_AUTHENTICATION_ENGINE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_AUTHORIZATION     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_BUILDER     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_BUTTON     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_CALENDAR3     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_CALENDAR_AJAX     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_CHECK     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_COLLECTION     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_CONDITIONS     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_COPY_PAGE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_CREATE_APP_FROM_QUERY     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_CREATE_MODEL_APP     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_CSS_API_PRIVATE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_CUSTOM_AUTH     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_CUSTOM_AUTH_STD     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_DATALOAD_XML     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_DATA_QUICK_FLOW     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_DATA_UPLOAD     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_DICTIONARY     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_DISP_PAGE_PLUGS     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_DML     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_DOWNLOAD     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_DRAG_LAYOUT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_DYNAMIC_EXEC     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_ERROR     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_F4000_P4150     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_F4000_PLUGINS     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_F4000_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FILE_MGR     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FLASH_CHART     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FLASH_CHART2     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FLASH_CHART5     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FLASH_CHART5_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FLASH_CHART_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FND_DEVELOPER_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FND_USER_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FORMS     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_FORM_CONTROL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_GENERATE_DDL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_GENERATE_TABLE_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_GENERIC_ATTR     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_GEN_API2     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_HINT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_HTML_API_PRIVATE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_IMP_PARSER     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_INSTALL_WIZARD     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_INSTANCE_ADMIN     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_ITEM     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_JAVASCRIPT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_JOB     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_LANG     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_LDAP     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_LIST     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_LOAD_DATA     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_LOAD_EXCEL_DATA     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_LOGIN     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_MAIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_META_DATA     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_META_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_MODEL_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_NATIVE_AUTHENTICATION     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_NATIVE_DYNAMIC_ACTION     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_NATIVE_ITEM     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PAGE_CACHE_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PLSQL_EDITOR     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PLSQL_JOB     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PLUGIN_ENGINE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PLUGIN_F4000     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PLUGIN_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PPR_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PRINT_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PROCESS     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PROCESS_UTILITY     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PROVISION     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_PROVISIONING     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_QUERY_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_REGEXP     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_REGION_LAYOUT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_RENDER_QUERY     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_RENDER_SHORTCUT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_REST     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SAMPLE_APP     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SC_TRANSACTIONS     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SECURITY     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SERIES_ATTR     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SESSION     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SESSION_MON     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SVG     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SW_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SW_PAGE_CALLS     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SW_PARSER     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SW_SCRIPT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_SW_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_TABLE_DRILL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_TAB_MGR     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_TEAM     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_TEAM_GEN_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_TEMPLATES_UTIL     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_THEME_FILES     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_THEME_MANAGER     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_TREE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_TREE_REGION     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_UPGRADE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_UPGRADE_APP     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_UTILITIES     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_VALIDATION     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WEBSERVICES_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WEB_SERVICES     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WIZARD_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WIZ_CONFIRM     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WORKSHEET     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WORKSHEET_AJAX     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WORKSHEET_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WORKSHEET_DIALOGUE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WORKSHEET_EXPR     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WORKSHEET_FORM     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WORKSHEET_STANDARD     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WORKSPACE_REPORTS     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_ATTACHMENT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_DIALOG     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_EXPORT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_FLASH_CHART     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_FORM     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_GEOCODE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_IMPORT     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_IMPORT_API     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_SECURITY     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_SETUP     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_STICKIES     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_UI     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_WS_WEBPAGE     INVALID
    APEX_040100     PACKAGE BODY     WWV_FLOW_XLIFF     INVALID
    APEX_040100     PACKAGE BODY     WWV_META_CLEANUP     INVALID
    APEX_040100     PACKAGE BODY     WWV_MIG_ACC_LOAD     INVALID
    APEX_040100     PACKAGE BODY     WWV_MIG_FRMMENU_LOAD_XML     INVALID
    APEX_040100     PACKAGE BODY     WWV_MIG_FRM_LOAD_XML     INVALID
    APEX_040100     PACKAGE BODY     WWV_MIG_FRM_OLB_LOAD_XML     INVALID
    APEX_040100     PACKAGE BODY     WWV_MIG_FRM_UPDATE_APX_APP     INVALID
    APEX_040100     PACKAGE BODY     WWV_MIG_FRM_UTILITIES     INVALID
    APEX_040100     PACKAGE BODY     WWV_MIG_RPT_LOAD_XML     INVALID
    APEX_040100     PACKAGE BODY     WWV_RENDER_CALENDAR2     INVALID
    APEX_040100     PACKAGE BODY     WWV_RENDER_CHART2     INVALID
    APEX_040100     PACKAGE BODY     WWV_RENDER_REPORT3     INVALID
    APEX_040100     PROCEDURE     APEX_ADMIN     INVALID
    APEX_040100     PROCEDURE     F     INVALID
    APEX_040100     PROCEDURE     HTMLDB_ADMIN     INVALID
    APEX_040100     PROCEDURE     WS     INVALID
    APEX_040100     SYNONYM     APEX_COLLECTIONS     INVALID
    APEX_040100     SYNONYM     HTMLDB_COLLECTIONS     INVALID
    APEX_040100     TRIGGER     WWV_FLOW_FEEDBACK_T1     INVALID
    APEX_040100     VIEW     WWV_FLOW_ADVISOR_RESULT     INVALID
    APEX_040100     VIEW     WWV_FLOW_COLLECTIONS     INVALID
    APEX_040100     VIEW     WWV_FLOW_SEARCH_RESULT     INVALID
    APEX_040100     VIEW     WWV_MULTI_COMPONENT_EXPORT     INVALID

    yannisr wrote:
    Hi,
    After importing the APEX_040100 user in the database I got several invalid objects that are causing APEX not to work.Hi,
    You mean you did export APEX_040100 schema from one database and import it to another database?
    There is also public synonyms and if I recall correct some objects are in SYS schema that belongs to Apex and are needed.
    Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0

  • Could you please answer this questions ?

    could you please answer this questions ......
    2. What can you do with the DBMS_LOB package?
    A. Use the DBMS_LOB.WRITE procedure to write data to a BFILE.
    B. Use the DBMS_LOB.BFILENAME function to locate an external BFILE.
    C. Use the DBMS_LOB.FILEEXISTS function to find the location of a BFILE.
    D. Use the DBMS_LOB.FILECLOSE procedure to close the file being accessed.
    3. Which two statements about packages are true? (Choose two)
    A. Packages can be nested.
    B. You can pass parameters to packages.
    C. A package is loaded into memory each time it is invoked.
    D. The contents of packages can be shared by many applications.
    E. You can achieve information hiding by making package constructs private.
    4. Which three are true statements about dependent objects? (Choose three)
    A. Invalid objects cannot be described.
    B. An object with status of invalid cannot be a referenced object.
    C. The Oracle server automatically records dependencies among objects.
    D. All schema objects have a status that is recorded in the data dictionary.
    E. You can view whether an object is valid or invalid in the USER_STATUS data dictionary view.
    F. You can view whether an object is valid or invalid in the USER_OBJECTS data dictionary view.
    5. You need to create a stored procedure, which deletes rows from a table. The name of the table from which the rows are to be deleted is unknown until run time. Which method do you implement while creating such a procedure?
    A. Use SQL command delete in the procedure to delete the rows.
    B. Use DBMS_SQL packaged routines in the procedure to delete the rows.
    C. Use DBMS_DML packaged routines in the procedure to delete the rows.
    D. Use DBMSDELETE packaged routines in the procedure to delete the rows.
    E. You cannot have a delete statement without providing a table name before compile time.
    6. You need to drop a table from within a stored procedure. How do you implement this?
    A. You cannot drop a table from a stored procedure.
    B. Use the DROP command in the procedure to drop the table.
    C. Use the DBMS_DDL packaged routines in the procedure to drop the table.
    D. Use the DBMS_SQL packaged routines in the procedure to drop the table.
    E. Use the DBMS_DROP packaged routines in the procedure to drop the table.
    7. When using a packaged function in a query, what is true?
    A. The COMMIT and ROLLBACK commands are allowed in the packaged function.
    B. You cannot use packaged functions in a query statement.
    C. The packaged function cannot execute an INSERT, UPDATE, or DELETE statement against the table that is being queried.
    D. The packaged function can execute and INSERT, UPDATE, or DELETE statement against the table that is being queried if it is used in a subquery.
    E. The packaged function can execute an INSERT, UPDATEM or DELETE statement against the table that is being queried if the pragma RESTRICT REFERENCE is used.

    It should be good if you try yourself by training your brain to solve these questions and then share them with us to get more help or advice
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • STORED PROCEDURE & DATABASE TRIGGER

    제품 : FORMS
    작성날짜 : 1995-11-07
    * STORED PROCEDURE
    1. Oracle Forms 4.5에서는 PL/SQL Code를 Server-Side에 저장하거나 Forms 내 Trigger, Procedure로 갖을 수도 있다.
    다음과 같은 경우 Procedure를 Database Server에 저장하는 방법을 선택하는
    것이 좋다.
    - Procedure가 Standard한 기능을 제공하여 다른 Tool이 공유할 수 있을 때.
    - Procedure가 중요한 DML 기능을 가질 경우.
    - Oracle Forms 4.5에서는 PL/SQL의 Version을 1.1까지 지원하므로, PL/SQL
    Version 2.X 의 기능이 필요한 경우.
    2. Stored Procedure의 제한사항
    (1) Server가 7.0 이상이어야 한다.
    (2) Pass되는 Variable은 2000 Byte이하이어야 한다.
    - 2000이 넘으면 Truncate가 되고, PL/SQL에서 Value_Error Exception이
    발생한다.
    (3) Menu PL/SQL에서는 Stored Procedure와 Function을 부를 수 없다.
    (4) Stored Subprogram의 정의가 바뀐 경우, Forms를 다시 Server와 Connect
    하기 전에는 영향을 주지 않는다.
    3. Oracle 7 Server 에서 제공하는 Standard Package들
    - dbms_alert
    - dbms_ddl
    - dbms_describe
    - dbms_lock
    - dbms_mail
    - dbms_output
    - dbms_pipe
    - dbms_session
    - dbms_snapshot
    - dbms_standard
    - dbms_transaction
    - dbms_utility
    < Oracle7 Developers Guide 참조>
    4. Calling Stored Procedures
    (1) Database Procedure는 Server-Side PL/SQL Engine에 의해 실행되도록
    Design된 PL/SQL Block이다.
    (2) Stored Procedure를 Call하기 위해서는 EXECUTE Privilege가 필요하다.
    (3) Server-Side Procedure와 Forms에서의 PL/SQL의 중요한 차이점은
    Server-Side 에서는 Forms의 Bind Variable (:Block_Name.Item_Name 등)
    을 인식하지 못한다는 것이다.
    (4) Parameter/Return이 가능한 Data Type
    - VARCHAR2 : Maximum of Varchar2(2000)
    - NUMBER
    - DATE
    - BOOLEAN
    제한사항
    - TABLE%ROWTYPE, TABLE.COLUMN%ROWTYPE으로 정의된 것은 Reference가
    안된다.
    - Unsupported Parameter나 Return Value를 사용하면 다음의 Error가
    발생한다.
    * PL/SQL error 313 at line xxx, column yyy 'PROCNAME'
    not declared in this scope.
    * PL/SQL error 201 at line xxx, column yyy identifier 'FUNCTNAME'
    must be declared.
    (5) Formal Parameter의 Default Value
    - Defulat Value는 제공하지 않는다.
    - User가 임의로 줄 수 있다.
    - Procedure Private_Test(a in VARCHAR2 := 'Hello' b in
    VARCHAR2 := 'There') IS
    BEGIN
    Dbms_Output.Put_Line(a);
    Dbms_Output.Put_Line(b);
    END;
    (6) 다른 User의 Stored Subprogram이나 Remote Database를 Call하려면
    - User Name이나 Database Link명을 숨기기 위하여 Synonym을 생성하여야
    한다.
    - CREATE SYNONYM lib_hr_syn FOR libowner.lib_hr;
    - Program에서 Call할 때에는 ss_num ;= lib_hr_syn.get_ssn(:EMP.EMPNO);
    5. PL/SQL Compiler가 해당 Procedure를 찾는 순서
    (1) Current PL/SQL Block 내에 정의되어 있는가?
    (2) Standard PL/SQL Command인가?
    (3) Oracle Forms 내의 Built-in Procedure 혹은 Function인가?
    (4) User_Named Procedure 혹은 Function인가?
    (5) Server-side에 정의된 DBMS_STANDARD Package인가?
    (6) Current user가 Server-Side의 어떤 Procedure나 Function을 Access
    하는가?
    * 이상의 질문에 대하여 전부 'NO'라는 대답이 나오면 Compiler는 다음과 같은
    Error Message를 준다.
    - PL/SQL error 313 at line xxx, column yyy 'PROCNAME' not declared in
    this scope.
    - PL/SQL error 201 at line xxx, column yyy identifier 'FUNCTNAME'
    must be declared.
    * DATABASE TRIGGER
    1. Database Trigger는 Forms에서의 Trigger와 개념적으로 거의 동일하다.
    차이점은 Trigger가 Fire되는 원인을 제공하는 사건과 후속코드가 실행되는
    장소가 틀린 것이다.
    2. Database Trigger는 Table과 연관된 PL/SQL Block들이다. Table에 대한
    UPDATE, INSERT, DELETE 등의 행위에 의해 Fire된다.
    3. Error 발생 시에는 RAISE_APPLICATION_ERROR Built-In Procedure를 사용하
    여 Error를 표시한다.
    RAISE_APPLICATION_ERROR Procedure에서는 Error Number가 20000 - 20999의
    Range를 가진다.
    4. Creating & Editing Database Triggers
    아래와 같은 적절한 권한이 주어진다면 Forms Designer Mode에서 Database
    Trigger를 직접 Create, Edit, Compile, Browse 할 수 있다.
    - Execute Privilege, Create Privilege, Compile Privilege,
    Drop Privilege
    * Create하려면
    - Navigator에서 Database Objects와 Table Nodes를 Expand한다.
    - 원하는 Table을 선택하고 Expand한다.
    - Triggers Nodes를 선택하고 Menu Bar의 Navigator*Create를 선택한다.
    - Database Trigger Editor에서 작성, compile한다.
    * Edit 하려면
    - Navigator에서 Database Objects와 Table Nodes를 Expand한다.
    - 원하는 Table을 선택하고 Expand한다.
    - 원하는 Trigger에서 Double-Click하면 Editor가 나타난다.
    - Database Trigger Editor에서 변경, compile한다.

    not possible via forms
    you can debug it on SQL Developer by using manual INSERT Updates commands

  • ORA-24344: Success with compilation error.

    Hi, i got the following error notification mail when the DB job [runs only once in a day at 1 AM] tries to execute the following procedure.
    The mail reads like this ----
    "Condition Raised in: toll_partitions.recompile_invalid_objects
    Short Desc: ORA-24344
    Long Desc: ORA-24344: Success with compilation error.
    Cause: Trigger creation did not successfully complete.
    Solution: Check trigger status for all triggers created in this schema and find out which error caused the failure by querying the user_errors table for the named trigger and Trigger type.
    --- end of mail ----
    === This is the procedure =====
    PROCEDURE recompile_invalid_objects IS
    -- Declare variables
    v_ins_str VARCHAR2(2000);
    cursor_handle NUMBER;
    execute_feedback NUMBER;
    v_unix_str VARCHAR2(200);
         v_object_cnt NUMBER := 0;
         -- Declare cursor objects
         CURSOR curs_obj IS
    SELECT decode( OBJECT_TYPE, 'PACKAGE BODY',
    'ALTER PACKAGE ' || OWNER||'.'||OBJECT_NAME || ' COMPILE BODY',
    'ALTER ' || OBJECT_TYPE || ' ' || OWNER||'.'||OBJECT_NAME || ' COMPILE' )
                   "COMP_OBJECT"
    FROM dba_objects
    WHERE STATUS = 'INVALID'
    AND OBJECT_TYPE IN ( 'PACKAGE BODY', 'PACKAGE', 'FUNCTION', 'PROCEDURE',
              'TRIGGER', 'VIEW' )
    AND OWNER = USER
              AND OBJECT_NAME NOT LIKE 'TOAD_PROFILER'
    ORDER BY OWNER, OBJECT_TYPE, OBJECT_NAME;
    BEGIN
         -- Set Package/Procedure Name for email notification.
         vFacility := cProcName || '.recompile_invalid_objects';
    -- Select invalid object count
    BEGIN
         SELECT count(*)
              INTO v_object_cnt
              FROM dba_objects
    WHERE STATUS = 'INVALID'
    AND OBJECT_TYPE IN ( 'PACKAGE BODY', 'PACKAGE', 'FUNCTION', 'PROCEDURE',
              'TRIGGER', 'VIEW' )
    AND OWNER = USER
                   AND OBJECT_NAME NOT LIKE 'TOAD_PROFILER'
    ORDER BY OWNER, OBJECT_TYPE, OBJECT_NAME;
              -- Recompile invalid objects
              IF v_object_cnt > 0 THEN
              FOR i in curs_obj
                   LOOP
                   v_ins_str := i.COMP_OBJECT;
                        cursor_handle := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(cursor_handle,
         v_ins_str,
                   DBMS_SQL.V7);
    execute_feedback := DBMS_SQL.EXECUTE(cursor_handle);          
    DBMS_SQL.CLOSE_CURSOR(cursor_handle);
    COMMIT;
                   END LOOP;
              END IF;
    END;
    EXCEPTION
         WHEN OTHERS THEN
         -- Log error condition and generate email notification if needed.
    toll_handle.error_condition(vFacility, toll_handle.get_ora_desc(sqlerrm),vErrorID);
         END recompile_invalid_objects;
    ==== end of procedure ====
    I got '0' count when I ran the invalid object count to see the invalid objects. I ran the following code ..and it gave me 0 value.
    SELECT count(*)
              FROM dba_objects
    WHERE STATUS = 'INVALID'
    AND OBJECT_TYPE IN ( 'PACKAGE BODY', 'PACKAGE', 'FUNCTION', 'PROCEDURE',
              'TRIGGER', 'VIEW' )
    AND OWNER = USER
                   AND OBJECT_NAME NOT LIKE 'TOAD_PROFILER'
    ORDER BY OWNER, OBJECT_TYPE, OBJECT_NAME;
    --- end of query ---
    The count 0 means, there are no invalid objects. But it throws daily the same error notification mail at 1 AM[the time job runs]. I compiled the procedure and it reports no errors. I checked the status of the triggers and all are valid and enabled. Please suggest me. Any help in this regard will be of great help to me. Thanks in advance...

    Just some hints. I'm not sure if they help solving your problem.
    1) Don't COMMIT inside a cursor.
    2) Instead of DBMS_SQL you could use DBMS_DDL.ALTER_COMPILE, also see here: http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_ddl2.htm#1000604
    3) Check if there are other jobs running during the recompile. Maybe you run into some conflicts.
    4) Output the statement that creates the error. It looks like you could try to put this into your exception handler: toll_handle.error_condition(vFacility, v_ins_str,vErrorID);

  • Pl/sql doubts clarification

    Hi,
    I have doubts with some of the questions given below:
    1.Identify two features of obfuscation. (Choose two.)
    A. The Import and Export utilities accept wrapped files.
    B. SQL' Plus cannot process the obfuscated source files.
    C. Only the wrap utility can obfuscate multiple programs at a time.
    D. Both the DBMS_DDL package and the Wrap utility can obfuscate multiple programs at a time.
    E. The source code is visible only through the DBA_SOURCE view and not through the USER_SOURCE or
    ALL_SOURCE View
    ANSWER: A and C(not sure)
    2.The anonymous block gives an error on execution. What Is the reason?
    A.
    The assignment in line 7 is not valid.
    B.
    The SQL does not support the Boolean data type.
    C.
    A null value cannot be applied to the bind arguments In the using clause in line 10
    D.
    The names of bind variables must be the same as the using clause bind arguments in line 10
    Answer: A or B.
    3.SCOTT executes the procedure as follows:
    SQL>SET SERVEROUTPUT ON
    SQL>EXEC read_file ('MY_DIR', FACULTYLIST.TXT')
    What is the outcome?
    A.
    It goes into an infinite loop.
    B.
    It executes successfully and displays only the list of faculty names.
    C.
    It does not execute and displays an error message because the end-of-file condition is not taken care of.
    D.
    It executes successfully and displays the list of faculty names followed by a “no data found” error message.
    Answer: D is right or not
    4.Which two tasks should be created as functions instead of as procedures? (Choose two.)
    A.
    reference host or bind variables in a PL/SQL block of code
    B.
    tasks that compute and return multiple values to the calling environment
    C.
    tasks that compute a value that must be returned to the calling environment
    D.
    tasks performed in SQL that increase data independence by processing complex data analysis within the Oracle server, rather than by retrieving the data into an application
    Answer: A and B(not sure B or C).
    Please,kindly reply to me ASAP.
    Thank you,
    karthi
    Edited by: 998492 on Apr 7, 2013 2:32 AM

    1. Thare are so many problems in this code. I will list a few.
    1. You cant specify the size of an argument in a procedure.
    2. You can call this procedure only once in a schema, coz the name of the table to  be created is static.
    3. *No need to create the table dynamically*. You can create the table at the design time and truncate/insert as required.
         Even it will not be required, I hope, to meet your requirement( A Cursor will be enough).
    4. In the EMP table join_date should be of date datatype. If it is already a date, no need of to_date in the procedure.
    5. Not using BIND Variables.
    6. Variable "v_cmd" is not declared2. Search for "string aggregation " in this forum and show us what you tried so far.

  • Working with PL/SQL Packages and Extension SDK

    Hi,
    I'm working on an Extension for SQL Developer. I want this Extension to wrap my PL/SQL Packages.
    The Situation:
    I got an Oracle DB 10g Revision 1 so I can't use the dbms_ddl call to wrap my Packages. I have to use the wrap.exe Utility.
    When I right click on a PL/SQL Package I can choose "Wrap it!" and the Extension does the following: It implements an oracle.ide.controller.ContextMenuListener and when the handleEvent function is called I cast the Context Parameter to a oracle.dbtools.raptor.navigator.plsql.PlSqlNode Object.
    Through the getSource function I get source code, print it into a file wrap it and write it back to the database.
    But I have to call this for both the package body and the package header. How can I got the header if my oracle.dbtools.raptor.navigator.plsql.PlSqlNode Object is the body or the body if my oracle.dbtools.raptor.navigator.plsql.PlSqlNode Object is the header with the Extension SDK? There has to be a Way, cause there is also a standart function called "Save Package Spec and Body".
    Can someone help me, please. :-)
    Thanks
    Andi
    P.S.: I'm sorry for my bad english. :(

    Greetings,
    If you are using the HTP/HTF procedures/functions then the following code does what you are asking:
    htp.formOpen( curl => 'schema.package.procedure_name', cmethod => 'post');
    which would generate the following HTML:
    <FORM ACTION='schema.package.procedure_name' METHOD="post">
    The names of <INPUT> items between the <FORM> tags should match parameter names in your PL/SQL procedure.
    Thanks,
    Dale

  • OGG and firing triggers

    Hi,
    I am designing and implementing OGG to replicate a set of about 200 tables from a master system to two target systems. Updates to these tables only occur on the master system so this is a 1:n uni-directional situation. The master and target systems are all Oracle.
    Some or all of the target tables have triggers on them. For 95% of the tables, we don't want the triggers to fire when GG replicates to the table. This is easily accomplished by using the SUPPRESSTRIGGERS subparameter of the DBOPTIONS parameter in the replicat parameter file. So, I set up one extract/pump/replicat process to replicate the data to these tables.
    Of the remaining 5% of the tables, most of the time we want the triggers to fire on the target systems when data is replicated to the target table. Again this is easily accomplished by setting up another extract/pump/replicat process with DBOPTIONS NOSUPPRESSTRIGGER.
    There are a couple of tables on the target systems which have more than one trigger and we want one of the triggers to fire when replicating but not the other ones. I believe that I can partly accomplish this by putting a SQLEXEC on the MAP statement for these tables which issues an ALTER TRIGGER <schema.trigger>; DISABLE. The documentation says this SQLEXEC will run before the data is replicated to the target table so the trigger will be disabled when the replication happens.
    My problem is... How do I enable the trigger again once I have replicated data to the target table? I don't think it's possible to have a SQLEXEC run after the replication happens. Is that true?
    I have considered simply disabling the triggers when replication starts with a standalone SQLEXEC statement that runs when replication starts and enabling them using SQLEXEC ONEXIT to enable the triggers again when replication stops. this will work but I'm not sure my customer will buy this solution.
    Thanks a lot for any help you can provide.

    I've figured out how to do this. Start the replicat with DBOPTIONS SUPPRESSTRIGGERS specified. Then run a standalone SQLEXEC which executes the following stored procedure call for each trigger you want to have fire: dbms_ddl.set_trigger_firing_property(<trigger_owner> '<trigger_name>', FALSE);
    I have a set of eight triggers I want to fire so I created a simple stored procedure that executes this SP for each of my triggers. It could probably be done inline in the replicat parameter deck too.
    Also, I have a second SP which I call using SQLEXEC ON EXIT. This disables all the triggers I enabled at the beginning.
    Looking at ALL_TRIGGERS at the FIRE_ONCE column/property will tell you what state a trigger is in. Ironically, NO means the the trigger will fire and YES means it will not.

  • How to recompile the entire schema's INVALID objects in one go?

    Hi,
    How to recompile the entire schema's invalid database objects (such as package, function, procedure, trigger etc) in one go?
    Please advise.
    Thank you.

    I often use this SQL.
    select 'Alter ' || OBJECT_TYPE || ' ' || OBJECT_NAME || ' compile;' as DDL
      from user_objects
    where STATUS = 'INVALID';I sometimes use this SQL.
    declare
        WK_InvalidCount     pls_Integer :=0;
        WK_PrevInvalidCount pls_Integer :=0;
    begin
        loop
            for rec_work in (select a.object_type,a.object_name from user_objects a ,user_object_size b
                             where  a.status='INVALID' and a.object_name=b.name order by b.code_size
                            ) loop
                dbms_ddl.alter_compile(rec_work.object_type,user,rec_work.object_name);
                DBMS_Output.Put_Line(rec_work.object_name || 'is recompiles');
            end loop;
            select count(*) into WK_InvalidCount from user_objects where status='INVALID';
            if WK_InvalidCount=0 then
                DBMS_Output.Put_Line('InvalidObject none');
                exit;
            elsif WK_InvalidCount != WK_PrevInvalidCount then
                WK_PrevInvalidCount := WK_InvalidCount;
            else
                DBMS_Output.Put_Line('InvalidObjects remain' || to_char(WK_InvalidCount));
                exit;
            end if;
        end loop;
    end;
    /

  • Execution of Row level trigger in Oracle Streams.

    Hi All,
    Oracle Database version : 9.2.0.4 on windows NT/2000 environment.
    We managed to install,configure oracle stream technologies.
    Oracle Stream seems to be working fine for replication of DML & DDL changes from source database to target database.
    Following is detail at source end.
    Source Sid = acc
    Source Schema = stream
    Source Table = dept
    structure of dept table.
    Name Null? Type
    DEPTNO NOT NULL NUMBER(5)
    DNAME NOT NULL VARCHAR2(10)
    LOC NOT NULL VARCHAR2(10)
    Streamadmin user = strmadmin
    Following is detail at target end.
    Target Sid = fin
    Target Schema = stream
    Target Table = dept
    structure of dept table.
    Name Null? Type
    DEPTNO NOT NULL NUMBER(5)
    DNAME NOT NULL VARCHAR2(10)
    LOC NOT NULL VARCHAR2(10)
    TRAN_DATE                    NULL DATE DEFAULT SYSDATE
    I checked on insert/update/delete of rows into dept table at source database, changes are correctly replicated to target table dept.
    I wrote a simple trigger which is as follows on dept table at target database.
    create or replace trigger dept_upd_del
    before delete or update of dname,loc on stream.dept
    for each row
    begin
    dbms_output.put_line('Inside Trigger');
    if updating then
    dbms_output.put_line('Update');     
    insert into stream.dept_change values (:old.deptno,'U',sysdate);
    end if;
    if deleting then
    dbms_output.put_line('Delete');
    insert into stream.dept_change values (:old.deptno,'D',sysdate);
    end if;
    end;
    I expect this trigger to get executed whenever changes occurs into dept table at target database whenever dml changes are propagated from source to target table. However i found that the above trigger is not executed at all.
    I was further surprised, since incase i update/delete rows from target table dept the above trigger is executing correctly.
    Can someone please let me know about this?
    I believe stream technology is using INSERT / UPDATE & DELETE statement when changes are applied at target table but this doesn't seems to be the case.
    Thanks in Advance.
    Regards,
    Vidyanand

    The trigger at the destination will not fire because it already has at the source site. Read about that in the streams documentation on page 4-25. To change the "fire once" property of the trigger, use the procedure SET_TRIGGER_FIRING_PROPERTY in the DBMS_DDL package.
    Hope this helps.
    Claudine

  • Can we Pin a Procedure?

    Dear All,
    I know that we can pin a package.But I have no clear idea about procedures.Can we pin Procedures?.We have procedures that are run daily of which one of them runs for 5 hrs.So , I wanted to pin them..please let me know how it can be done
    If we pin a package, does it give the results quickly and accurately even if the base tables are updated?
    Please tell me what exectly happens when we pin a package?
    Regards,
    Kris

    There are several packages that should be pinned at the shared pool reserved area automatically at startup, so I suggest you to write a database trigger, similar to this one to pin the most important packages:
    create or replace trigger Package_Pin
           after startup on database
           begin
           dbms_shared_pool.keep('DBMS_ALERT');                                
           dbms_shared_pool.keep('DBMS_DDL');
           dbms_shared_pool.keep('DBMS_DESCRIBE');
           dbms_shared_pool.keep('DBMS_LOCK');                        
           dbms_shared_pool.keep('DBMS_OUTPUT');
           dbms_shared_pool.keep('DBMS_PIPE');
           dbms_shared_pool.keep('DBMS_SESSION');                         
           dbms_shared_pool.keep('DBMS_SHARED_POOL');
           dbms_shared_pool.keep('DBMS_STANDARD');
           dbms_shared_pool.keep('DBMS_UTILITY');                                 
           dbms_shared_pool.keep('STANDARD');
           end;~ Madrid

  • Error in trigger while importing schema

    I am getting the below error while importing a schema back to a database..
    ORA-39083: Object type TRIGGER failed to create with error:
    ORA-04072: invalid trigger type
    Failing sql is:
    BEGIN DBMS_DDL.SET_TRIGGER_FIRING_PROPERTY('"pula"','"Trigger1"',FALSE) ; END;
    ORA-39083: Object type TRIGGER failed to create with error:
    I have checked the status of the trigger and everything id fine...
    Please help..!!

    Rajesh,
    Please go through this Wiki chapter on CoA import using DTW and you should be able to understand this better
    https://wiki.sdn.sap.com/wiki/display/B1/SAPBusinessOne...ToGo-10.DataTransfer+Workbench
    Suda

Maybe you are looking for

  • Calendar sync with Exchange server is unidirectional

    Hello I can synchronize my BB 8900 with the Exchange calendar in bidirectional mode using the USB cable. When I switch it to wireless mode in my calendar options at the BB device, the synchronisation works only from the computer to the BB but not the

  • Can see only one photo per page. How to revert to multiple images per page?

    First noticed on my iMac and now on my Macbook (10.4.9)--I'm no longer seeing a month's worth of photos on a single page. Only one photo per page, sometimes with miniature ones in the top border. I thought it was simply an inadvertent click on by par

  • Freight charges in sales order

    Hi experts, How do we findout the sales order number the freight charges between 1000 and 5000. because my company want analyse the freight charges for last two years. i already refer the table KONV and vbak table.till i didn't get correct results. T

  • Why does my paragraph tag for images get repositioned AFTER the image?

    I have TCS2 and link my FM docs to RH. I use a paragraph tag in FM called "figure" for my imported images. I noticed there is too much space after the images in RH and discovered the "figure" tag is BELOW the images. So even if I map the tag to a RH

  • Exclude stock reserved for production order from availability check

    Hi Experts, We have a problem in the availability check. There is a material used as selling product and components in the same time. When the material has been reserved completely for a production order, the new sales order still get confirmed despi