3 Replies Latest reply: Feb 1, 2013 2:55 AM by Karthick_Arp RSS

    table scripts

    RajeshKanna
      hi,

      how can i read the tablescripts in HR schema.

      can any one help me the which package i am using to retrive the entire scripts??

      Cheers,
      Rajesh
        • 1. Re: table scripts
          971895
          you can get the information using data dictionary and not table script info.
          • 2. Re: table scripts
            971895
            Try like..

            SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name)
            FROM USER_ALL_TABLES u
            • 3. Re: table scripts
              Karthick_Arp
              RajeshKanna wrote:
              hi,

              how can i read the tablescripts in HR schema.

              can any one help me the which package i am using to retrive the entire scripts??

              Cheers,
              Rajesh
              You can get the list of tables in a schema using the dictionary table [url http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2105.htm#i1592091]ALL_TABLES. And you can use the oracle supplied package [url http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_metada.htm#ARPLS026]DBMS_METADATA to get the create table script
              select table_name, 
                     dbms_metadata.get_ddl('TABLE', table_name, user) table_script
                from all_tables
               where owner = 'HR'