Can we export DATA from all tables in a schema?

Hi,
I have a question; Can we export all the DATA from all the tables present in the schema to any source (eigther CSV, TXT, DAt, etc..)?
Or
Can I have a PL/SQL procedure to display DATA from all Tables in a schema?
With Best Regards,
- Naveed

Hi,
This is pretty much what you need.
DECLARE
V_COUNT NUMBER;
v_sql varchar2(1000);
IN_OWNER_NAME VARCHAR2(100) := 'AP' ; -- SCHEMA NAME
TYPE T_COL_NAME is table of varchar2(1000) index by binary_integer;
v_col_tbl t_col_name;
BEGIN
FOR i in
(SELECT object_name
FROM dba_objects
     WHERE owner = IN_OWNER_NAME
     AND object_type ='TABLE'
and rownum < 2)
LOOP
v_sql := 'SELECT COUNT(*) FROM ' || i.object_name ;
EXECUTE IMMEDIATE v_sql INTO V_COUNT;
if v_count > 0 then
v_sql := 'SELECT * FROM ' || i.object_name ;
select column_name
bulk collect
into v_col_tbl
from DBA_TAB_COLUMNS
WHERE TABLE_NAME = I.OBJECT_NAME
AND OWNER = IN_OWNER_NAME;
-- start selecting the column and exporting using the column names selected.     
end if;
if v_col_tbl.count > 0 then
for i in v_col_tbl.first .. v_col_tbl.last
loop
DBMS_OUTPUT.PUT_lINE(v_col_tbl(i));
end loop;
end if;
DBMS_OUTPUT.PUT_lINE( i.object_name || '-' || v_count);
END LOOP;
END;
- Ronel

