to view defination of trigger/procedure already defined

Hello
Suppose that I have already defined a procedure or a trigger. Later if I forget his exact definition, so how can I find its definition such as defined by me.
Thank you

user12222356 wrote:
I get a full definition of triggers and procedures using this command:

You run it in SQL * Plus, no? DBMS_METADATA. GET_DDL returns the CLOB and default SQL * more poster N only first character of a CLOB VDP1500ST N is defined by the command SET LONG (default 80):

SQL> select dbms_metadata.get_ddl('TABLE','EMP','SCOTT') from dual
  2  /

DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
--------------------------------------------------------------------------------

  CREATE TABLE "SCOTT"."EMP"
   (    "EMPNO" NUMBER(4,0),
        "ENAME" VARCHAR2(10),

SQL> set long 10000
SQL> /

DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
--------------------------------------------------------------------------------

  CREATE TABLE "SCOTT"."EMP"
   (    "EMPNO" NUMBER(4,0),
        "ENAME" VARCHAR2(10),
        "JOB" VARCHAR2(9),
        "MGR" NUMBER(4,0),
        "HIREDATE" DATE,
        "SAL" NUMBER(7,2),
        "COMM" NUMBER(7,2),
        "DEPTNO" NUMBER(2,0),
         CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")

DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
--------------------------------------------------------------------------------
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "USERS"  ENABLE,
         CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
          REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
   ) 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)
  TABLESPACE "USERS"

DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
--------------------------------------------------------------------------------

SQL> 

SY.

Tags: Database

