How to query an external table?

hi,
Can anyone help me, I created an external table but I cannot query the table... I encountered the error SQL Error: ORA-29913: error in executing ODCIEXTTABLEOPEN callout...
Attached my SQL for your reference:
CREATE OR REPLACE DIRECTORY dat_dir AS 'pos_file';
CREATE OR REPLACE DIRECTORY log_dir AS '//10.101.21.175/pos_file/Log';
CREATE OR REPLACE DIRECTORY bad_dir AS '//10.101.21.175/pos_file/Bad';
CREATE TABLE revext (person VARCHAR2(20),
rev_jan NUMBER(4),
rev_feb NUMBER(4),
rev_mar NUMBER(4),
rev_apr NUMBER(4),
rev_mai NUMBER(4),
rev_jun NUMBER(4),
rev_jul NUMBER(4),
rev_aug NUMBER(4),
rev_sep NUMBER(4),
rev_oct NUMBER(4),
rev_nov NUMBER(4),
rev_dez NUMBER(4))
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY dat_dir
ACCESS PARAMETERS
records delimited by newline
fields terminated by ','
( person,
rev_jan,
rev_feb,
rev_mar,
rev_apr,
rev_mai,
rev_jun,
rev_jul,
rev_aug,
rev_sep,
rev_oct,
rev_nov,
rev_dez
LOCATION ('revext.dat')
Thank you,
Dexter

Hi! Thanks for your immediate response...
Here's the complete error when I tried to query the created external table.
Error starting at line 48 in command:
select * FROM revext
Error report:
SQL Error: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
error opening file pos_file/REVEXT_18225.log
29913. 00000 - "error in executing %s callout"
*Cause:    The execution of the specified callout caused an error.
*Action:   Examine the error messages take appropriate action.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How to query for two tables

    Hi,
    I have this problem, How can query a two table?
    Table A ->  Table B
    id               table-a_id
    name          table_b_name
    the relationship is one-to-many
    How can I get the result?
    Hope my question make sense
    cheers.
    thanks a lot.

    I bet you have more luck looking for an answer in a SQL forum.

  • How to Query a database table of a remote system in a program.

    How to Query a database table of a remote system in a program.
    Thanks in adv.
    -Satish

    1.Create an RFC(SE37) in Source (To Where you want to get data)
    IMPORTING MATNR
    EXPORTING : SYS TYPE SY-SYID
                         I_MARA TYPE MARA
    SELECT SINGLE * FROM MARA INTO I_MARA WHERE MATNR EQ MATNR
    2.Copy the same RFC to Target(From Where you want to get data)
    3.Create a RFC destination(SM59.) in Source
    Enter the connection type as 3 and enter the target host  and system number ( may be 00)
    4.Create a program to calling RFC in Source.
    PARAMETERS: p_matnr LIKE mara-matnr.
    PARAMETERS: p_dest LIKE rfcdes-rfcdest DEFAULT 'NONE'.
    DATA: system LIKE sy-sysid.
    DATA :i_mara TYPE mara.
    CALL FUNCTION 'XX_RFC_GET_TEST' DESTINATION p_dest
      EXPORTING
        matnr                 = p_matnr
      IMPORTING
        sys                   = system
        i_mara                = i_mara
    :-Gopeekrishnan

  • How does impdp handles external tables

    I am just done with schema import and one of the package is invalid because it is referring the External Table. I am getting the error " Table or View does not exist".
    How does impdp handles external tables ?
    Do we need to replicate the directories and files from the source to imported destination ?
    Thanks

    Hi,
    Yes...
    external table directory not available on imported destination operating system
    You need to create the directories and files from the source to imported destination
    Recompile the invalid package
    Thanks

  • Error while querying the external tables in 9i

    i am working on a project on Oracle 9iR2 on Linux AS 3.0, i am in urgent need to port my data in text files for using in the DB
    I have created an external table using the following script. While executing a query it gives the following error. Pls Hlp
    create table ap_info_ex
         (ser_no number(7),
         no_of_sps number(1),
         hpy_liq_mm number(2),
         rmp_rnk_cd number(1),
         ir number(3),
         dps_flg varchar2(1))
    organization external
    (type oracle_loader
         default directory aps_jul
         access parameters (records delimited by newline
                        fields terminated by ","
                        (sno char,
                        no_sps char,
                        hpy_mm char,
                        rmp_rnk char,
                        ir char,
                        dpsflg char))
    location ('info.txt'));
    Table has been created successfully
    but when i execute a query say
    select * from ap_info_ex;
    THIS IS THE ERROR MESSAGE I AM GETTING
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04063: unable to open log file AP_INFO_EX_6151.log
    OS error Permission denied
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    hope you would help me. i am greateful for that.

    Arun,
    Here are the things you could do.
    1. You may want to specify a logfile in your access parameters using the command 'logfile'.
    For example,
    logfile 'info.log'. You could create the file in advance and provide appropriate permissions to the operating system user(In unix, I use the commands 'touch' and 'chmod').
    2. You could specify the command
    'NOLOGFILE' in your access parameters.
    3. Provide permissions for the user to create files in the folder associated with the directory object 'aps_jul'.

  • How to update whole external table(in ABAP dictionary) from internal table at once

    Hi,
    How can I update the content of the external table (in ABAP dictionary) from the content of internal table data at once. I created the internal tables with out the header line, with the work area. I tried UPDATE TARGET_EXTERNAL_TABLE FROM TABLE INTERNAL_TABLE. But it returns 4 for sy-subrc and did not work.
    Thank you
    Regards.
    CHINTHAKA

    Hi Feiyun Wu,
    Thank you very much. Your code worked. Is there any way to replace the whole content of the external table from internal table data ?
    Regards,
    Chinthaka

  • How two link two extern tables in one in BW ?

    Hello everybody,
    I have 2 extern tables with few data (6000):
    ZETL_NEGO:
    Number/AIRPORT/DATEFROM/DATETO/AMOUNT_NF
    10;CDG;10/02/08;20/05/08;100
    ZETL_PRICE:
    AIRPORT/FARE_PUBLIC
    CDG;400
    I wanted to load these 2 tables in BW.
    And i want obtain the following result:
    10;CDG;10/02/08;20/05/08;100;400
    and not these 2 lines:
    10;CDG;10/02/08;20/05/08;100;0
       ;        ;            ;             ;     ;400
    I want join these two tables ...
    - I create an ODS specific to load ZETL_NEGO with
    KeyField=Number/AIRPORT/DATEFROM/DATETO
    - I create an other ODS specific to load ZETL_PRICE with
    KeyField=AIRPORT
    - Then, i create a third ODS which load the two precedent with
    KeyField=Number/AIRPORT/DATEFROM/DATETO
    but, yes, it doesn't work.
    These 2 tables are not join ...
    Could you give me suggestions how do this?
    Thanks in advance.
    Best Regards,
    Rod.

    Yes that way is not going to work, but when you are loading data from the first DSO, do a lookup to the second DSO with AIRPORT number. The only drawback with this is if you load the first DSO before the Second DSO, you will be losing some data and also  you might have some issue if you are doing delta load. This will work fine with full loads.
    Another option is leave the dso or create cube for each dso and create a multiprovider, and create a report off the multiprovider and when you create a report, you can use the option of 'Constant Selection' to make the report come in one line.
    And final option is to create infoset of the two DSO'es which will create one records.
    thanks.
    Wond

  • How to query in two tables

    Hi all
    How to query in two different tables? Should i use the following
    SET_BLOCK_PROPERTY('ins1', ONETIME_WHERE, 'serial = ''' || :GLOBAL.CODE || ''''); this is working but for one table if i want for both tables and and it display the related information in main form , eg..tables are referenced by primary key constraint and foreign key.
    sarah
    Edited by: SarahSarahSarah on Sep 1, 2009 4:59 AM

    For the primary forign key tables no need to create two forms use the master detail functionality of forms.
    create a Master/Detail form using the DEPARTMENT, EMPLOYEE tables.
    DEPARTMENTwill be the Master block and EMPLOYEE will be the Detail block. The join condition between the two tables is where the deptno column of DEPARTMENT is equal to the deptno column of EMPLOYEE .
    The following is an outline of the steps:
    Create the DEPARTMENT data block and include the all the fields on the form.
    Use the Form layout and only display one record at a time.
    Go back to the Object Navigator and select the "Data Blocks" tree. Make sure the DEPARTMENT block is not selected and run the Data Block Wizard again.
    Create the EMPLOYEE data block and include all of the columns.
    For the master/Detail relationship, de-select the "auto" option, use a Join relationship, choose the DEPARTMENT data block as the Master and set EMPLOYEE.DEPTNO= DEPARTMENT.DEPTNO for the join relationship.
    In the Layout Wizard for the Dependents data block, display all of the fields
    Choose a Tabular style and display 4 up to records at once with 0 space between each record.
    Save the form and run the form.
    Thanks

  • Query regarding External tables

    DECLARE
    FileIn UTL_FILE.FILE_TYPE;
    v_sql VARCHAR2 (1000);
    BEGIN
    FileIn := UTL_FILE.FOPEN ('DIR_TEMP', 'test_file_out.txt', 'R');
    IF UTL_FILE.IS_OPEN(FileIn) THEN
    LOOP
    BEGIN
    UTL_FILE.GET_LINE (FileIn, v_sql);
    dbms_output.put_line(v_sql);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    END;
    END LOOP;
    END IF;
    UTL_FILE.FCLOSE (FileIn);
    END;
    above mentioned is the procedure to read from a flat file.
    I would like to know the procedure to load flat file data into table using external tables:
    i have tried using this code but it displays errors:
    CREATE TABLE EXT_EMP
    ( EMPNO NUMBER(4), ENAME VARCHAR2(10), JOB VARCHAR2(9),
    MGR NUMBER(4), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2))
    ORGANIZATION EXTERNAL (
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY DIR_TEMP
    ACCESS PARAMETERS(
    RECORDS DELIMETED BY newline
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL(COMM NUMBER(7,2))
    LOCATION ('test_file_out.txt')
    PARALLEL
    REJECT LIMIT UNLIMITED;
    db: Oracle 11g , OS: windows vista

    the query works fine as table is created.
    but:
    select * from ext_emp;
    o/p: no rows.
    ext.bad :
    7369,SMITH,CLERK,7902,17-DEC-80,800,,20
    7499,ALLEN,SALESMAN,7698,20-FEB-81,1600,300,30
    7521,WARD,SALESMAN,7698,22-FEB-81,1250,500,30
    7566,JONES,MANAGER,7839,02-APR-81,2975,,20
    7654,MARTIN,SALESMAN,7698,28-SEP-81,1250,1400,30
    7698,BLAKE,MANAGER,7839,01-MAY-81,2850,,30
    7782,CLARK,MANAGER,7839,09-JUN-81,2450,,10
    7788,SCOTT,ANALYST,7566,19-APR-87,3000,,20
    7839,KING,PRESIDENT,,17-NOV-81,5000,,10
    7844,TURNER,SALESMAN,7698,08-SEP-81,1500,0,30
    7876,ADAMS,CLERK,7788,23-MAY-87,1100,,20
    7900,JAMES,CLERK,7698,03-DEC-81,950,,30
    7902,FORD,ANALYST,7566,03-DEC-81,3000,,20
    7934,MILLER,CLERK,7782,23-JAN-82,1300,,10
    ext.log:
    LOG file opened at 04/01/09 02:13:13
    Field Definitions for table EXT_EMP
    Record format DELIMITED BY NEWLINE
    Data in file has same endianness as the platform
    Rows with all null fields are accepted
    Fields in Data Source:
    EMPNO Integer (4)
    Record position (+0, +4)
    Terminated by ","
    Trim whitespace same as SQL Loader
    ENAME CHAR (255)
    Terminated by ","
    Trim whitespace same as SQL Loader
    JOB CHAR (255)
    Terminated by ","
    Trim whitespace same as SQL Loader
    MGR Integer (4)
    Record position (+0, +4)
    Terminated by ","
    Trim whitespace same as SQL Loader
    HIREDATE CHAR (9)
    Date datatype DATE, date mask DD-MON-YY
    Terminated by ","
    Trim whitespace same as SQL Loader
    SAL Integer (4)
    Record position (+0, +4)
    Terminated by ","
    Trim whitespace same as SQL Loader
    COMM Integer (4)
    Record position (+0, +4)
    Terminated by ","
    Trim whitespace same as SQL Loader
    DEPTNO Integer (4)
    Record position (+0, +4)
    Terminated by ","
    Trim whitespace same as SQL Loader
    error processing column HIREDATE in row 1 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 2 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 3 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 4 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 5 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 6 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 7 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 8 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 9 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 10 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 11 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 12 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 13 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column HIREDATE in row 14 for datafile c:\temp\test_file_out.txt
    ORA-01858: a non-numeric character was found where a numeric was expected
    " I tried changing hiredate "dd-mm-yy" to hiredate "dd-mon-yy" but there is no difference.

  • How can I use external tables with directories not on Oracle host?

    Oracle 11.2.0.2
    We have developers using C# to populate global temporary tables (two one header and detail with 1 to many relationbship between these two tables). The process of using C# was blowing up memory on Windows.
    As an alternative I requested them to create two CSV files and I can use sqlldr to load the detail CSV file of over 1 million rows under 15 seconds. It came to my mind that I could use external tables for this purpose with getting read of header and trailer from the CSV files.
    The issue I have is that I am not a DBA so I do not have access to OS host that Oracle instance is running. sqlldr is a client side tool, whereas external tables are server side. I was wondering if there is an alternative in 11g to use external tables without creating directories on the OS host that Oracle runs on? Are there other alternatives?
    Thanks

    905989 wrote:
    Oracle 11.2.0.2
    We have developers using C# to populate global temporary tables (two one header and detail with 1 to many relationbship between these two tables). The process of using C# was blowing up memory on Windows.
    As an alternative I requested them to create two CSV files and I can use sqlldr to load the detail CSV file of over 1 million rows under 15 seconds. It came to my mind that I could use external tables for this purpose with getting read of header and trailer from the CSV files.
    The issue I have is that I am not a DBA so I do not have access to OS host that Oracle instance is running. sqlldr is a client side tool, whereas external tables are server side. I was wondering if there is an alternative in 11g to use external tables without creating directories on the OS host that Oracle runs on? Are there other alternatives?
    Thanks
    no other alternative

  • How Can We Achieve External Table Authentication

    Hai Guru's
    I want Know The External Table Authentication By Step By Step
    Thanks

    Hi Friend,
    For External table authentication you can follow this link:
    http://obieeblog.wordpress.com/2009/06/18/obiee-security-enforcement-%E2%80%93-external-database-table-authorization/
    Thanks
    Don

  • How to query AWR views/tables?

    Hi,
    AWR reports statistics related to SQLs used in DB/application.
    I have a requirement to find out the location of those SQLs. Can anyone please help me how can I do that? Is there any internal table/view I can query to find the location?
    Regards,
    Ashok

    Hi;
    If you have metalink account, I suggest also see:
    How to Generate an AWR Report and Create Baselines [ID 748642.1]
    Which Views Can Be Used to Monitor PGA Usage in Oracle 10g and Higher? [ID 469521.1]
    Regard
    Helios

  • How to Query the Audit Tables

    Our Production system is suffering performance issues which we attribute to the large volume of records in the audit tables. We want to implement an archival solution to alleviate this, which would involve transferring older audit records to a separate database. To achieve this, we need to write SQL queries against the <app>DATAAUDIT and <app>TASKAUDIT tables in the HFM database. We are aware that we need to join other tables to see descriptions, e.g. <app>SCENARIODESC. We have also deduced the translation of Activity Codes from "HFMAuditExtractSchemaDefs.xml", which accompanies the HFM Audit Extract Utility.
    Unfortunately, there are some things which we do not know how to translate:
    1) Period (lPeriod) on the <app>DATAAUDIT table, e.g. 67108869 but need to show "Jun" etc.
    2) User (ActivityUserId) on the <app>TASKAUDIT table, e.g. -329543984
    3) Module (strModuleName) on the <app>TASKAUDIT table, e.g. #@RID@#19
    Can anyone advise how we should translate these pieces of data in order to give similar results to those seen on the Data Audit and Task Audit screens in Workspace?

    1.) Period - I'm not sure where this is coming from, but I'm pretty confident it is not sitting in the database which I find odd. I want to find this as well, but haven't had any free time to search around, sorry.
    2.) User - This one I can help you with.
    --Get Task Item Data by Hour for a given day by user
    select datepart(HOUR, cast(endtime-2 as smalldatetime)), count(activitycode) from <APP_NAME>_task_audit where activitycode in (1,4,6,8,9,12,14,15,16,21,23,44) and cast(endtime-2 as smalldatetime) between '2011-12-7 00:00:00' and '2011-12-7 23:59:59' and ActivityUserID in (select lUserID from HSV_ACTIVITY_USERS where sUserName = '<USER_NAME>') group by datepart(HOUR, cast(endtime-2 as smalldatetime))In the sample SQL Query above, I am looking for all of the task audit activity (for the specified tasks) for a specific user by hour. The part of the query you want to focus on is
    and ActivityUserID in (select lUserID from HSV_ACTIVITY_USERS where sUserName = '<USER_NAME>')The ActivityUserID in the task audit table will match up to the lUserID field in the HSV_ACTIVITY_USERS table. sUserName will be the actual text username. Depending on how you are configured, the name may look like johndoe or johndoe@Native Directory or johndoe@AD, etc. If you query that table, you'll figure it out pretty quickly.
    3.) Module ID. I can only partially assist on this one.
    This is not also in the HFM database. I suspected it might be floating in workspace; however, can't really find it there either.
    I can tell you a couple things though....
    #@RID@# Is just a placeholder for Resource ID. The important part is the number behind it. If you do a search on your folders for @RID@, you'll get one hit where it is defined as a constant, but that is it. (I was hoping a file search would reveal a table of the ID's; however, I wasn't that lucky). There is probably a table of values that correspone somewhere, but I haven't found it.
    If you do a distinct select, you'll see there's not too many ...
    select distinct strmodulename from <APP_NAME>_task_audit#@RID@#10
    #@RID@#13
    #@RID@#14
    #@RID@#16
    #@RID@#18
    #@RID@#23
    #@RID@#30
    #@RID@#32
    #@RID@#4294967295
    #@RID@#45
    #@RID@#46
    #@RID@#49
    #@RID@#52
    #@RID@#58
    #@RID@#59
    #@RID@#65
    #@RID@#66
    #@RID@#67
    #@RID@#68
    #@RID@#69
    #@RID@#7
    #@RID@#9
    HyperionReports
    How can you determine these values?
    The quick and dirty way would be to run a Task Audit Extract for a given date range as this will reveal the Module Name.
    Then execute a SQL Query on the Task Audit Table for the same data range. You could then match up the records and deduce the values.
    --Get Task Items by Date Range
    select (select sUserName from HSV_ACTIVITY_USERS where lUserID = ActivityUserID) as UserName, ActivityCode, ServerName, AppName, cast(StartTime-2 as smalldatetime), cast(EndTime-2 as smalldatetime), strDescription, strModuleName from <APP_NAME>_task_audit where cast(endtime-2 as smalldatetime) between '2011-12-7 00:00:00' and '2011-12-7 23:59:59' order by endtime ascOnce you determine the values, I would create a table in your database to hold them so that you could use them in future queries. I would also recommend you do the same with the activitycodes.

  • How to query 2 hierarchical tables and join?

    Hi
    I've been bashing my head against a well to get this to work efficiently in 10g. I can solve the following writing some pretty horrible SQL, but can't figure out how to do it elegantly and optimally.
    We have two hierarchical tables as follows:
    select * from data_categories dac
    dac_code name parent_dac_code
    10 MANAGEMENT
    20 MEDICATION 10
    30 PROCEDURE 10
    40 SURVEY
    50 ASSESS
    60 NATURE 50
    70 OBSERVE 60
    select * from data_elements des
    des_id name parent_des_id dac_code display_seq
    100 DOSE MEDICATION 1
    110 1MG 100 1
    120 2MG 100 2
    130 3MG 100 3
    140 ROUTE MEDICATION 2
    150 ET 140 1
    160 EM 140 2
    170 RESPONSE MEDICATION 3
    180 IMPROVED 170 1
    190 NOCHANGE 170 2
    200 FILED MANAGEMENT 1
    210 INPUT OBSERVE 1
    You'll note:
    1) We have hierarchies in both tables, and a fk from data_elements to data_categories via the dac_code.
    2) The depth of both data_categories and data_elements is unlimited.
    3) There is no single root node record in either table.
    4) The appropriate PK and FK indexes exist.
    We need to write a query that returns the following results:
    root_dac_code parent_dac_code des_level des_id name display_seq
    ASSESS OBSERVE 1 210 INPUT 1
    MANAGEMENT MEDICATION 1 100 DOSE 1
    MANAGEMENT MEDICATION 2 110 1MG 1
    MANAGEMENT MEDICATION 2 120 2MG 2
    MANAGEMENT MEDICATION 2 130 3MG 3
    MANAGEMENT MEDICATION 1 140 ROUTE 1
    MANAGEMENT MEDICATION 2 150 ET 1
    MANAGEMENT MEDICATION 2 160 EM 2
    MANAGEMENT MEDICATION 1 170 RESPONSE 3
    MANAGEMENT MEDICATION 2 180 IMPROVED 1
    MANAGEMENT MEDICATION 2 190 NOCHANGE 2
    MANAGEMENT MANAGEMENT 1 200 FILED 1
    You'll also note we need to return the data in order of the root_dac_code, then parent_dac_code, followed by the display_seq.
    Does anybody know how to write this query in an elegant and optimal manner?
    Many thanks for any help!
    Cheers,
    CM.

    Flakey model.
    Why does data_elements.dac_code appear to refer to data_categories.name rather than data_categories.dac_code?
    You do not appear to be ordering by root_dac_code, parent_dac_code and display_seq (if you were MANAGEMENT/MANAGEMENT would not be at the end). Did you perhaps mean ORDER BY root_dac_code, des_id, display_seq?
    Something like this perhaps?
    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> CREATE TABLE data_categories (
      2    dac_code NUMBER,
      3    name VARCHAR2 (30),
      4    parent_dac_code NUMBER);
    Table created.
    SQL> INSERT INTO data_categories VALUES (10, 'MANAGEMENT', NULL);
    1 row created.
    SQL> INSERT INTO data_categories VALUES (20, 'MEDICATION', 10);
    1 row created.
    SQL> INSERT INTO data_categories VALUES (30, 'PROCEDURE', 10);
    1 row created.
    SQL> INSERT INTO data_categories VALUES (40, 'SURVEY', NULL);
    1 row created.
    SQL> INSERT INTO data_categories VALUES (50, 'ASSESS', NULL);
    1 row created.
    SQL> INSERT INTO data_categories VALUES (60, 'NATURE', 50);
    1 row created.
    SQL> INSERT INTO data_categories VALUES (70, 'OBSERVE', 60);
    1 row created.
    SQL> CREATE TABLE data_elements (
      2    des_id NUMBER,
      3    name VARCHAR2 (30),
      4    parent_des_id NUMBER,
      5    dac_code VARCHAR2 (30),
      6    display_seq NUMBER);
    Table created.
    SQL> INSERT INTO data_elements VALUES (100, 'DOSE', NULL, 'MEDICATION', 1);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (110, '1MG', 100, NULL, 1);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (120, '2MG', 100, NULL, 2);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (130, '3MG', 100, NULL, 3);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (140, 'ROUTE', NULL, 'MEDICATION', 2);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (150, 'ET', 140, NULL, 1);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (160, 'EM', 140, NULL, 2);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (170, 'RESPONSE', NULL, 'MEDICATION', 3);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (180, 'IMPROVED', 170, NULL, 1);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (190, 'NOCHANGE', 170, NULL, 2);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (200, 'FILED', NULL, 'MANAGEMENT', 1);
    1 row created.
    SQL> INSERT INTO data_elements VALUES (210, 'INPUT', NULL, 'OBSERVE', 1);
    1 row created.
    SQL> SELECT dc.root_dac_code, de.parent_dac_code,
      2         de.des_level, de.des_id, de.name, de.display_seq
      3  FROM  (SELECT LEVEL des_level, des_id, name, parent_des_id,
      4                CONNECT_BY_ROOT (dac_code) parent_dac_code, display_seq
      5         FROM   data_elements da
      6         START WITH parent_des_id IS NULL
      7         CONNECT BY PRIOR des_id = parent_des_id) de,
      8        (SELECT CONNECT_BY_ROOT (name) root_dac_code, name dac_code
      9         FROM   data_categories
    10         START WITH parent_dac_code IS NULL
    11         CONNECT BY PRIOR dac_code = parent_dac_code) dc
    12  WHERE  de.parent_dac_code = dc.dac_code
    13  ORDER BY dc.root_dac_code, de.des_id, de.display_seq;
    ROOT_DAC_CODE  PARENT_DAC_CODE   DES_LEVEL DES_ID NAME    
    ASSESS         OBSERVE                   1    210 INPUT   
    MANAGEMENT     MEDICATION                1    100 DOSE    
    MANAGEMENT     MEDICATION                2    110 1MG     
    MANAGEMENT     MEDICATION                2    120 2MG     
    MANAGEMENT     MEDICATION                2    130 3MG     
    MANAGEMENT     MEDICATION                1    140 ROUTE   
    MANAGEMENT     MEDICATION                2    150 ET      
    MANAGEMENT     MEDICATION                2    160 EM      
    MANAGEMENT     MEDICATION                1    170 RESPONSE
    MANAGEMENT     MEDICATION                2    180 IMPROVED
    MANAGEMENT     MEDICATION                2    190 NOCHANGE
    MANAGEMENT     MANAGEMENT                1    200 FILED   
    12 rows selected.
    SQL>

  • How to overwrite a log and bad file in external table in oracle 10g

    Hi,
    I have used external table in oracle 10g.whenever use select query in external table orace internally create one log file in specified directory,
    but this log file is growing.How can i overwrite the log file(old to replace with new).I need overwrite a log and bad file in external table.
    kindly give the solutions.
    By
    Siva

    I don't believe that is possible with the LOGFILE clause, but it may be with the BADFILE clause. Here is an excerpt from the documentation :
    The LOGFILE clause names the file that contains messages generated by the external tables utility while it was accessing data in the datafile. If a log file already exists by the same name, the access driver reopens that log file and appends new log information to the end. This is different from bad files and discard files, which overwrite any existing file. NOLOGFILE is used to prevent creation of a log file.
    If you specify LOGFILE, you must specify a filename or you will receive an error.
    If neither LOGFILE nor NOLOGFILE is specified, the default is to create a log file. The name of the file will be the table name followed by _%p and it will have an extension of .log.

Maybe you are looking for

  • Is there a quick way to batch erase existing caption data on photo import?

    I am new to Aperture coming from iView Media Pro. So far, it looks like Aperture has a lot more powerful capabilities for managing metadata. One thing I have noticed is that most of the photos I import have metadata already stored in the caption fiel

  • WorkFlow Track List

    Hello each champion, Pls guide me how can I retrive the wrokflow track list. I mean a date wise wrokflow execution report. But it should be compiled list of workflows. Not for singal one. I have already tried, SWI5 - it is the nearest, provides the t

  • Cant Find Album Art?!!

    I reformatted my computer and put all my songs back in itunes and did the get album art function and it found most of them but it says it cant find a few and they are some of the ones that it had before i reformatted. I have checked the info and its

  • Apps not working in apple 3g

    apps not working like whats app in iphone 3g 4.2 any solution

  • Javasript API in Captivate 7

    Is there a detail documentation or tutorial about the Javasript API of Captivate 7?