PLSQL exercise 5: batch query of table creation statements for a specified Solution

Source: Internet
Author: User
Create   Or   Replace   Procedure Batch_check_ddl_p (in_username In   Varchar2 ) Is    /*  **************************************** * *********************** Name: batch_insert_tablea_p * purpose: -- batch query the table creation statement * imput: -- table name sub-* output: -- N/A * Author: -- Cici * createdate: -- 2012, 12, 24 * updatedate: --*************************************** ********************  */  V_table_names Varchar2 ( 10000  );  Cursor Cur Is   Select      Object_name     From  All_objects  Where Owner =   Upper  (In_username)  And Object_type =  '  Table  '  ;  Begin   /*  Query the information of all tables belonging to the ss_hr user  */    Open  Cur;  Fetch Cur Into  V_table_names;  While Cur %  Found Loop Exit   When   Not Cur % Found; --  Ends if the cursor ends at the end.   /*  Retrieve table creation statements through Traversal  */  Dbms_output.put_line (  '  ========================================================== ==========  '  ); Dbms_output.put_line (dbms_metadata.get_ddl (object_type  =>  '  Table  '  , Name  =>   Upper  (V_table_names ),  Schema  =>  Upper  (In_username); dbms_output.put_line (  '  ========================================================== ==========  '  ); Fetch  Cur  Into  V_table_names;  End  Loop;  Close  Cur;  End Batch_check_ddl_p;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.