extract data from a table to a text file

I need to extract data from a table to a text file, I twist my output is the following...

bash-3. $00 vi tap3roamercosts_20110915144318.txt
lines of 'tap3roamercosts_20110915144318.txt' 393948, 23464348 characters
^ LAFGTD | N | 2011090203000001 | 13242514000064 | 1. 0 | 20. 41220 | 02-SEVEN.-11. 01-SEPT.-11. 0 | 13244
755. 64. 70. 0093794428588 | 0093796234547 | 0 | S2 | E | 412200306902634 | 8. 1. 61500 | 16081 |
| HW | Call to the Roamer. 0 | I have | Roaming billing Inroamer Plan | 1_0_1 | LKA | N_I_Independent
the time of day. Rate of Roamer SMST systems | AFGTD20110902030000010001013242514000064 |
|||||||||||||||||||||

AFGTD | N | 2011090203000001 | 13242612000044 | 1. 0 | 20. 41220 | 02-SEVEN.-11. 01-SEPT.-11. 0 | 13244
853. 44. 70. 234. 0093793252818 | 0 | S2 | E | 412200303198150 | 8. 1. 61000 | 12403 | HW | -Ro
bitter call | 0 | I have | Roaming billing Inroamer Plan | 1_0_1 | N_I_Independent time of Da
There | Rate of Roamer SMST systems | AFGTD20110902030000010001013242612000044 |
||||||||

AFGTD | N | 2011090203000001 | 13242612000047 | 1. 0 | 20. 41220 | 02-SEVEN.-11. 01-SEPT.-11. 0 | 13244
853. 47. 70. 234. 0093793252818 | 0 | S2 | E | 412200303198150 | 8. 1. 61000 | 12403 | HW | -Ro
bitter call | 0 | I have | Roaming billing Inroamer Plan | 1_0_1 | N_I_Independent time of Da
There | Rate of Roamer SMST systems | AFGTD20110902030000010001013242612000047 |
||||||||
.
.
.
.
.

Please help me how to format my output each record in simple lines in oracle sqlplus. Here are the settings I used...

TERMOUT OFF SET;
SET ECHO OFF;
SET LINESIZE 100000;
THE VALUE OF NEWPAGE 0;
SET SPACE 0;
SET PAGESIZE 50000;
SET FEEDBACK OFF;
SET THE OFF POSITION;
SET TRIMSPOOL
SET THE TAB

And what was wrong with the answers that you have on your previous thread?

How to extract data in a text file

Please do not ask the same question again. If there is a problem with the answers provided, then continue on the same thread that tell people what is the problem.

Saying that, this is another possibility for you...

As user sys:

CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
/
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
/

As myuser:

CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                     ,p_dir IN VARCHAR2
                                     ,p_header_file IN VARCHAR2
                                     ,p_data_file IN VARCHAR2 := NULL) IS
  v_finaltxt  VARCHAR2(4000);
  v_v_val     VARCHAR2(4000);
  v_n_val     NUMBER;
  v_d_val     DATE;
  v_ret       NUMBER;
  c           NUMBER;
  d           NUMBER;
  col_cnt     INTEGER;
  f           BOOLEAN;
  rec_tab     DBMS_SQL.DESC_TAB;
  col_num     NUMBER;
  v_fh        UTL_FILE.FILE_TYPE;
  v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
BEGIN
  c := DBMS_SQL.OPEN_CURSOR;
  DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
  d := DBMS_SQL.EXECUTE(c);
  DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
  FOR j in 1..col_cnt
  LOOP
    CASE rec_tab(j).col_type
      WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
      WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
      WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
    ELSE
      DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
    END CASE;
  END LOOP;
  -- This part outputs the HEADER
  v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
  FOR j in 1..col_cnt
  LOOP
    v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
  END LOOP;
  --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
  UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
  IF NOT v_samefile THEN
    UTL_FILE.FCLOSE(v_fh);
  END IF;
  --
  -- This part outputs the DATA
  IF NOT v_samefile THEN
    v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
  END IF;
  LOOP
    v_ret := DBMS_SQL.FETCH_ROWS(c);
    EXIT WHEN v_ret = 0;
    v_finaltxt := NULL;
    FOR j in 1..col_cnt
    LOOP
      CASE rec_tab(j).col_type
        WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                    v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
        WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                    v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
        WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                    v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
      ELSE
        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
      END CASE;
    END LOOP;
  --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
    UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
  END LOOP;
  UTL_FILE.FCLOSE(v_fh);
  DBMS_SQL.CLOSE_CURSOR(c);