Similar Messages

  • [b]export data from a table to a csv or .txt file[/b]

    hi plz i need help in how to export data from a table to a csv or .txt file

    If you are using TOAD, then you can execute the statement like SELECT * FROM TABLE1
    Then, you can go to Output Grid and you can say save as and you can save it as you want, excel, tab delimited or whatever.
    Thanx,
    Cheers,

  • Export data from a table to text file using srcipt task

    Hi
    i am new to SSIS
    i have to export data from a table and append it into a existing file through SSIS script task
    please help
    Thanks
    Umesh

    Hi Umesh,
    The data structure of the source table and the structure of the destination file are the same, right? Is the destination file a flat file? Do you have to do it through Script Task? If the destination file is a flat file, this can be done easily by using
    the stock tasks/components other than .NET code. In the Data Flow Task, we choose the appropriate source adapter (such as OLE DB Source or ADO.NET Source) to extract data from the source table, perform transformation if necessary, and then load to the destination
    file via a Flat File Destination. When setting up the Flat File Destination, uncheck the “Overwrite data in the file” option so that the extracted data will be appended to the existing file.
    If you need to implement it through Script Task/Component indeed, you may benefit from the following code examples:
    http://stackoverflow.com/questions/8070163/how-to-add-custom-footer-to-an-ssis-flat-file-seperate-component-or-script-tas 
    http://stackoverflow.com/questions/8467326/add-header-and-footer-row-flat-file-ssis 
    If you need further help about the script, I suggest that you ask a new question in .NET forums where you can get more dedicated support:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=netdevelopment 
    Regards,
    Mike Yin
    TechNet Community Support

  • How to Export data from a Table to Excel using PL/SQL Code

    Hi,
    I need to export data from a table to the excel sheet using PL/SQL script.
    could you pls provide with custom codes or sample procedures.
    Bobby

    http://asktom.oracle.com/pls/ask/f?p=4950:8:7947129213057862756::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:728625409049

  • How can i extract data from oracle table  to flat file or excel spread shee

    Hello,
    DB Version is 10.1.0.3.0
    How can i extract data from oracle table to flat file or excel spread sheet by using sub programs?
    Regards,
    D

    Here what I did
    SET NEWPAGE 0
    SET SPACE 0
    SET LINESIZE 80
    SET PAGESIZE 0
    SET ECHO OFF
    SET FEEDBACK OFF
    SET VERIFY OFF
    SET HEADING OFF
    SET MARKUP HTML OFF SPOOL OFF
    Sql> SPOOL bing
    select * from -------;
    SPOOL OFF;
    I do not see file.
    I also tried
    Sql> SPOOL /tmp/bing
    select * from -------;
    SPOOL OFF;
    But still not seeing the fie,

  • Export data from database table before database migration

    Hello,
    We are planning to migrate our SAP ERP 6 Ehp4/NW7.01 from Oracle 11.2 to IBM DB2 v. 9.7 database. During test migrations I have established that we spend a lot of time for one particular table (COEP). Because we donu2019t have possibility to archive this table before migration I have an idea to export data from previous years from this table to the file system (using an ABAP report), delete those data from table before migration and then after migration, import back to the database from the file system.
    Does anybody have any concerns or suggestions about this idea?
    Thank you for your answers
    Andrej

    Hello Andrej,
    I strongly do not recommend to do so.
    I am not sure whether technically this could work at all..
    Even it if would work .. In order to really save time, the export and the import would have to be a dirty one (meaning the system is operational and in production). With this there is a high risk to produce inconsistencies on this table.  And you most likely will receive no support if something unforeseen happens and you end with problems.
    Also  your approach (if it should work at all) , would have to be tested thoroughly by you , also protecting the table from any changes.
    I do not believe that this can save any effort compared to implementing advanced migration techniques like table splitting.
    On top, you would go high risk to end with an unsupported system, with not using official migration procedures
    Hans-Juergen

  • Can not export data from form tracker

    Hi there,
         I have set up a lovely form for collecting data. It all comes into the Adobe Tracker and the Responses file fine.
         What i wish to do is export data from the responses file into another format. I should be able to do it from the Export button on the left but it is 'blanked out' and does nothing if I push it. I can't find any details on here or the internet relating to this. And yes, there is data in the file to export .
    Hoping you can help.
    Many thanks in advance.

    I have the same problem but... I created two forms for two separate purposes and have had responses to both.
    One of them allows me to export the data and the other does not.
    Does anyone out there have an answer for this seemingly random anomoly?
    Regards
    Sydman

  • Export data from a table (not a bi query) to pdf

    Hi experts,
    I would like to know the way to export data in VC 7.0 from a table to a pdf. This table is generated NOT from a BI query but from an SQL using connection to Oracle DBMS.
    Thank you all
    Alessandro

    Hi,
    Use this link:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/47fe4fef-0d01-0010-6f87-ed8ecb479123]
    and Go through he below thread.
    [Re: Export data from visual composer to excel]
    Regards,
    Govindu
    If helpful reward points

  • Exporting data from database tables to a XML file

    Hi,
    We want to export data from Oracle database tables to an XML
    file. What tool can we use for this purpose, and how do we go
    about it ?
    Can we extract data only from an Oracle8 database, or can we
    extract data from Oracle7.3 databases too ?
    Any help in this regard would be appreciated.
    Thanks
    Dipanjan
    null

    Dipanjan (guest) wrote:
    : Hi,
    : We want to export data from Oracle database tables to an XML
    : file. What tool can we use for this purpose, and how do we go
    : about it ?
    : Can we extract data only from an Oracle8 database, or can we
    : extract data from Oracle7.3 databases too ?
    : Any help in this regard would be appreciated.
    : Thanks
    : Dipanjan
    Start by downloading the XML SQL Utility and make sure you have
    the approriate JDBC 1.1 drivers installed for your database.
    There are samples which will get you going included in the
    archive.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Issues in exporting data from SAP tables in SE16 to excel

    1.How can I save an sap table (displayed through SE16) in ECC6 into a pivot table in excel. [ I have seen this option in R/3 4.7, but do not see it in ECC.]
    2.How can I copy all the rows of a 3000 row SAP table in SE16 and paste the values into excel. I need to do this in one shot and not page by page.
    3.What option do I need to select inorder to preserve the formating of the values while saving as a local file in a spreadsheet format. All the values with leading zeros,like company codes gets saved with only their numeric portion when I save a SAP table as a local file. for eg company code 0001 gets saved in excel as just 1,company code 0056 gets saved as 56 etc. How do I prevent this? What option do I need to set in SAP in order for the values to be downloaded as is, without any truncation of leading zeros.

    1.  I don't know.  How about creating a pivot after exporting data
    2. System->List->Save->local file->clipboard
    Then paste whole lot in Excel
    3. This is a problem with Excel, not SAP.  SAP exports with leading zeroes.
    You could export as flat file & import into Excel into a spreadsheet with an appropriate numbering format.

  • How to Export Data from a table in database directly to Excel.

    Hi,
    I have some sqls that i need to run on a daily basis.My client wants them to be scheduled through a job and the result output of the query should be in the form of Excel.
    Now i am no sure how to do this.Is there any in-built function in the DBMS package that can export data drectly from table to Excel. ?
    Please Help me !!

    SQL> spool exlfile.cvs
    SQL> set colsep ','
    SQL> set lines 300
    SQL> set pages  9999
    SQL> set trimspool on
    SQL>
    SQL> select * from DEPARTMENTS
      2  /
    DEPARTMENT_ID,DEPARTMENT_NAME               ,MANAGER_ID,LOCATION_ID
               10,Administration                ,       200,       1700
               20,Marketing                     ,       201,       1800
               30,Purchasing                    ,       114,       1700
               40,Human Resources               ,       203,       2400
               50,Shipping                      ,       121,       1500
               60,IT                            ,       103,       1400
               70,Public Relations              ,       204,       2700
               80,Sales                         ,       145,       2500
               90,Executive                     ,       100,       1700
              100,Finance                       ,       108,       1700
              110,Accounting                    ,       205,       1700
              120,Treasury                      ,          ,       1700
              130,Corporate Tax                 ,          ,       1700
              140,Control And Credit            ,          ,       1700
              150,Shareholder Services          ,          ,       1700
              160,Benefits                      ,          ,       1700
              170,Manufacturing                 ,          ,       1700
              180,Construction                  ,          ,       1700
              190,Contracting                   ,          ,       1700
              200,Operations                    ,          ,       1700
              210,IT Support                    ,          ,       1700
              220,NOC                           ,          ,       1700
              230,IT Helpdesk                   ,          ,       1700
              240,Government Sales              ,          ,       1700
              250,Retail Sales                  ,          ,       1700
              260,Recruiting                    ,          ,       1700
              270,Payroll                       ,          ,       1700

  • How can I retrieve data from one table to another automatic in SQL?

    Hi, everione,
    I am having a big problem, trying to create datebase.
    I have 3 tables: SUPERAVATAR, MASTERAVATAR, MEGAAVATAR.
    - SuperAvatars are heroes in an online role playing gaming. They have an ID, ‘superavatarID’ which contain an UNIQUE NUMBER NOT NULL PRIMARY KEY to identify them.
    A wisdom – ‘trickster’,’conjuror’,’magician’, etc..
    A current owner… who is the user or player of the game and has that Super Avatar– we associate the link to USERID to know the person.
    SuperAvatars can be fathers or mothers of Mega Avatars.
    -MegaAvatars are the children of SuperAvatars…. They also have an ID UNIQUE NUMBER NOT NULL PRIMARY KEY to indentify them.
    A magic power – it can be a ‘Leader’ or ‘Sheep’…
    A ‘parent’ – parent is the number identifying to know to who Super Avatar belongs.
    e.g.
    SUPERAVAT WISD CURRENTOWNER FATHEROF MOTHEROF
    1 Thick 3 1
    2 Mentally Ch. 11 3
    3 Smart 9 2
    4 Genius 16 4
    5 Thick 19
    MEGAAVATARID MAGICPOWER PARENT
    1 MAGICIAN 1
    2 WIZARD 3
    3 SORCERER 2
    4 MAGICIAN 4
    -We see that MEGAAVATAR 1 has a magic power as Magician and his father is ‘1’. ‘1’ identifies the SUPERAVATAR.
    We see SUPERAVATARID…. who has the number ‘1’? the first in the row… who has wisdom – thick and he belongs to the USER with ID number 3.
    -We see MEGAAVATARID… we choose the number 2…. His magic power is as WIZARD… and his father is the number 3.
    We see SUPERAVATARID now… we look up the SuperavatarID 3…. We can see he has a wisdom – GENIUS… who belongs to the USERID 16 and he is father of MEGAAVATAR number 2.
    The list can carry on and never stop.
    I have this Problems:
    We create in this example 3 tables: Users, SuperAvatar, MegaAvatar
    SQL
    CREATE TABLE users(userID NUMBER CONSTRAINT pk_user PRIMARY KEY,email VARCHAR2(50) NOT NULL UNIQUE,password VARCHAR2(15) NOT NULL UNIQUE,subscription CHAR(8) NOT NULL CHECK (subscription IN('ACTIVE' , 'INACTIVE' ) ) );
    CREATE TABLE superavatar(superavatarID NUMBER CONSTRAINT pk_superavatar PRIMARY KEY, wisdom VARCHAR2(19) NOT NULL CHECK (wisdom IN ('THICK', 'MENTALLY CHALLENGED', 'AWAKE', 'SMART', 'GENIUS')), currentOwner NUMBER NOT NULL, fatherOf NUMBER,motherOf NUMBER);
    CREATE TABLE megaavatar (megaavatarID NUMBER CONSTRAINT pk_megaavatar PRIMARY KEY, magicPower VARCHAR2(12) NOT NULL CHECK (magicPower IN('TRICKSTER','CONJUROR','MAGICIAN','WIZARD','SORCERER')), parent NUMBER);
    Now, the 3 tables are created…..
    What happen when we try to insert values to this table?
    In this case we insert to User Table some examples:
    INSERT INTO users VALUES('3','[email protected]','great78','ACTIVE');
    INSERT INTO users VALUES('9','[email protected]','chrisandra)','ACTIVE');
    Now, we insert to SuperAvatar some examples;
    INSERT INTO superavatar VALUES('1','THICK','3','1','');
    INSERT INTO superavatar VALUES('3','SMART','9','3','');
    |
    |
    ‘9’ is the UserID that we already insert to the User table
    What’s the problem?
    We have to insert manually the data from USERID to CURRENTOWNER as we didn’t match or link CURRENTOWNER from SUPERAVATAR Table to USERID from USER Table with a SQL CODE.
    What happen if we have thousands of USERS that they register to this game…? We will never know to how belongs that SUPERAVATAR but if someone do it manually can spend a year.
    I am trying to fix this problem …. I add in SUPERAVATAR TABLE ‘CHECK’ in currentOwner..
    SQL> CREATE TABLE superavatar
    (superavatarID NUMBER CONSTRAINT pk_superavatar PRIMARY KEY, wisdom VARCHAR2(19) NOT NULL CHECK (wisdom IN ('THICK', 'MENTALLY CHALLENGED', 'AWAKE', 'SMART', 'GENIUS')),
    currentOwner NUMBER NOT NULL CHECK (currentOwner IN(SELECT userID FROM users)),
    fatherOf NUMBER,
    motherOf NUMBER);
    ERROR:
    ORA-02251: subquery not allowed here
    It doesn’t work.
    Please HELP, I have exam tomorrow
    thank you
    Desy

    Hallo,
    you can use trigger on table USER and fill the userid in AVATAR.currentowner,
    but i don't understand, how you join these tables ?
    Which user id must come in which column currentowner ?
    Design problem ?
    Regards
    Dmytro

  • Exporting Data from one table to another

    How do I do this. I'm truly a novice DBA in training. Can someone please help me

    Sandra,
    What is it you are trying to do?
    If you want to create a copy of the table under a different schema then import using
    FROMUSER and TOUSER parameters. (If the table
    exists in the instance you want the copy in you can do the following:
    CREATE TABLE <new table_name> AS
    SELECT <field names or * for all fields>
    FROM <existing table_name>
    Hope this helps,
    Steve

  • Can I Upload Data from a table to matrix, while matrix is bound to another table??

    Hi Friends,
            right now i am uploading records to matrix row by row, but when records are very large in numbers then its taking too much time, so how can i upload these record directly to matrix without changing current data binding of the matrix.

    Hi Shrinivas,
    Can you please paste your code how your are copying your data to matrix ?
    Also have you tried this ?
    this.oDBDataSource= (DBDataSource)oForm.DataSources.DBDataSources.Add("@DETAILTABLE");
                                                                oForm.DataSources.DBDataSources.Item("@DETAILTABLE").InsertRecord(oDBDataSource.Size);
    this.oDBDataSource.SetValue("U_Field1", oDBDataSource.Size - 1, Convert.ToString(oDBDataSource.Size));
    this.oDBDataSource.SetValue("U_ICode", oDBDataSource.Size - 1, Convert.ToString(oRecSet.Fields.Item("ItemCode").Value));
    this.oDBDataSource1.SetValue("U_IName", oDBDataSource.Size - 1, Convert.ToString(oRecSet.Fields.Item("ItemName").Value));
    Finally use oMatrix.LoadFromDataSource()
    Hope it helps.
    Thanks & Regards
    Ankit Chauhan

  • How can i select data from unknown table

    My Drear:
    for example scott scema
    I would like to write statment like this
    declare
    xx number;
    tab_name :='emp';
    select empno into xx from tab_name;
    end;
    how cai I do it
    Regards

    You could easily find examples either in the online-help on using google.
    http://fdegrelle.over-blog.com/article-11899896.html

Maybe you are looking for