Extract DDL from Database

Hi all,
I am trying to extract the DDL statements for my database indexes. I am using Oracle 8i. The two option:
(1) You could run the export utility with ROWS=NO, but the output was hard to re-use because of quoted strings.
(2) DBMS_METADATA.GET_DDL but it is only available for Oracle 9i and above. So it does me not good.
Are there any other option beside (1) that I can use in Oracle 8i. Any suggestion would be appreciated.
Thanks,
Ravi

You could run the export utility with ROWS=NO, but the output was hard to re-use because of quoted strings.You haven't mentioned the OS.
you can create the indexfile(ddl file) and remove the quoted strings using global replacement and you would have a clean SQL file with DDL's.

Similar Messages

  • Extract data from database tables and download in pdf and csv

    extract data from database tables and download in pdf and csv
    hi how can i re-write my old form procedure in adf java. the procedure used to extract data from diffirent table and dowload the data in pdf and csv.am not downloading image, i what to extract data from diffirent tables in my database and download that data in pdf and csv. i would like to write this in java adf.i just what direction am not asking anyone to do my work this is my learning curve
    the form code is
    function merge_header3 return varchar2 is
    begin
         return '~FACILITY DESCRIPTION~ACCOUNT NO~BRANCH CODE~BANK REF NO.~P/P/ AMOUNT~Postal Address 1~Postal Address 2~Box Postal Code~Dep. Date~Month~BANK NAME~BRANCH NAME~ACCOUNT TYPE~DESCRIPTION~OBJECTIVE DESCRIPTION';
    end;
    procedure download_file (i_pbat integer) is
      dir varchar2(80);
      file_name1 varchar2(80);
      file_name2 varchar2(80);
      appl_code varchar2(80);
      fil1 client_text_io.file_type;
      fil2 client_text_io.file_type;
      dat varchar2(1000);
      DATA VARCHAR2(1000);
      bvspro varchar2(100);
      ssch   varchar2(100);
      bvspro_total number(20,2);
      ssch_total   number(20,2);
      grand_total  number(20,2);
      cnt    integer;
      cursor pbat is
           select *
           from sms_payment_batches
           where id = i_pbat
      cursor pay  (pb_id integer) is
           select *
           from sms_payment_vw
           where pbat_id = pb_id
           order by subsidy ASC,programme,beneficiary_name
      cursor cgref (low varchar2) is
           select *
           from cg_ref_codes
           where rv_domain ='SMS'
           and rv_low_value = low
      success boolean;     
      begin  
           set_application_property(cursor_style,'busy');
           appl_code := sms_global.ref_code('SMS','APP_CODE','SMS',0);
        dir       := sms_global.ref_code('SMS','PAY_DIR','c:\sms\batch_payments',0);
             success := webutil_file.create_directory(dir);
         if webutil_file.file_is_directory(dir) then
             null;
    --         message ('directory exists');
        else
    --                  message ('create directory ');
             success := webutil_file.create_directory(dir);
    --         if success then        message ('directory exists');    end if;
        end if;     
        for c_pbat in pbat loop
             file_name1 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'pay.txt';
             file_name2 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'merge.txt';
    --message('create files ');
    --         fil1  := client_text_io.fopen (file_name1,'W');
    --         fil2  := client_text_io.fopen (file_name2,'W');
        fil1  := client_text_io.fopen (file_name1,'W','');
        fil2  := client_text_io.fopen (file_name2,'W','');
                   dat :=                       'FROM ACCOUNT NUMBER'
                                                                ||'~'||'FROM ACCOUNT DESCRIPTION'
                                                                ||'~'||'MY STATEMENT DESCRIPTION'
                                                                ||'~'||'BENEFICIARY ACCOUNT NUMBER'
                                                                ||'~'||'BENEFICIARY SUB ACCOUNT NUMBER'        
                                                                ||'~'||'BENEFICIARY BRANCH CODE'
                                                                ||'~'||'BENEFICIARY NAME'
                                                                ||'~'||'BENEFICIARY STATEMENT DESCRIPTION'
                                                                ||'~'||'AMOUNT';
             --     client_text_io.put_line(fil1,dat);
             bvspro:= null;
             ssch  := null;
             cnt := 0;     
             dat := '~'||lpad('~',16,'~');
             for c_pay in pay(c_pbat.id) loop
    --message('cpay loop ' || cnt);              
               if bvspro is null then
                     dat := lpad('~',16,'~');
                     dat := utility.put_field(1,c_pay.programme,dat,'~');     
               client_text_io.put_line(fil2,dat);
               dat := utility.put_field(1,c_pay.subsidy,dat,'~');
               client_text_io.put_line(fil2,dat);
               dat := merge_header3;
                     client_text_io.put_line(fil2,dat);
                     bvspro := c_pay.programme;
                     ssch := c_pay.subsidy;
                     grand_total := 0;
                     bvspro_total := 0;
                     ssch_total := 0;
               end if;
               if bvspro <> c_pay.programme then
                     dat := lpad('~',16,'~');
                     dat := utility.put_field(5,ssch_total,dat,'~');
                     dat := lpad('~',16,'~');
                     dat := utility.put_field(5,bvspro_total,dat,'~');
               dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
                     client_text_io.put_line(fil2,dat);
                     dat := lpad('~',16,'~');
               client_text_io.put_line(fil2,dat);
                     dat := utility.put_field(1,c_pay.programme,dat,'~');     
               client_text_io.put_line(fil2,dat);
                     bvspro := c_pay.programme;
               dat := utility.put_field(1,c_pay.subsidy,dat,'~');
               client_text_io.put_line(fil2,dat);
               dat := merge_header3;
                     client_text_io.put_line(fil2,dat);
                     bvspro := c_pay.programme;
                     ssch := c_pay.subsidy;
                     bvspro_total := 0;
                     ssch_total := 0;
                     cnt :=0;
             end if;                           
               if ssch <> c_pay.subsidy then
                     dat := lpad('~',16,'~');
                     dat := utility.put_field(5,ssch_total,dat,'~');
                     dat := lpad('~',16,'~');
               client_text_io.put_line(fil2,dat);
               dat := utility.put_field(1,c_pay.subsidy,dat,'~');
               client_text_io.put_line(fil2,dat);
               dat := merge_header3;
                     client_text_io.put_line(fil2,dat);
                     ssch := c_pay.subsidy;
                     ssch_total := 0;
                     cnt :=0;
             end if;                           
            bvspro_total := bvspro_total + c_pay.amount;
            ssch_total   := ssch_total   + c_pay.amount;              
                  grand_total  := grand_total  + c_pay.amount;              
            cnt := cnt +1;
    --message('bfore write file 2 ' );              
            client_text_io.put_line(fil2
                                   ,cnt
                            ||'~'|| c_pay.beneficiary_name
                                                                ||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER ||''            
                                                                ||'~'||c_pay.BRANCH_CODE             ||''           
                                                                ||'~'|| c_pay.BENEFICIARY_STATEMENT_DESC            
                                                                ||'~'|| c_pay.AMOUNT                                
                            ||'~'|| c_pay.address_line1
                            ||'~'|| c_pay.address_line2
                                                    ||'~'|| c_pay.postal_code
                                                    ||'~'|| TO_CHAR(c_pay.deposit_date,'DD-Mon-YYYY')
                                                    ||'~'|| c_pay.month
                                                    ||'~'|| c_pay.bank
                                                    ||'~'|| c_pay.bank_branch
                                                    ||'~'|| c_pay.account_type
                                                    ||'~'|| c_pay.subsidy
                                                    ||'~'|| c_pay.programme)
                  DATA :=                                  c_pay.FROM_ACCOUNT_NUMBER                   
                                                                ||'~'||c_pay.FROM_ACCOUNT_DESCR                    
                                                                ||'~'||c_pay.MY_STATEMENT_DESCR                    
                                                                ||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER
                                                                ||'~'
                                                                ||'~'||c_pay.BRANCH_CODE            
                                                                ||'~'||c_pay.BENEFICIARY_NAME                      
                                                                ||'~'||c_pay.BENEFICIARY_STATEMENT_DESC            
                                                                ||'~'||c_pay.AMOUNT;                                
            DATA := REPLACE(DATA, ',' , ' ' );
            DATA := REPLACE(DATA, '~' , ',' );
    --message (cnt ||' ' || data);       
    --message('bfore write file 1 ' );              
                  client_text_io.put_line(fil1, data);
             end loop;
    --message ('end of write');         
                 dat := lpad('~',16,'~');
                 dat := utility.put_field(6,ssch_total,dat,'~');
                 dat := lpad('~',16,'~');
           dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
                 dat := utility.put_field(5,bvspro_total,dat,'~');
              client_text_io.put_line(fil2,dat);
              dat := lpad('~',16,'~');
           client_text_io.put_line(fil2,dat);
           dat := utility.put_field(1,'Grand Total:' ,dat,'~');
                 dat := utility.put_field(5,grand_total,dat,'~');
              client_text_io.put_line(fil2,dat);
             -- close file
    for i in 1..50 loop  
           if substr(i,-1) = 0 then
                 message ('flush ' || i);
           end if;                 
                  client_text_io.put_line(fil1, lpad(' ',2000));
                  client_text_io.put_line(fil2, lpad(' ',2000));
                  client_text_io.put_line(fil1, lpad(' ',2000));
                  client_text_io.put_line(fil2, lpad(' ',2000));
    end loop;
             client_text_io.fclose(fil1);
             client_text_io.fclose(fil2);
        end loop;
       set_application_property(cursor_style,'default');
        exception
             when others then
                  message(sqlcode ||' ' ||sqlerrm);
       end download_file;    i try this but this code onlydownload image not data from database tables
        public void downloadImage(FacesContext facesContext, OutputStream outputStream)
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            // get an ADF attributevalue from the ADF page definitions
            AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("DocumentImage");
            if (attr == null)
                return;
            // the value is a BlobDomain data type
            BlobDomain blob = (BlobDomain) attr.getInputValue();
            try
            {   // copy the data from the BlobDomain to the output stream
                IOUtils.copy(blob.getInputStream(), outputStream);
                // cloase the blob to release the recources
                blob.closeInputStream();
                // flush the output stream
                outputStream.flush();
            catch (IOException e)
                // handle errors
                e.printStackTrace();
                FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), "");
                FacesContext.getCurrentInstance().addMessage(null, msg);
            }

    You should ask your forum in the ADF-forum.

  • How to extract data from database to XSLT?

    I want to generate a report by XSLT, but the data is extracted from the database. I will use Access/SQL server for my database. Can i write SQL in XSLT to extract data from database? Have any sample code or reference website to show how it work?
    THX

    for example: "SELECT code, name FROM TABLE FOR XML RAW"
    String xml = null;
    if(rs.next()){
      xml = rs.getString(1);
    }You will get xml string something like this:
    <row empID="1234"/><row empID="1235"/>
    You can construct a DOM using this xml data and operate on it.
    However you may explore more on resulting xml format.
    A different SQL Query (rather than using XML RAW) may give output in a more desired format.

  • Extract data from database to xml ?

    is there any API, classes or tools ready to extract data from oracle database and generate xml files, Instead to implement a DOM class and build little by little the xml file??
    thanks for every info in advance.

    Yes, download the Oracle XML Development Kit from Oracle's website and look at the documentation of the XML-SQL Utility.

  • Extract DDL from an exp dmp file

    One feature I would find handy is the ability to read an exp dmp file to extract DDL statements from it. Are there any plans to include such a tool?

    I assume you are using traditional export/import.
    So run the import with show=Y and it will write all the DDLs in the logfile.
    Amardeep Sidhu

  • Extract HTML from database

    How can i extract data from a database that has html or
    coldfusion language in it. My browser keeps trying to process it. I
    want to display it as raw text.

    Also you may follow this tutorial at,
    http://tutorial92.easycfm.com/

  • Extract results from database

    I want to be able to re-create a test report from the results database and do statistical analysis on the results of specific tests. Are there any querries or other database tools that have already been developed for this?

    Hi Gumby,
    As far I know there aren't any tools developed specifically for this kind of a task. However depending on the environment you're using there will probably be tools developed for easily retrieving information from databases.
    In TestStand we have SQL step types that allow you to easily retrieve data from databases. There are two examples that ship with TestStand I would suggest looking at in addition to the help for these step types.
    C:\Program Files\National Instruments\TestStand 3.1\Examples\Database
    (This path will vary depending on the version of TestStand and your installation directory.)
    If you're using LabVIEW or LabWindows/CVI we have special tools developed to simplify communicating to databases.
    c.vp?cid=6429〈=US>LabVIEW Database Connectivity Toolkit
    NI LabWindows/CVI Enterprise Connectivity Toolset
    There are also lots of examples available by searching our website.
    If you're using another environment there are probably tools available as well, I just don't know enough to recommend any.
    I hope this helps!
    Regards,
    Sarah Miracle
    National Instruments

  • Extracting data from database table containg perticular string.

    hi every body ,
    can any body provide me a solution for extracting the OT01 data from kna1 table where the OT01 ends with the string 'town' .
    exe : the O/P should be
    midTOWN
    newTOWN
    there is one more query i am not able to execute the following statement .......why?
    select ORT01 from KNA1 where ORT01 CS 'TOWN'.
    write:/ kna1-ort01.
    endselect.
    it is showing a syntax error.......
    Thank You.

    Hi Tippu,
    Your select statement consists of CS whcih may not be a valid comparision operator because of which error is displayed have look of this..
    data itab like kna1 occurs 0 with header line.
    parameters: s_town like kna1-ORT01.
    select ORT01 from KNA1 into table itab where ORT01 = s_town.
    Fetch the city and concatenate with TOWN your issue will be sloved.
    Cheers!!
    Balu
    Edited by: Balu CH on Oct 21, 2008 11:13 PM

  • Extracting Permissions from database in JAAS

    I am working on enterprise application where we want to implement JAAS and extract the permissions and roles from the data base but not from the policy file.Can any body post me the solution.

    Hi, raghave66!
    You should read the documents below.
    http://java.sun.com/j2se/1.4/docs/guide/security/PolicyFiles.html
    You'll have to create your own Policy Class instead of
    using default com.sun.security.auth.PolicyFile.class
    regards,
    kt

  • Need to Extract Image from Database for Report

    Greetings,
    I have two databases that I could work with; both are for card access users.  One is an old Access 98 database, the other is a SQL database,
    In the tables I can "see" references to employee_photo and badge_picture_path respectively, but when I run the Report, the Image is not retrieved.
    Any ideas how I can overcome this ?
    I am trying to create a hard copy in a binder, so that new guards can thumb through the binder and familiarize themselves with employees.
    Thanks
    Peter

    Hi Peter,
    What format are the pcitures saved in.  I believe they have to be either BMP or JPEG.  Any other formats will not work in Crystal. 
    Have a look with the sample Extreme database.  The Employee table has a picture field, very similar to what you are using.  If you create a simple report with it, can you see the pictures? 
    Thanks,
    Brian

  • Extracting date from oracle/other databases exactly to java

    Hello Friends,
    Iam creating a simple program which extracts data from any database and stores it in an XML file and also it can extract data from an XML file and updates the database.
    My program is just getting the tablename as an input and from that it builds the query (select * from tablename). Through ResultSet, Iam extracting date fields with getDate() method of ResultSet, which is yeilding converted dates [In oracle if date is 23-DEC-1980, Im getting it as 1980-12-23 in java]. Even getString() method of ResultSet doesn't work.
    I want my program to work with any database engine, which may have their own date formats. Kindly can anyone suggest me a way to extract date from any database exactly as it is to java.
    NOTE:: I can't use to_char(datefield) type commands in SQLQUERY as the only input to my program is tablename and my query is, select * from tablename.
    Regards,
    Ch.Praveen.

    HI Friends,
    Thanks for your fast replies. My program is extracting data from a database and generating an XML file for it, which is as follows.
    <?xml version="1.0" encoding="UTF-8"?>
    <table tableName="EMP">
    <row>
    <column columnName="EMPNO" columnType="NUMBER">7369</column>
    <column columnName="ENAME" columnType="VARCHAR2">'SMITH'</column>
    <column columnName="JOB" columnType="VARCHAR2">'CLERK'</column>
    <column columnName="MGR" columnType="NUMBER">7902</column>
    <column columnName="HIREDATE" columnType="DATE">'1980-12-17'</column>
    <column columnName="SAL" columnType="NUMBER">800</column>
    <column columnName="COMM" columnType="NUMBER" />
    <column columnName="DEPTNO" columnType="NUMBER">20</column>
    </row>
    <row>
    <column columnName="EMPNO" columnType="NUMBER">7499</column>
    <column columnName="ENAME" columnType="VARCHAR2">'ALLEN'</column>
    <column columnName="JOB" columnType="VARCHAR2">'SALESMAN'</column>
    <column columnName="MGR" columnType="NUMBER">7698</column>
    <column columnName="HIREDATE" columnType="DATE">'1981-02-20'</column>
    <column columnName="SAL" columnType="NUMBER">1600</column>
    <column columnName="COMM" columnType="NUMBER">300</column>
    <column columnName="DEPTNO" columnType="NUMBER">30</column>
    </row>
    </table>
    Here you can observe that HIREDATE column is having date in different format than in oracle. We are getting an error while we are extracting data from an XML file and updating the database, as dateformats differ. Can anyone provide a solution, which extracts date from database to java exactly as per the dateformat in database.

  • Question on pulling data from database

    I have a question. I have one form in designer and i need to extract data from database. database is in sequel. any help on how do i do this or how can i do this?

    If you use a process to interact with the database, this recent thread is very related and would be helpful:
    http://www.adobeforums.com/webx/.59b639e7/0
    scott

  • EXPORT DDL from TOOLS menu in Rel 4

    I am trying to use the tools->export-> objects--> tables option to extract DDL from tables
    I have given the file name to save in options. After clicking APPLY nothing is happening.
    File is created with 0 bytes

    I do have a similar issue with the export function. Below is all of the
    information - downloaded today (Fri, 17-Feb-06 and am current with
    updates).
    The Export is not creating the expected DDL script; output file was
    created with 0 bytes.
    Other than that I like what I see in SQL Developer.
    Thank you,
    Jeff
    Downloaded          Fri, 17-Feb-06; current updates downloaded also
    SQL Developer          1.0.0.11
    Version               1.0.0.11.84
    Build Main          11.84
    JAVA               1.5.0_05
    Oracle IDE          1.0.0
    Oracle SQL Developer     10.1.3.1215
         Reports     10.1.3.1215
    Raptor Help          10.1.3.02.60
    SQL Formatter          10.1.3
    DB Version          9.2.0.6.0
    Tools -> Export -> Options - file=c:\temp\absences_test.sql; checked-storage,
                   pretty print, constraints as alters
              -> Objects - Connection-DEV2; check table ABSENCES;
         then Apply -- no output
    expected DDL for a partitioned table with
    local bitmap indexes, global b-tree indexes (PK, UK, and FK)
    OS Name     Microsoft Windows XP Professional
    Version     5.1.2600 Service Pack 2 Build 2600

  • Oracle_Datapump extracting table/columns ddl from pumpfile

    LS,
    Can I extract the xml-like information from the header of an existing datapump-file?
    Or can I create an external table (meant to read the datapump-file) without knowing at forehand how the table in the datapump-file is constructed, such as "Create my_ext_table As 'read the header' "?
    Using dynamic SQL, I would like to be able to compare the structure of an given datapump-file to the expected structure (comparison on columns, datatype etc.).
    Regards,
    André Klück

    user9074365 wrote:
    Hi All, I do have 11gr1 database on linux. I do have the full expdp dump of the source database I just need to extract the sql ddl for all the users(mroe than 10000) . . how can i extract ddl for create user statement from this dump file.impdp help=yes
    your desired option is listed

  • Is it possible to save / extract data from a MS SQL database 2008 using lookout 6.2?

    Is it possible to save / extract data from a MS SQL database 2008 using lookout 6.2?
      Now a days we are saving / extracting data in a excel spreadsheet, but we would like to do that using a database because it is better.

    You can use ODBC connection to work with SQL Server database.
    Use SQLExec object to execute the SQL statement. Here is a KB about the SQL statement.
    http://digital.ni.com/public.nsf/allkb/4ADEEA04CD24AE0B862565E20002A16F?OpenDocument
    To write data to spreadsheet is more straightforward because Lookout has built-in spreadsheet object. But you need to write SQL statement by yourself to interact with other database.
    To read the data back is the same way. Just use "select" SQL statement to query. You can use Datatable object to query.
    The "Data Source" can be "DSN = data source name;". The data source name is configured in Control Panel->Administrative Tools->Data Sources(ODBC).
    Ryan Shi
    National Instruments