END;

This allows the header line and the data to write into files separate if necessary.

for example

SQL> exec run_query('select * from emp','TEST_DIR','output.txt');

PL/SQL procedure successfully completed.

Output.txt file contains:

empno,ename,job,mgr,hiredate,sal,comm,deptno
7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10

The procedure allows for the header and the data to separate files if necessary. Just by specifying the file name "header" will put the header and the data in a single file.

Adapt to the exit of styles and different types of data are needed.

Tags: Database

Similar Questions

  • AppleScript - extraire extract values from a table, create a text file with these values

    Hello world

    Lets say I have a table that looks a bit like this

    And this table I would create 2 text files (or even more, depending on how many switchnames are there) who look a bit like these

    Is it still possible?

    I suppose to create a Service (which can be called in numbers) with Automator which includes an Applescript script - but - no idea since the script is not one of my strong suits.

    There is not need to be perfect, because tables are not necessarily the model presented above - so to tweek the script to the application will be necessary. The text files can be created/saved in the same folder as the file numbers is in.

    Y at - it script-genius out there?

    See you soon

    Florian

    Select the column of fist of the data, and then run this script by copying the Forum and paste it into the script editor.  The files will appear on the desktop

    say application "Numbers".

    say front document to tell the worksheet active

    say ( class is worn) fromfirst table whose selection range

    selectionRange defined in column 1 of the selection

    set cnt to 0

    the value destRange for range

    the value currentList to {}

    -the list of switches

    Repeat with acellule in selectionRange cells

    -say acellule to set the value on the NTC

    pass the value to the value of cell

    if and ((cnt > 0) (switch is not missing value) and (currentList is not contain switch)) then

    switch and the value in the currentList currentList

    end if

    NTC put to the cnt + 1

    end Repeat

    -Display dialog box "to the list of items is:" & currentList & "a list" & (currentList County) ".

    Repeat with aswitch in currentList

    " game textOut to '# Script generated with Applescript for switch' & aswitch &"

    # on "& (today's date) &"

    !

    conf t

    "

    set cnt to 0

    Repeat with acellule in selectionRange cells

    -say acellule to set the value on the NTC

    pass the value to the value of cell

    -Display dialog "aswitch is []" & aswitch & "] and switch is []" & switch & "]".

    if (aswitch contains the switch) then

    the value cellCol to address a column of first cell of acellule

    address of line of first cell value cellRow in of acellule

    value to the aport (value of the cell of the column (cellCol + 1) cellRow) integer

    the value vlan for the (value of the cell cellRow of column (cellCol + 2)) integer

    the value desc to the (value of the cell cellRow of column (cellCol + 3))

    " put to textOut textOut &.

    !

    "" IG 1/0 interface / "& aport &.

    switchport mode access

    switchport access vlan "" & vlan & ""

    Description LINK TO "" & desc & ""

    "

    on the other

    -Display dialog box "did not: []" & aswitch & "] and []" & switch & "]".

    end if

    NTC put to the cnt + 1

    end Repeat

    Set myFile to open for access (path to the Office as text) & aswitch & '_output.txt' the with write permission

    textOut write to myFile

    MyFile close access

    end Repeat

    end say

    end say

    end say

  • Extract data from the table on hourly basis

    Hello

    I have a table that has two columns date all the hours of the base and the response time. I want to extract data from the date corresponding previous hourly basis with the response time. The data will be loaded into the table every midnight.

    for example: today date 23/10/2012
    I want to extract data from 22/10/12 00 to the 22/10/12 23

    The sub query pulls the date as demanded, but I'm not able to take the time to answer.

    with one also
    (select min (trunc (lhour)) as mindate, max (trunc (lhour)) as AVG_HR maxdate)
    SELECT to_char (maxdate + (level/25), "dd/mm/yyyy hh24") as a LEVEL CONNECTION dates < = * (1) 24;

    Please help me on this.

    Try this

    SELECT * FROM table_nm
     WHERE to_char(hour,'DD') = to_char(SYSDATE-1,'DD')
    
  • wanted to extract data from nested table pl/sql Ref Cursor getting an erro

    create or replace type 'DEPT12' as an object (dno number (2), dname varchar2 (30), varchar2 (50)) loc;

    create or replace type dept_tab in the table in "DEPT12".

    create or replace type 'LOC12' as an object (locno number, loc_name varchar2 (100))

    create or replace type loc_tab in the table of "LOC12.

    create or replace type dept_loc_rec1 as an object (dept_tab, eno number, loc_dt loc_tab dept_dt);

    Create type dept_loc_tb as table of the dept_loc_rec1

    create table dept_loc_tb_bk1 (dept_dt dept_tab, eno number, loc_dt loc_tab)
    NESTED TABLE dept_dt
    STORE AS dept_tab12,
    NESTED TABLE loc_dt
    STORE AS loc_tab12




    insert into dept_loc_tb_bk1 values (dept_tab (dept12(3,'ABD','LOC')
    dept12(4,'ABD','LOC')
    (, dept12(5,'ABD','LOC')), 3, loc_tab (loc12(21,'AAB'),
    loc12(22,'AAB'),
    loc12(23,'AAB')));

    When I try to extract data from Ref cursor to pl/sql table that I get an error ora-06504: pl/sql: return types of the result set of variables or request do not match.
    I created a table nested, as well as the pl/sql nested table object dept_loc_tb and I said the same dept_loc_tb lv_dept_loc_tb, but trying to get in this variable we get an error above.

    Please anyone can solve my problem.
    -----------------
    declare
    type cr is ref cursor;
    cr_obj cr;

    lv_dept_loc_tb dept_loc_tb;

    Start
    Open cr_obj to select dept_dt, eno, dept_loc_tb_bk1 loc_dt;
    collect the fetch cr_obj in bulk in lv_dept_loc_tb;
    close cr_obj;
    end;

    Your query selects 3 distinct columns requires so 3 collections of matching types. You want to treat these 3 columns as an object of type DEPT_LOC_REC1:

    SQL> declare
      2  type cr is ref cursor;
      3  cr_obj cr;
      4
      5  lv_dept_loc_tb dept_loc_tb;
      6
      7  begin
      8  open cr_obj for select dept_dt,eno,loc_dt from dept_loc_tb_bk1;
      9  fetch cr_obj bulk collect into lv_dept_loc_tb;
     10  close cr_obj;
     11  end;
     12  /
    declare
    *
    ERROR at line 1:
    ORA-06504: PL/SQL: Return types of Result Set variables or query do not match
    ORA-06512: at line 9
    
    SQL> declare
      2  type cr is ref cursor;
      3  cr_obj cr;
      4
      5  lv_dept_loc_tb dept_loc_tb;
      6
      7  begin
      8  open cr_obj for select DEPT_LOC_REC1(dept_dt,eno,loc_dt) from dept_loc_tb_bk1;
      9  fetch cr_obj bulk collect into lv_dept_loc_tb;
     10  close cr_obj;
     11  end;
     12  /
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.
    P.S. discover sys_refcursor.

  • Is it possible to see/get the data from the table to a dump file

    I have files dmp generated using expdp on oracle 11 g...

    expdp_schemas_18MAY2013_1.dmp

    expdp_schemas_18MAY2013_2.dmp

    expdp_schemas_18MAY2013_3.dmp

    Can I use a settings file given below to get the data from the table in the file sql or impdp the only option to load the data of table in database.

    VI test1.par

    USERID = "/ as sysdba".

    DIRECTORY = DATA

    dumpfile=expdp_schemas_18MAY2013%S.dmp

    SCHEMAS = USER1, USER2

    LOGFILE = user_dump_data.log

    SQLFILE = user_dump_data. SQL

    and impdp parfile = test1.par.

    No,

    DataPump cannot retrieve a dumpfile data in a flat file.

    Dean

  • Help to import the data from the catalog to a text file (csv import, delimited by tabs, excel)

    Hi All-

    I was hitting my head on this one for a few days now. It seems that something that has probably been done before and should not be so difficult, but I found few cases of help in the documentation from Adobe (and researched a lot of google).

    I have a catalog of retail sale of 100 pages with approximately 1000 products in InDesign CS5. I have a spreadsheet excel with the names of products this year, prices and descriptions of update. Normally, we would go through one by one and cut and paste. This year, I thought I would try to skip this step. There are plugins that do this, but they are not cheap, and we are not big. Upgrade to CS5 of CS2 is a big investment in and of itself.

    ssp_temp_capture.jpg

    Here is an example of the data (I use a vertical bar as a separator character):

    28392779 | 3627 | Super top | Get a handle on the pleasure. Wrap the cord around the axis and s '. | 6½ "long
    | $10

    Then... standard excel file exported to a delimited format (I use OpenOffice to export in order to avoid the problem of excel citing darn close * everything *). In the InDesign file, we have a component of text for grouped each name, description, and price. The Group has a title of the product ID script and each field within the group is labelled accordingly (name, id, description). Thus, the Group: 3627, point: description (name or price).

    Pseudocode:

    Open the file

    Analyze the data in a table

    Scroll through the InDesign file group

    Check the script group label, look it up in the table, assign values to the fields

    Easy right?

    I'm not new to javascript, but it is not my tongue harder. With this effort, I had problems as simple as the syntax for the identification of the groups by their label. Anyway, here is the code (it is not pretty as the only way that I could not even run to scroll the table of data line by line and then scroll the entire InDesign file for each row of data. And, Yes, it takes about an hour to run--but it * is * run):

    myDocument var = app.activeDocument;

    data var file = File("/Users/reddfoxx/Desktop/2010Sept8CatDesc.csv");
    DataFile.Open ("r");

    data var = datafile.read)

    data = data.split("\n");


    the data array is indexed from 0
    field 0 is the internal ID
    field 1 is the product ID
    field 2 is the name of the product
    zone 3 is the description
    field 4 are the dimensions
    zone 5 is the price

    for (x = 0; x < data.length; x ++) {}

    data [x] = data [x].split("|");


    for (var z = 0; z < myDocument.groups.count (); z ++) {}
    {If (myDocument.groups.item (z) .label == {data [x] [1])}
    myGroup = myDocument.groups.item (z);

    for (var y = 0; y < myGroup.textFrames.count (); y ++) {}
    If (myGroup.textFrames.item .label (y) == "name")
    {
    myGroup.textFrames.item (y) .silence = data [x] [2];

    }



    If (myGroup.textFrames.item (y) .label = 'description')
    {
    myGroup.textFrames.item (y) .silence = data [x] [3];
    }

    If (myGroup.textFrames.item .label (y) == 'dimensions')
    {
    myGroup.textFrames.item (y) .silence = data [x] [4];
    }

    If (myGroup.textFrames.item (y) .label = 'price')
    {
    myGroup.textFrames.item (y) .silence = data [x] [5];
    }


    }
    }
    }
    }

    For someone who is not familiar with the groups and scripts, unfortunately, you cannot process blocks of text within a group without using the group. At least, that's what I understand.

    Any help would be appreciated. Even just to find how to approach a particular in the document, so that I don't have to scroll through the entire file and do a comparison for each element would be a big improvement.

    Thanks in advance.

    -Redd

    Hey!

    You have nice little problem here

    Well, unfortunately, InDesign CS5 is a bit heavy on the labels of script, there were some changes and other things. In CS4 and before, when you call pageItem.item (myItemName), you would get called from script, but in CS5, it has been changed, and now you get the element name that is in the layers palette. Now you can easily copy all the script tags, new place, and then it would be easy to access items by name of the element.

    This will copy all the labels current script name of the element:

    for(var i = 0; i < app.activeDocument.allPageItems.length; i++)
      app.activeDocument.allPageItems[i].name = app.activeDocument.allPageItems[i].label;
    

    Now, when you have all the names in place, you can access them like this:

    app.activeDocument.groups.item(data[x][1]).textFrames.item("name").contents = data[x][2];
    app.activeDocument.groups.item(data[x][1]).textFrames.item("description").contents = data[x][3];
    app.activeDocument.groups.item(data[x][1]).textFrames.item("dimensions").contents = data[x][4];
    app.activeDocument.groups.item(data[x][1]).textFrames.item("price").contents = data[x][5];
    

    I hope that helps!

    --

    tomaxxi

    http://indisnip.WordPress.com/

  • Export data from Oracle table to a .csv file by putting a condition on the value of a column

    Hello gurus,

    I have the following data in my table

    ROWID name version date

    1 oracle 11.1 20/12/2013

    Java 2 7 12/10/2011

    1 oracle 12.1 28/12/2013

    1 oracle 10.2 12/06/2010

    Now I need a general sql/plsql code who wrote the columns with a specific value to the rowid.

    My output should look like

    1,Oracle,11.1,12/20/2013

    1,Oracle,12.1,12/28/2013

    1,Oracle,10.2,06/12/2010

    Here, I want to pass the value as a parameter dynamically

    Can someone help me with the sql/plsql.

    Hello

    If you use the IN operator:

    Select rowid_col

    || ',' || name_col

    || ',' || version_col

    || ',' || To_char (date_col, 'HH24:MI:SS of Mon-DD-YYYY') AS csv_text

    from your_table

    where rowid_col IN (& input_values);

    then & input_values can be a unique number (e.g. 1) or a list separated by commas (for example, 1,2,3) numbers.  Don't put NO space around the comma.

  • Using a substitution variable to extract data from a table

    Hello

    I work with a simple program that asks the user to enter any information which will focus on a table in the DB.
    So far, I read 1 000 ways to accomplish this, and none of them work.
    PROMPT
    ACCEPT var PROMPT 'Enter var' 
    DECLARE
    ........
    
    BEGIN
    SELECT &var
    FROM &table
    WHERE var=tablevar;
    .........
    
    END;

    Hello!

    You have a lot of mistakes in your code.
    I did something similarly...

    SQL>
    SQL>
    SQL> set serveroutput on
    SQL> DECLARE
      2  p_no number := &p_no;
      3  v_planet starbright.planet%type;
      4  BEGIN
      5
      6  -- INSERT p_no
      7  -- INTO starbright;
      8  SELECT planet
      9  INTO v_planet
     10  FROM starbright
     11  WHERE planet_num = p_no;
     12
     13  dbms_output.put_line( 'Result: ' || v_planet );
     14  END;
     15  /
    Enter value for p_no: 367
    old   2: p_no number := &p_no;
    new   2: p_no number := 367;
    Result: Venus
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    T

  • Extraction of data from two tables without discounting

    Hi friends,

    I have a problem I want to extract data from two tables without discount in the text field when I will enter any value in a text field, then the value of corressponding must come to textfield corressponding.

    for example. There are two table A and B.
    Table A has Colunm

    S_ID number;
    C_ID Varchar2 (30);
    VARCHAR2 (4) s;

    Second table B Colunm name

    S_ID number;
    What varchar (30);
    L_Name varchar (20);

    When I enter in a text field then the c_id 101 s_id, dry, first_name and last_name should come to corressponding text without refresh fields.

    How can I do that.

    Thank you
    Maury

    You can use Ajax and there are tons of good examples out there for this purpose;
    For example [http://apex.oracle.com/pls/otn/f?p=31517:236:1876567353842241]

  • Script Insert statement to extract data from Table in Oracle 7i

    Hi all, I have an old Oracle legacy system that works for more than 15 years. Every now and then, we need to extract data from this table @ ORacle 7i to import to Oracle 10 G.

    My thoughts are to create a script to Insert statements in oracle 7 and that, to be deployed to Oracle 10 G.

    I found cela scripts in Google and don't know exactly how it works. No explanation on these scripts, would be greatly appreciated. I find that this format can help to produce a set of insert statements in this table to the last table to 10G.

    < pre >
    -Step 1: create this procedure:
    create or replace function ExtractData (v_table_name varchar2) return varchar2 as
    Boolean b_found: = false;
    v_tempa varchar2 (8000);
    v_tempb varchar2 (8000);
    v_tempc VARCHAR2 (255);
    Start
    for tab_rec in (select table_name from user_tables where table_name = upper (v_table_name))
    loop
    b_found: = true;
    v_tempa: =' select ' insert into ' | tab_rec.table_name |' (';
    for col_rec in (select * from user_tab_columns)
    where
    table_name = tab_rec.table_name
    order by
    column_id)
    loop
    If col_rec.column_id = 1 then
    v_tempa: = v_tempa | " ' || Chr (10) | " ' ;
    on the other
    v_tempa: = v_tempa |', ". Chr (10) | " ' ;
    v_tempb: = v_tempb |', ". Chr (10) | " ' ;
    end if;
    v_tempa: = v_tempa | col_rec.column_name;
    If instr(col_rec.data_type,'CHAR') > 0 then
    v_tempc: = "' |' | col_rec.column_name |'| " ' ;
    elsif instr (col_rec.data_type, 'DATE') > 0 then
    v_tempc: = "' to_date ("'| to_char('|| col_rec.column_name||',''mm/DD/YYYY HH24 '') | ") (', "' dd/mm/yyyy hh24"') "';
    on the other
    v_tempc: = col_rec.column_name;
    end if;
    v_tempb: = v_tempb | " ' || Decode('|| col_rec.column_name||',''Null'','||v_tempc||') | " ' ;
    end loop;
    v_tempa: = v_tempa |') values ('| v_tempb |'); "from ' |" tab_rec.table_name | « ; » ;
    end loop;
    If not b_found then
    v_tempa: ='-Table ' | v_table_name | 'not found ';
    on the other
    v_tempa: = v_tempa | Chr (10) | "select"-commit; "double;';
    end if;
    Return v_tempa;
    end;
    /
    display errors

    -STEP 2: run the following code to extract the data.
    Go head
    set pages 0
    game of stripes on
    fixed lines 2000
    the feeding off value
    trigger the echo
    var retline varchar2 (4000)
    coil c:\t1.sql
    Select 'set echo off' from dual;
    Select 'spool c:\recreatedata.sql' from dual;
    Select ' select "-these data was extracted on" | TO_CHAR (sysdate, "mm/dd/yyyy hh24" ") double;' double.

    -The following two lines as repeat as many times as the tables that you want to extract
    exec: retline: = ExtractData ('dept');
    print: retline;

    exec: retline: = ExtractData ('emp');
    print: retline;

    Select 'off spool' from dual;
    spool off
    @c:\t1

    -Step 3: run the updated c:\recreatedata.sql waiting for output to recreate the data.

    Source: http://www.idevelopment.info/data/Oracle/DBA_tips/PL_SQL/PLSQL_5.shtml




    < / pre >

    Hello

    Well what this script do.
    You will pass a table name as input to the function that will return varchar2 (string - insert statement). It will generate 2 t1.sql of sql script that contains the output sequence.

    Will use the first passed the user_tables scipt to check if the input table name exists and if there is the will reterive user_table_columns column names and generate the following sql script.
    Now, this t1.sql will run to generate a final sript formally orders insert that will run you on the target schema (make sure that the table exists).

    * #t1.sql*

    set echo off
    spool recreatedata.sql
    select '-- This data was extracted on '||to_char(sysdate,'mm/dd/yyyy hh24:mi') from dual;
    select 'insert into MY_OBJECT1 ('||chr(10)||'OWNER,'||chr(10)||'TOTAL) values ('||decode(OWNER,Null,'Null',''''||OWNER||'''')||','||chr(10)||''||decode(TOTAL,Null,'Null',TOTAL)||');' from MY_OBJECT1;
    select '-- commit;' from dual;
    spool off
    

    Then @t1.sql runs, and the general insert for the infeed table table.

    -- This data was extracted on 03/09/2009 23:39
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('MDSYS', 92800);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('TSMSYS', 256);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('DMSYS', 15104);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('TESTME', 128);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('PUBLIC', 2571392);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('OUTLN', 768);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('CTXSYS', 21888);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('OLAPSYS', 78336);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('KLONDIKE', 2432);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('SYSTEM', 51328);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('EXFSYS', 21504);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('DBSNMP', 4096);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('ORDSYS', 216192);
    
    INSERT INTO MY_OBJECT1 (OWNER, TOTAL)
      VALUES   ('SYSMAN', 111744);
    
    -- commit;
    

    Hope this helps
    Concerning

  • How to ETL extract data from database Oracle 11.1 using Cognos Data Manager 10.1

    Hello

    I need to run the IBM Cognos Data Manager 10.1 version ETL tool for extracting data from the Oracle11.1 database.

    My understanding is that, from the point of view of database, the best way would to have a stored procedure that will provide a reference cursor in the ETL client tool.

    However, a database procedure the ETL tool running seems not to be possible in this version of the data manager.

    If someone has done this before? What is the best way for this snippet to do?

    Thank you

    Emilija

    Annabelle says:

    My reading of original question: "What is the best way for this snippet to do?"

    Sorry - is NOT helping.

    The BEST way to extract data from a table is to use a SELECT statement.

    You said you want to do.

    So just repeat your original question instead of those that ask you to answer will not move forward us.

  • Extracting data from table without refreshment and without using the tab key.

    Hi friends,

    I have a problem I want to extract data from table without discount in the text field without using the Tab key. When I enter a field value any value then the text corressponding should enter into corressponding textfield without using the Tab key.

    for example. When I get back emp_id 101 in a text field then first_name and last_name, address would come in to the text fields corressponding without refresh and use the Tab key.

    How can I do that.

    Thank you
    Maury

    Hi Maury,

    I guess it's similar to: retrieving data without refreshing rather than Re: value of a textfield should enter into an another textfield without using the TAB ?

    If so, the only change you want to bring on the first is to use the parameter "Onkeyup" instead of "onchange" in the 'HTML Form attributes of the element' element.

    Note, however, that the user must move away from the issue at some point (for example, to click on a button), so the onchange will fire anyway.

    Andy

  • Java code to extract data from a custom table to form

    I need to transfer data from one table to the form. Please provide the java method to do this. The table has 4 columns. I need to fill in all the data form as level. It will be a great help if sombody can provide the same java code and the logic of xpress to achieve the same.

    Please refer to the documentation for the com.waveset.util.JdbcUtil API. The class has functions for the features you need.

  • Extract data from Hyperion Planning

    Hello Experts,

    I have a question that is asked repeatedly. Question is, how to extract data from planning with ODI?

    I saw most of the answers saying we need to extract the data of Essbase (as Essbase stores planning data). But what happens if I want to retrieve data that is stored in the relational repository with its data into Essbase? As list of smart, the textual data in the case of system 9?


    Thank you
    SIDD

    It is possible to extract the essbase data and then link to the planning of the relational tables to transform the digital value of essbase in text planning.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Extract data from graph XY

    Hello

    Here, I want to extract data from the XY graph. I joined vi which I use for table 1 d. How can I use this for 2D table VI.

    Thank you

    Hi Alex,

    You can use the same approach.

    The only thing that changes is the function ArraySubset in its adaptation to the 2D matrix. You can select rows or clumns of your data (depending on how you have generated them)...

Maybe you are looking for

  • HP Officejet 7610: HP Officejet 7610 doesn't connect to the computer

    Hello. Recently my 7610 Officejet printer has started to behave strangely. First wireless seems to be lost and I need to start using a cable connection. These days the scan function is not available for the analysis of the function of the computer is

  • Is the WRE54G compatable with the WAG54GS?

    Hello my client has a WAG54GS router and I just bought a WRE54G range extension to help its wireless network coverage. But I have since views information here and there on the possibility that these two devices are incompatible with each other. Could

  • BlackBerry voice recognition issue Z10

    It is actually more a teach my Z10 how to say a name correctly... My daughters name is Ciara Celtic pronouciation (R a key ') however my Z10 refuses to acknowledge the crrrect pronunciation and stress I say call (sigh ra), which is embarrassing. I wa

  • CameraDemo does not not on 4.6.1

    Hi all. You try to run the Application CameraDemo of I m, we can find on the JDE 4.6.0 on 4.6.1 Javelin device and it s does not. The problem it s, I don't see the field of the camera where it should be. Any solution? Thank you very much!

  • I have a problem with the sounds playing on their own despite the sounds stopped.

    Original title: don't stop sounds On my WIndows 7 machine when sounds play everything that they don't stop. The last piece of the sound keeps going. It does not drag the last piece, but the last tone just keeps going. I tried different speakers. Any