Similar Questions

  • How to view defination of packages already defined?

    Hello
    How can I view defination of a package already set? His technique and his body?

    Hello

    user12222356 wrote:
    My name of the package is "PackageTest1", since at the time of creation, I gave that name.

    But then this write request

    select text from user_source where name='PacklageTest1'
    

    no row is selected, and when I give this command

    select text from user_source where name='PACKAGETEST1'
    

    defination is shown. But why only capital letter package name is identified?

    One of the reasons is that the names are different; There is an 'l' (5 characters) in "PacklageTest1", but not "PACKAGETEST1".

    A more subtle reason is in Oracle identifiers are case-sensitive. You can have a package called
    "PackageTest1", another called
    "Packagetest1" ("with a small" t "), another called
    "PACKAGETEST1" (uppercase), another called
    "pAckAgEtEst1" (vowels capitalized).
    ...
    all in the same schema.

    Normally, the parser capitalizes all the texts that are not listed, so if you say

    EXEC  packagetest1.foo ('Hello, world!');
    

    What gets actually compiled is

    EXEC  PACKAGETEST1.FOO ('Hello, world!');
    

    If you actually have an identifier with lowercase letters, then you must use double quotes around it. quotes, in places where you don't want it confused with a string literal:

    EXEC  "PackageTest1"."Foo" ('Hello, world!');
    

    or single quotes when it is really a literal string:

    select       text                     -- Column name is actually TEXT, but lower-case will work here
    from      user_source                -- View name is actually USER_SOURCE, but lower-case will work here
    where     name     = 'PackageTest1'     -- String literal is already quoted
    and       type     = 'PACKAGE BODY'     -- If you don't want source code from package spec mixed in
    order by  line                    -- Only way to make sure output is in order
    ;
    
  • Synonym, views, trigger, procedures, function - where these items will be present?

    Hi all

    Basic question:
    1 oracle objects as a synonym, trigger, procedures, views, function (of a particular user) where these items will be present? Is - this data dictionary user default tablespace or system?

    2. the user have create session, synonym to create, select any user of permission.and table have default tablespace DATA.

    (a) if the user has create any synonym it will store in the tablespace DATA?
    (b) if the user can able to select a table only or can see all notices and the level of database functions?


    Thank you

    903787 wrote:
    Sorry, I don't understand could you please it explain.

    After SQL & results that show how the synonym of space, function, view, & trigger consume in your DB.

  • Using views in the RPD versus views defined in Oracle DB

    PLS, could someone give me an idea on the performance or the other method?
    Any recommendation?
    TXS.
    Antonio

    Hey Anto,

    Check this thread, views - set at the database level or RPD?  Advantages/disadvantages/best practices

    Kind regards
    DpKa

  • ADF view object and stored procedure

    Hi all

    I am facing a problem with the view object, the case is, I created a stored procedure with an input and an output parameter

    view object I need to call this procedure inside the request object view and define the attribute transient output parameter

    could you please help me in this case, please give an example

    Thanks in advance

    Mohamed,

    Can you explain your use case to help you.

    Is it possible to convert the stored procedure in function (and change the output parameter to return the parameters) and create a display object using the function.

    Ex: Create a display object "read access only via the SQL query" for the query: SELECT HR. PLSQLTEST2 staff (first_name) OF

    K

  • Create materialized view at the trigger.

    Hello

    I use version below:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    I created a materialized view query below:

    CREATE THE FSG1_FUND000 MATERIALIZED VIEW

    PCTUSED, PCTFREE 5 70

    Users TABLESPACE

    STORAGE (INITIAL 500K NEXT 500K)

    Refresh a start fast with (sysdate) next (sysdate + (1 / 1440))

    WITH rowid

    AS

    SELECT * FROM ABNDEV_T24. FSG1_FUND000@abndev;

    This Mview if any insert or update only (WITHOUT DELETING) are coming which should be copy to another table. But in mView trigger does not work.

    So pls advice me no alternative.

    Querys trigger:

    create or replace trigger trg_dummy

    after insert or update on FSG1_FUND000

    for each line

    Start

    If the insertion

    insert into FSG1_FUND001 (RECID, XMLRECORD) values (: new.) RECID,: new. XMLRECORD);

    elsif update then

    insert into FSG1_FUND001 (RECID, XMLRECORD) values (: new.) RECID,: new. XMLRECORD);

    end if;

    end;

    /

    Kind regards

    Villa

    Hello

    I learned and referred website as much as we can not able to create a trigger in MView (sorry we create trigger but none use of creation because in view no insert and update happened). So I drop completely the materialized view concepts and relaxation.

    Instead of, I have using the procedure to insert records in a table and then I created one by dbms_scheduler job.

    This discussion will be useful for any future reference.

    -procedure-

    create or replace procedure p2

    as

    Start

    INSERT / * + APPEND * / INTO FSG1_FUND000 SELECT * FROM FSG1_FUND000@remote;

    End; BluShadow

    /

    -----------------job--------------------

    Begin

    DBMS_SCHEDULER. () CREATE_JOB

    job_name-online "JOB4."

    job_type-online "PLSQL_BLOCK."

    JOB_ACTION => ' BEGIN p2; END;',

    start_date => SYSDATE,

    repeat_interval => ' FREQ = MINUTELY; INTERVAL = 5;',

    End_date => NULL,

    -Online TRUE, enabled

    comments => "Inserting a record in a table");

    end;

    /

  • problem with the use of v$ session view in a trigger

    Hi all

    In some tables in my system, I have a trigger that uses the view v$ session.

    From this point of view, I get the osuser, ip address, and the name of the computer where the transaction origin.

    An Apex application uses these tables and relaxation in question no longer works properly, because in some occasions is the same database session.
         SELECT SYS_CONTEXT ('USERENV', 'IP_ADDRESS') ip,
                osuser,
                machine,
                username
          INTO v_ip, v_osuser, v_machine, v_username
          FROM v$session v
          WHERE username = USER AND status = 'ACTIVE';
    Anyone know another option that I have to get these values in a trigger, but from an application on Apex


    concerning

    Gerard

    You can not really... That's the difference between the server of client products and a web-based product. This info I have beyond the access of the browser... And it must be like that...

    Thank you

    Tony Miller
    Webster, TX

    If vegetable oil is made from vegetables, then what is baby oil?

    If you answer this question, please mark the thread as closed and give points where won...

  • question about OAS of forms and trigger procedures os or events

    Hello
    I have a huge problem here, I have not the slightest idea of how to do that I have a form created from Wizard of the suppliers based on a table, the thing is that I have a special index that I need to specific forms, as well as the bellows of code should do the job, but I know not where to put and how to bind variables.

    the variables PERTENECEA and ID_DEPENDENCE would come in the form
    Num and txt are auxiliar variable so that I can create the new index
    and
    id_unidad_admiva is the value I want to insert in each line
    declare
     num number;
     txt varchar(10);
    begin 
     if substr(PERTENECEA, 0,2)<>0 then
        if substr(PERTENECEA, 3,2)<>0 then
          if substr(PERTENECEA, 5,2)<>0 then
            if substr(PERTENECEA, 7,2)<>0 then
              if substr(PERTENECEA, 9,2)<>0 then
                num:= TO_NUMBER(select MAX(substr(id_unidad_admiva, 9,2)) from unidades_admivas where id_dependencia=id_dependencia and substr(id_unidad_admiva,0,8)=substr(PERTENECEA,0,8);
                num:=num+1;
                txt:= substr(PERTENECEA,0,8);
                id_unidad_admiva:=txt||num;
              else
                num:=TO_NUMBER(select MAX(substr(id_unidad_admiva, 9,2)) from unidades_admivas where id_dependencia=id_dependencia and substr(id_unidad_admiva,0,8)=substr(PERTENECEA,0,8));
                num:=num+1;
                txt:= substr(PERTENECEA,0,8);
                id_unidad_admiva:=txt||num;
              end if;
            else
              num:=TO_NUMBER(select MAX(substr(id_unidad_admiva, 7,2)) from unidades_admivas where id_dependencia=id_dependencia and substr(id_unidad_admiva,0,6)=substr(PERTENECEA,0,6));
              num:=num+1;
              txt:= substr(PERTENECEA,0,6);
              id_unidad_admiva:=txt||num||'00';
            end if; 
          else
            num:=TO_NUMBER(select MAX(substr(id_unidad_admiva, 5,2)) from unidades_admivas where id_dependencia=id_dependencia and substr(id_unidad_admiva,0,4)=substr(PERTENECEA,0,4));
            num:=num+1;
            txt:= substr(PERTENECEA,0,4);
            id_unidad_admiva:=txt||num||'0000';
          end if; 
        else
          num:=TO_NUMBER(select MAX(substr(id_unidad_admiva, 3,2)) from unidades_admivas where id_dependencia=id_dependencia and substr(id_unidad_admiva,0,2)=substr(PERTENECEA,0,2));
          num:=num+1;
          txt:= substr(PERTENECEA,0,2);
          id_unidad_admiva:=txt||num||'000000';
        end if;
      else
        id_unidad_admviva:='0100000000';
      end if;
    end;
    so I thought it might be a trigger in the database or an event on the form or put this code in a stored procedure, but either way I do not know how

    can you guide me please?

    Q: ".. by saying that, if PERTENECEA and id_dependencia are mapped to the fields in the table, you mean if they are columns of the table?... »
    A: Yes, I guess (maybe I'm wrong) that these two columns are you table definition, and you have used the wizard to generate a form. In this case, you will get a form with, among other areas, the pertenicea and id_dependencia fields ready to be filled. If my hypothesis is correct, then you are in the best of cases because you can use a database trigger.

    "Q:" can I use this: NEW.pertenecea and: NEW.id_dependencia in a trigger? »
    A: Yes, if the subject is satisfied: PERTENECEA and id_dependencia are mapped to the columns in the table.

    Q: "... variable1: =:NEW.pertenecea and variable2: =:NEW.id_dependencia.?
    A: Yes, you can write this code and finally the installation program you target column by writing: NEW.id_unidad_admiva: = txt | NB;

    Note: If pertenica and id_dependencia are two settings provide you, but are not mapped to a column in the table, while the situation is very different, and you must use a different approach, as described in my previous post, or some other method...

    Patrick.

  • refreshing materialized through procedure in a trigger view

    Hello

    Version Oracle 10.2.0.4


    I'm unable to refresh a materialized view.

    When the data is inserted into the parent table A that will be triggered to a trigger to refresh a view, materialized by a procedure.

    I read triggers are bad and so on... but I don't know how I can solve this problem.

    I need a time that a record is inserted/updated in the TABLE_A must refresh the materialized view later.

    It is required in order for the application to cached data.


    Trigger on the table has
    < pre >
    create or replace TRIGGER A_TRG
    INSERT OR UPDATE OR DELETE ON A
    DECLARE
    number of m;
    Start
    SYS. DBMS_JOB. Send
    (JOB = > m)
    This = > "run CAB_PROC;");
    end;
    < / pre >


    Procedure refresh of the materialized view CAB
    < pre >
    create or replace
    procedure CAB_PROC
    is
    BEGIN
    dbms_mview. REFRESH('CAB','C');
    commit;
    END;
    < / pre >

    When

    < pre >
    Insert into A (ID)
    values ('X');

    Error from the 1 in the command line:
    INSERT INTO A (ID)
    values ('X')

    Error report:
    SQL error: ORA-06550: line 1, column 101:
    PLS-00103: encountered the symbol "CAB_PROC" during the expected in the following way:

    := . (@ %; immediate)
    The symbol ': = ' was replaced by 'CAB_PROC' continue.
    ORA-06512: at "SYS." Dbms_job", line 82
    ORA-06512: at "SYS." Dbms_job", line 139
    ORA-06512: at "OWNER. A_TRG', line 4
    ORA-04088: error during execution of trigger ' OWNER. A_TRG
    06550 00000 - "line %s, column % s:\n%s".
    * Cause: Usually a PL/SQL compilation error.
    * Action:
    < / pre >

    Published by: CrackerJack on May 10, 2012 20:51

    OK, so "symbolization" is a function returning a SDO_GEOMETRY?

    If you want to submit a job, you must present a valid PL/SQL block

    create or replace TRIGGER A_TRG
      AFTER INSERT OR UPDATE OR DELETE ON A
    DECLARE
       m number;
    begin
      SYS.DBMS_JOB.SUBMIT
        ( JOB       => m
         ,what      => 'begin CAB_PROC; end;' ) ;
    end;
    

    Justin

  • VB + syntax DDE to define printParams for the reader?

    I'm trying to write a script in Windows that allows to print in silence, with the setPageSize option turned on, working with Acrobat and Reader.

    Copy the following code, from other posts in this forum, works perfectly with Acrobat:

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

    fileIn = "C:\temp\Test.pdf" "indicate the full path of the file to open
    the App value = CreateObject ("AcroExch.App") "start Adobe Acrobat
    Set AVDoc = CreateObject ("AcroExch.AVDoc") "connect Ac Viewer
    AVDoc.Open fileIn,' "" open a file in the Viewer
    Set PDDoc = AVDoc.GetPDDoc "Get the document open in the Viewer
    define the JSO = PDDoc.GetJSObject "connect to Acrobat JS
    Set pp = JSO.getPrintParams)
    pp.interactive = pp.constants.interactionlevel.silent
    pp.pagehandling = pp.constants.handling.none
    the value of fv = pp.constants.flagValues
    pp. Flags = (fv.setPageSize + fv.suppressCenter + fv.suppressRotate)
    JSO. Print (pp)
    JSO.closeDoc (True)
    App.CloseAllDocs "close all documents
    App.Exit

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

    I see since the SDK that something similar should be possible with drive via a DDE (although the silent printing is not possible), but I can't find any example of code work. Is it possible to send the flags setPageSize printparams, etc., via a DDE?

    Thanks for any help.

    No, there is no support for printParams with drive and DDE.

  • Views of functions or stored procedures

    Hi all

    11.2.0.3.10

    AIX6

    Y at - he views $ v for stored procedures that list the tables that are accessed by it?

    Thank you

    MK

    user_ | all_ | dba_dependencies

    You seem to specialize in issues for which you can find the answer yourself, with little effort, the so-called 'questions doc '.

    Sooner or later people here refuse to answer your questions.

    Sybrand Bakker

    Senior Oracle DBA

  • Procedure to display the view number and execution time


    Hi all

    I'm creating a procedure to display the name of the view and its County and runtime to get this number if we adopt the view name in the procedure. so far, I have created the script below but it does not give any number. Please suggest me an idea to achieve this. I use Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production.

    CREATE OR REPLACE PROCEDURE VIEW_TIME_SP ( P_VIEW_NAME IN VARCHAR2 )
    IS
      V_START_DATE TIMESTAMP;
      V_END_DATE  TIMESTAMP;
      V_ROW_COUNT NUMBER;
      V_SQL       VARCHAR2(1000);
      V_LOG       VARCHAR2(1000);
      V_EXECUTION_TIME INTERVAL DAY TO SECOND;
      V_VIEW_NAME  VARCHAR2(40);
    
    BEGIN
    V_VIEW_NAME := P_VIEW_NAME;
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT = ''dd-Mon-yyyy hh24:mi:ss''';
         
    V_START_DATE := CURRENT_TIMESTAMP;
    V_ROW_COUNT := 0;
    V_SQL := 'SELECT COUNT(*) INTO' || V_ROW_COUNT || ' FROM '  || V_VIEW_NAME;
    EXECUTE IMMEDIATE V_SQL;
    V_END_DATE := CURRENT_TIMESTAMP;
    V_EXECUTION_TIME := V_END_DATE - V_START_DATE;
    V_LOG := V_VIEW_NAME || ' returns ' || V_ROW_COUNT || ' and completed in ' || V_EXECUTION_TIME;
    DBMS_OUTPUT.PUT_LINE (V_LOG);
    EXCEPTION
      WHEN OTHERS THEN
       DBMS_OUTPUT.PUT_LINE ('process failed:' || SQLCODE || ': ' || SQLERRM);
    END VIEW_TIME_SP;
    

    Appreciate your help.

    Thank you

    Hello

    MSB says:

    Hi all

    I'm creating a procedure to display the name of the view and its County and runtime to get this number if we adopt the view name in the procedure. so far, I have created the script below but it does not give any number. Please suggest me an idea to achieve this. I use Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production.

    1. CREATE OR REPLACE PROCEDURE VIEW_TIME_SP (P_VIEW_NAME IN VARCHAR2)
    2. IS
    3. V_START_DATE TIMESTAMP;
    4. V_END_DATE TIMESTAMP;
    5. NUMBER OF V_ROW_COUNT;
    6. V_SQL VARCHAR2 (1000);
    7. V_LOG VARCHAR2 (1000);
    8. V_EXECUTION_TIME INTERVAL DAY TO SECOND.
    9. V_VIEW_NAME VARCHAR2 (40);
    10. BEGIN
    11. V_VIEW_NAME: = P_VIEW_NAME;
    12. EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT = "dd-Mon-yyyy hh24:mi:ss" ';
    13. V_START_DATE: = CURRENT_TIMESTAMP;
    14. V_ROW_COUNT: = 0;
    15. V_SQL: = ' SELECT COUNT (*) IN "| V_ROW_COUNT | 'FROM ' | V_VIEW_NAME;
    16. IMMEDIATELY RUN V_SQL;
    17. V_END_DATE: = CURRENT_TIMESTAMP;
    18. V_EXECUTION_TIME: = V_END_DATE - V_START_DATE;
    19. V_LOG: = V_VIEW_NAME | 'returns "| V_ROW_COUNT | "and completed in | V_EXECUTION_TIME;
    20. DBMS_OUTPUT. PUT_LINE (V_LOG);
    21. EXCEPTION
    22. WHILE OTHERS THEN
    23. DBMS_OUTPUT. Put_line (' process failed:' |) SQLCODE. ': ' || SQLERRM);
    24. END VIEW_TIME_SP;

    Appreciate your help.

    Thank you

    Whenever you write dynamic SQL code, during the debugging phase, display the dynamic string before running it.  For example

    V_SQL: = ' SELECT COUNT (*) IN "| V_ROW_COUNT | 'FROM ' | V_VIEW_NAME;
    dbms_output.put_line (v_sql |) '= v_sql in view_time_sp");
    IMMEDIATELY RUN V_SQL;

    You will see that v_sql is something like:

    SELECT COUNT (*) VIEW_X INTO0'

    You do not want the value of v_row_count; you want the name v_row_count, and he didn't need to be part of the dynamic statement.  Try this:

    V_SQL: = ' SELECT COUNT (*) FROM "| V_VIEW_NAME;
    dbms_output.put_line (v_sql |) '= v_sql in view_time_sp");
    EXECUTE IMMEDIATE V_SQL IN v_row_count;

  • Cannot create Materialized View using the PL/SQL procedure

    Hello

    I have a question related to the creation of materialized view.
    I have a stored procedure that creates the materialized view. When you try to perform this procedure, I get not enough privileges error: ORA-01031.

    When I run the content of this procedure as a PL/SQL block anonymous their materialized view is created without any complications.
    Can you please advice me on this subject?
    It is even possible to create a materialized view in the stored procedure as I found no info on this subject.

    Thank you
    Petr

    Hi chudapet,

    Whenever you make in procedure, you must have direct subsidies and not through a role.

    Most likely the grant to create a materialized view is available via a role to your username.
    Assign a direct grant to the user:

    grant create materialized view to scott;
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    
  • Using views dba within procedures

    I am trying to write a proc of the abandonment of the old partitions.

    Can we use s/n views (dba_tab_partitions) inside a procedure.

    create or replace procedure test_Purge as
    part_name varchar2 (30);
    Start
    Select nom_partition from part_name dba_tab_partitions where TABLE_NAME like 'DET_NOTES' and PARTITION_POSITION = 1;
    dbms_output.put_line ('Partition that is deleted is :'|| part_name);
    run immediately 'alter table drop partition DET_NOTES | part_name | "update of the global index";
    end;
    /


    Will this work?

    Thanks in advance.

    Hello
    The limitation of the example is that if you execute the procedure with the other user, you won't catch the scores. The solution is to use sys.all_tab_partitions for your chosen in. I tried it and it works like charm.
    Best regards!

  • 2 problems: cannot see the preview of the images in my files and can not see the name of my files in some of the views.

    Yesterday, 18:46

    Some time ago, when I went to my files using Windows Vista, I could already see the preview of the images in my folder. But now, all I see is either a glass with brushes (the MS Paint logo) for JPG images and a background painted with paint brushes on my BMP images. So, how to get back to see previews in my folder?

    I also have another problem: in a few other cases, I see that the name of the program or file when I have the view defined as tiles, details or list. But when I choose one of the views icon (or small icons, medium icons, large icons and Extra large icons) I don't see the name of the program or file.

    How can I solve these 2 problems?

    I think I can answer the first question. I'll check back for an answer to your 2nd question.

    RE: Can't see thumbnails (excerpts), only the icons

    Start button > in the search box, type Folders options > view tab > ONE- always check "show icons, never thumbnails" > OK for the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

Maybe you are looking for