Maybe you are looking for

  • Having trouble setting up a network

    My house has two macs. A powermac g5 and a imac g5. My setup is as follows. Cable modem to a router, router to the powermac g5(ethernet cable) and again the router to an airport express (ethernet cable). The imac g5 is located on a different floor of

  • Ipod Classic 80 GB will not sync to itunes, but is recognized by itunes

    I recently went to macmedics to get my ipod fixed i had broken the hardrive. they put in a new hardrive but when i went to sync my music it would only sync aboutm300 songs of my 23 GB of music before freezing the computer and throwing out error -53,

  • Troubles with a new ThinkPad W 520 - defective at receipt 3 weeks ago

    The computer ( art. 42823JG, SN xxxxx)  was defective when we recieved it ... ("freeze" at first utilisation) We downloaded a lot of tests, awaited a technicien visit, awaited 2 more days for a carrier to bring the laptop to the service center and a

  • How To Start a DATABASE created by DBCA?

    Hello Forum mates I Have created 1 database with DBCA as oracle user but when i try to startup it throws errors ORA-01078 and LRM-00109. i have created other databases manually they startup when i run .env file, where is the env file for dbca created

  • Have the requirement to get text descryption for me32k(kostl,G/L account)

    hi there. I Have the requirement for me51tcode to display field description on standard screen number is 505 and programname SAPMM06B for fields G/Laccount(SAKTO)and costcenter(KOSTL),Is there any userexit or fieldexit for that, its urgent for me, ia