Trouble Creating View on External Table in Diff Schema

I am unable to create a view in a different schema on an external table in a different schema, even when I am connected to my database as SYS as SYSDBA.
CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
returns the error:
ORA-06564: object ER_ADMIN_DIR does not exist
I created a directory:
CREATE DIRECTORY ER_ADMIN_DIR AS 'C:\ER_Init';
Granted privs:
grant read,write on directory ER_ADMIN_DIR to public;
Created the external table EXT1 in a different schema WH1:
CREATE TABLE WH1.EXT1 (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY SYS.ER_ADMIN_DIR
ACCESS PARAMETERS
(RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
LOCATION ('FILE1.TXT')
REJECT LIMIT UNLIMITED;
I can query from the table successfully connected as SYS:
SQL> select count(*) from wh1.ext1;
1008
1 row selected.
However when I try to create a view on that table connected as SYS:
CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
I get the following error:
ORA-06564: object ER_ADMIN_DIR does not exist
I can connect over to the WH1 schema and create the view successfully, however due to a specific situation I need to be able to create the view from the SYS schema. I can create the view FORCE and it creates with compilation errors, however the view cannot be compiled successfully from SYS.
Is there a known bug on creating views on external tables remotely?
Thanks for any help!
Tina

I have been able to reproduce your error, using scott instead of sys, and resolve it, as demonstrated below. The combination that I found that worked consisted of having wh1 grant select on ext1 to scott explicitly and using set current_schema to wh1, so that ext1view did not require the wh1 qualifier.
scott@ORA92> CREATE USER wh1 IDENTIFIED BY wh1
  2  /
User created.
scott@ORA92> GRANT CONNECT, RESOURCE TO wh1
  2  /
Grant succeeded.
scott@ORA92> CREATE OR REPLACE DIRECTORY er_admin_dir AS 'c:\er_init'
  2  /
Directory created.
scott@ORA92> CREATE TABLE wh1.ext1
  2    (table_name  VARCHAR2(100),
  3       column_name VARCHAR2(100))
  4  ORGANIZATION EXTERNAL
  5    (TYPE ORACLE_LOADER
  6       DEFAULT DIRECTORY er_admin_dir
  7       ACCESS PARAMETERS
  8         (RECORDS DELIMITED BY NEWLINE
  9          FIELDS TERMINATED BY ','
10          MISSING FIELD VALUES ARE NULL)
11       LOCATION ('file1.txt'))
12  REJECT LIMIT UNLIMITED
13  /
Table created.
scott@ORA92> CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
  2  /
CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
ERROR at line 1:
ORA-06564: object ER_ADMIN_DIR does not exist
scott@ORA92> CONNECT wh1/wh1
Connected.
scott@ORA92> @ LOGIN
scott@ORA92> SET ECHO OFF
GLOBAL_NAME
[email protected]2
wh1@ORA92> GRANT SELECT ON ext1 TO scott
  2  /
Grant succeeded.
wh1@ORA92> CONNECT scott/tiger
Connected.
wh1@ORA92> @ LOGIN
wh1@ORA92> SET ECHO OFF
GLOBAL_NAME
[email protected]A92
scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = wh1
  2  /
Session altered.
scott@ORA92> CREATE OR REPLACE VIEW ext1view AS SELECT * FROM wh1.ext1
  2  /
View created.
scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = scott
  2  /
Session altered.
scott@ORA92> SELECT * FROM wh1.ext1view
  2  /
TABLE_NAME
---------------------------------------------------------COLUMN_NAME
---------------------------------------------------------tab1
col1
tab2
col2
scott@ORA92>

Similar Messages

  • Error Creating View on External Table

    I create my oracle directory connected as SYS as SYSDBA and grant read,write to public:
    CREATE OR REPLACE DIRECTORY ER_ADMIN_DIR AS 'C:\win32app\ingr\ER\ER_Init\scripts';
    grant read,write on directory ER_ADMIN_DIR to public;
    I creat my external table from SYS to reside in another schema called DRTEST:
    CREATE TABLE DRTEST.SPEC_REQUIRED (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('atts_in_red.tx')
    REJECT LIMIT UNLIMITED ;
    I can select from the table and all is good at this point.
    However, I get an error when I try to create a view (in DRTEST from SYS) based on the external table.
    CREATE VIEW DRTEST.MYVIEW1 AS SELECT * FROM DRTEST.SPEC_REQUIRED;
    CREATE VIEW DRTEST.MYVIEW1 AS SELECT * FROM DRTEST.SPEC_REQUIRED
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    (note I'm still connected as SYS as SYSDBA here)
    I can create the view if I connect to DRTEST and run the exact same create view statement there. Is there something in Oracle that prevents me from doing this from the SYS account? I usually think of SYS as having the "Power of God to do all things".
    I have to create the external table and view on several schema's and I don't want the user to have to connect to each schema separately.
    Tina

    Tina,
    I think you are facing bug 2948123 (CREATE VIEW ON EXTERNAL TABLE ORA-6564). The workaround is to connect (in your case) as user DRTEST and then perform the CREATE VIEW statement (you tested this already). Or (according to the bug description) create the view under the SYS schema itself.

  • How to create view for xmltype table in oracle

    hi:
    Can some one help me how to create view for xmltype table in oracle?
    XMLType do not have column
    Sem

    Thank you !!
    I read it and become very hard to implement what I want to do.
    Can you give me example please?
    My main goal to create view for xmltype table is to XQuery the XML data?
    Do you have any other suggestion?
    Please help
    Ali_2

  • Bad file is not created during the external table creation.

    Hello Experts,
    I have created a script for external table in Oracle 10g DB. Everything is working fine except it does not create the bad file, But it creates the log file. I Cann't figure out what is the issue. Because my shell scripts is failing and the entire program is failing. I am attaching the table creation script and the shell script where it is refering and the error. Kindly let me know if something is missing. Thanks in advance
    Table Creation Scripts:_-------------------------------
    create table RGIS_TCA_DATA_EXT
    guid VARCHAR2(250),
    badge VARCHAR2(250),
    scheduled_store_id VARCHAR2(250),
    parent_event_id VARCHAR2(250),
    event_id VARCHAR2(250),
    organization_number VARCHAR2(250),
    customer_number VARCHAR2(250),
    store_number VARCHAR2(250),
    inventory_date VARCHAR2(250),
    full_name VARCHAR2(250),
    punch_type VARCHAR2(250),
    punch_start_date_time VARCHAR2(250),
    punch_end_date_time VARCHAR2(250),
    event_meet_site_id VARCHAR2(250),
    vehicle_number VARCHAR2(250),
    vehicle_description VARCHAR2(250),
    vehicle_type VARCHAR2(250),
    is_owner VARCHAR2(250),
    driver_passenger VARCHAR2(250),
    mileage VARCHAR2(250),
    adder_code VARCHAR2(250),
    bonus_qualifier_code VARCHAR2(250),
    store_accuracy VARCHAR2(250),
    store_length VARCHAR2(250),
    badge_input_type VARCHAR2(250),
    source VARCHAR2(250),
    created_by VARCHAR2(250),
    created_date_time VARCHAR2(250),
    updated_by VARCHAR2(250),
    updated_date_time VARCHAR2(250),
    approver_badge_id VARCHAR2(250),
    approver_name VARCHAR2(250),
    orig_guid VARCHAR2(250),
    edit_type VARCHAR2(250)
    organization external
    type ORACLE_LOADER
    default directory ETIME_LOAD_DIR
    access parameters
    RECORDS DELIMITED BY NEWLINE
    BADFILE ETIME_LOAD_DIR:'tstlms.bad'
    LOGFILE ETIME_LOAD_DIR:'tstlms.log'
    READSIZE 1048576
    FIELDS TERMINATED BY '|'
    MISSING FIELD VALUES ARE NULL(
    GUID
    ,BADGE
    ,SCHEDULED_STORE_ID
    ,PARENT_EVENT_ID
    ,EVENT_ID
    ,ORGANIZATION_NUMBER
    ,CUSTOMER_NUMBER
    ,STORE_NUMBER
    ,INVENTORY_DATE char date_format date mask "YYYYMMDD HH24:MI:SS"
    ,FULL_NAME
    ,PUNCH_TYPE
    ,PUNCH_START_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
    ,PUNCH_END_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
    ,EVENT_MEET_SITE_ID
    ,VEHICLE_NUMBER
    ,VEHICLE_DESCRIPTION
    ,VEHICLE_TYPE
    ,IS_OWNER
    ,DRIVER_PASSENGER
    ,MILEAGE
    ,ADDER_CODE
    ,BONUS_QUALIFIER_CODE
    ,STORE_ACCURACY
    ,STORE_LENGTH
    ,BADGE_INPUT_TYPE
    ,SOURCE
    ,CREATED_BY
    ,CREATED_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
    ,UPDATED_BY
    ,UPDATED_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
    ,APPROVER_BADGE_ID
    ,APPROVER_NAME
    ,ORIG_GUID
    ,EDIT_TYPE
    location (ETIME_LOAD_DIR:'tstlms.dat')
    reject limit UNLIMITED;
    _***Shell Script*:*----------------_*
    version=1.0
    umask 000
    DATE=`date +%Y%m%d%H%M%S`
    TIME=`date +"%H%M%S"`
    SOURCE=`hostname`
    fcp_login=`echo $1|awk '{print $3}'|sed 's/"//g'|awk -F= '{print $2}'`
    fcp_reqid=`echo $1|awk '{print $2}'|sed 's/"//g'|awk -F= '{print $2}'`
    TXT1_PATH=/home/ac1/oracle/in/tsdata
    TXT2_PATH=/home/ac2/oracle/in/tsdata
    ARCH1_PATH=/home/ac1/oracle/in/tsdata
    ARCH2_PATH=/home/ac2/oracle/in/tsdata
    DEST_PATH=/home/custom/sched/in
    PROGLOG=/home/custom/sched/logs/rgis_tca_to_tlms_create.sh.log
    PROGNAME=`basename $0`
    PROGPATH=/home/custom/sched/scripts
    cd $TXT2_PATH
    FILELIST2="`ls -lrt tstlmsedits*.dat |awk '{print $9}'`"
    NO_OF_FILES2="`ls -lrt tstlmsedits*.dat |awk '{print $9}'|wc -l`"
    $DEST_PATH/tstlmsedits.dat for i in $FILELIST2
    do
    cat $i >> $DEST_PATH/tstlmsedits.dat
    printf "\n" >> $DEST_PATH/tstlmsedits.dat
    mv $i $i.$DATE
    #mv $i $TXT2_PATH/test/.
    mv $i.$DATE $TXT2_PATH/test/.
    done
    if test $NO_OF_FILES2 -eq 0
    then
    echo " no tstlmsedits.dat file exists " >> $PROGLOG
    else
    echo "created dat file tstlmsedits.dat at $DATE" >> $PROGLOG
    echo "-------------------------------------------" >> $PROGLOG
    fi
    NO_OF_FILES1="`ls -lrt tstlms*.dat |awk '{print $9}'|wc -l`"
    FILELIST1="`ls -lrt tstlms*.dat |awk '{print $9}'`"
    $DEST_PATH/tstlms.datfor i in $FILELIST1
    do
    cat $i >> $DEST_PATH/tstlms.dat
    printf "\n" >> $DEST_PATH/tstlms.dat
    mv $i $i.$DATE
    # mv $i $TXT2_PATH/test/.
    mv $i.$DATE $TXT2_PATH/test/.
    done
    if test $NO_OF_FILES1 -eq 0
    then
    echo " no tstlms.dat file exists " >> $PROGLOG
    else
    echo "created dat file tstlms.dat at $DATE" >> $PROGLOG
    fi
    cd $TXT1_PATH
    FILELIST3="`ls -lrt tstlmsedits*.dat |awk '{print $9}'`"
    NO_OF_FILES3="`ls -lrt tstlmsedits*.dat |awk '{print $9}'|wc -l`"
    $DEST_PATH/tstlmsedits.datfor i in $FILELIST3
    do
    cat $i >> $DEST_PATH/tstlmsedits.dat
    printf "\n" >> $DEST_PATH/tstlmsedits.dat
    mv $i $i.$DATE
    #mv $i $TXT1_PATH/test/.
    mv $i.$DATE $TXT1_PATH/test/.
    done
    if test $NO_OF_FILES3 -eq 0
    then
    echo " no tstlmsedits.dat file exists " >> $PROGLOG
    else
    echo "created dat file tstlmsedits.dat at $DATE" >> $PROGLOG
    echo "-------------------------------------------" >> $PROGLOG
    fi
    NO_OF_FILES4="`ls -lrt tstlms*.dat |awk '{print $9}'|wc -l`"
    FILELIST4="`ls -lrt tstlms*.dat |awk '{print $9}'`"
    $DEST_PATH/tstlms.datfor i in $FILELIST4
    do
    cat $i >> $DEST_PATH/tstlms.dat
    printf "\n" >> $DEST_PATH/tstlms.dat
    mv $i $i.$DATE
    # mv $i $TXT1_PATH/test/.
    mv $i.$DATE $TXT1_PATH/test/.
    done
    if test $NO_OF_FILES4 -eq 0
    then
    echo " no tstlms.dat file exists " >> $PROGLOG
    else
    echo "created dat file tstlms.dat at $DATE" >> $PROGLOG
    fi
    #connecting to oracle to generate bad files
    sqlplus -s $fcp_login<<EOF
    select count(*) from rgis_tca_data_ext;
    select count(*) from rgis_tca_data_history_ext;
    exit;
    EOF
    #counting the records in files
    tot_rec_in_tstlms=`wc -l $DEST_PATH/tstlms.dat | awk ' { print $1 } '`
    tot_rec_in_tstlmsedits=`wc -l $DEST_PATH/tstlmsedits.dat | awk ' { print $1 } '`
    tot_rec_in_tstlms_bad=`wc -l $DEST_PATH/tstlms.bad | awk ' { print $1 } '`
    tot_rec_in_tstlmsedits_bad=`wc -l $DEST_PATH/tstlmsedits.bad | awk ' { print $1 } '`
    #updating log table
    echo "pl/sql block started"
    sqlplus -s $fcp_login<<EOF
    define tot_rec_in_tstlms     = '$tot_rec_in_tstlms';
    define tot_rec_in_tstlmsedits     = '$tot_rec_in_tstlmsedits';
    define tot_rec_in_tstlms_bad     = '$tot_rec_in_tstlms_bad';
    define tot_rec_in_tstlmsedits_bad='$tot_rec_in_tstlmsedits_bad';
    define fcp_reqid ='$fcp_reqid';
    declare
    l_tstlms_file_id number := null;
    l_tstlmsedits_file_id number := null;
    l_tot_rec_in_tstlms number := 0;
    l_tot_rec_in_tstlmsedits number := 0;
    l_tot_rec_in_tstlms_bad number := 0;
    l_tot_rec_in_tstlmsedits_bad number := 0;
    l_request_id fnd_concurrent_requests.request_id%type;
    l_start_date fnd_concurrent_requests.actual_start_date%type;
    l_end_date fnd_concurrent_requests.actual_completion_date%type;
    l_conc_prog_name fnd_concurrent_programs.concurrent_program_name%type;
    l_requested_by fnd_concurrent_requests.requested_by%type;
    l_requested_date fnd_concurrent_requests.request_date%type;
    begin
    --getting concurrent request details
    begin
    SELECT fcp.concurrent_program_name,
    fcr.request_id,
    fcr.actual_start_date,
    fcr.actual_completion_date,
    fcr.requested_by,
    fcr.request_date
    INTO l_conc_prog_name,
    l_request_id,
    l_start_date,
    l_end_date,
    l_requested_by,
    l_requested_date
    FROM fnd_concurrent_requests fcr, fnd_concurrent_programs fcp
    WHERE fcp.concurrent_program_id = fcr.concurrent_program_id
    AND fcr.request_id = &fcp_reqid; --fnd_global.conc_request_id();
    exception
    when no_data_found then
    fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
    fnd_file.put_line(fnd_file.log, 'No data found for request_id');
    fnd_file.put_line(fnd_file.log, sqlerrm);
    raise_application_error(-20001,
    'Error occured when executing RGIS_TCA_TO_TLMS_CREATE.sh ' ||
    sqlerrm);
    when others then
    fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
    fnd_file.put_line(fnd_file.log,
    'Error occured when retrieving request_id request_id');
    fnd_file.put_line(fnd_file.log, sqlerrm);
    raise_application_error(-20001,
    'Error occured when executing RGIS_TCA_TO_TLMS_CREATE.sh ' ||
    sqlerrm);
    end;
    --calling ins_or_upd_tca_process_log to update log table for tstlms.dat file
    begin
    rgis_tca_to_tlms_process.ins_or_upd_tca_process_log
                   (l_tstlms_file_id,
                   'tstlms.dat',
                   l_conc_prog_name,
                   l_request_id,
                   l_start_date,
                   l_end_date,
                   &tot_rec_in_tstlms,
                   &tot_rec_in_tstlms_bad,
                   null,
                   null,               
                   null,
                   null,
                   null,
                   null,
                   null,
                   l_requested_by,
                   l_requested_date,
                   null,
                   null,
                   null,
                   null,
                   null);
    exception
    when others then
    fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
    fnd_file.put_line(fnd_file.log,
    'Error occured when executing rgis_tca_to_tlms_process.ins_or_upd_tca_process_log for tstlms file');
    fnd_file.put_line(fnd_file.log, sqlerrm);
    end;
    --calling ins_or_upd_tca_process_log to update log table for tstlmsedits.dat file
    begin
    rgis_tca_to_tlms_process.ins_or_upd_tca_process_log
                   (l_tstlmsedits_file_id,
                   'tstlmsedits.dat',
                   l_conc_prog_name,
                   l_request_id,
                   l_start_date,
                   l_end_date,
                   &tot_rec_in_tstlmsedits,
                   &tot_rec_in_tstlmsedits_bad,
                   null,
                   null,               
                   null,
                   null,
                   null,
                   null,
                   null,
                   l_requested_by,
                   l_requested_date,
                   null,
                   null,
                   null,
                   null,
                   null);
    exception
    when others then
    fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
    fnd_file.put_line(fnd_file.log,
    'Error occured when executing rgis_tca_to_tlms_process.ins_or_upd_tca_process_log for tstlmsedits file');
    fnd_file.put_line(fnd_file.log, sqlerrm);
    end;
    end;
    exit;
    EOF
    echo "rgis_tca_to_tlms_process.sql started"
    sqlplus -s $fcp_login @$SCHED_TOP/sql/rgis_tca_to_tlms_process.sql $fcp_reqid
    exit;
    echo "rgis_tca_to_tlms_process.sql ended"
    _**Error:*----------------------------------*_
    RGIS Scheduling: Version : UNKNOWN
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    TCATLMS module: TCA To TLMS Import Process
    Current system time is 18-AUG-2011 06:13:27
    COUNT(*)
         16
    COUNT(*)
         25
    wc: cannot open /home/custom/sched/in/tstlms.bad
    wc: cannot open /home/custom/sched/in/tstlmsedits.bad
    pl/sql block started
    old 33:     AND fcr.request_id = &fcp_reqid; --fnd_global.conc_request_id();
    new 33:     AND fcr.request_id = 18661823; --fnd_global.conc_request_id();
    old 63:                &tot_rec_in_tstlms,
    new 63:                16,
    old 64:                &tot_rec_in_tstlms_bad,
    new 64:                ,
    old 97:                &tot_rec_in_tstlmsedits,
    new 97:                25,
    old 98:                &tot_rec_in_tstlmsedits_bad,
    new 98:                ,
    ERROR at line 64:
    ORA-06550: line 64, column 4:
    PLS-00103: Encountered the symbol "," when expecting one of the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set specification>
    <an alternatively-q
    ORA-06550: line 98, column 4:
    PLS-00103: Encountered the symbol "," when expecting one of the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql st
    rgis_tca_to_tlms_process.sql started
    old 12: and concurrent_request_id = '&1';
    new 12: and concurrent_request_id = '18661823';
    old 18: and concurrent_request_id = '&1';
    new 18: and concurrent_request_id = '18661823';
    old 22: rgis_tca_to_tlms_process.run_tca_data(l_tstlms_file_id,&1);
    new 22: rgis_tca_to_tlms_process.run_tca_data(l_tstlms_file_id,18661823);
    old 33: rgis_tca_to_tlms_process.run_tca_data_history(l_tstlmsedits_file_id,&1);
    new 33: rgis_tca_to_tlms_process.run_tca_data_history(l_tstlmsedits_file_id,18661823);
    old 44: rgis_tca_to_tlms_process.send_tca_email('TCATLMS',&1);
    new 44: rgis_tca_to_tlms_process.send_tca_email('TCATLMS',18661823);
    declare
    ERROR at line 1:
    ORA-20001: Error occured when executing RGIS_TCA_TO_TLMS_PROCESS.sql ORA-01403:
    no data found
    ORA-06512: at line 59
    Executing request completion options...
    ------------- 1) PRINT   -------------
    Printing output file.
    Request ID : 18661823      
    Number of copies : 0      
    Printer : noprint
    Finished executing request completion options.
    Concurrent request completed successfully
    Current system time is 18-AUG-2011 06:13:29
    ---------------------------------------------------------------------------

    Hi,
    Check the status of the batch in SM35 transaction.
    if the batch is locked by mistake or any other error, now you can release it and aslo you can process again.
    To Release -Shift+F4.
    Also you can analyse the job status through F2 button.
    Bye

  • Creating View for a table with parent child relation in table

    I need help creating a view. It is on a base table which is a metadata table.It is usinf parent child relationship. There are four types of objects, Job, Workflow, Dataflow and ABAP dataflow. Job would be the root parent everytime. I have saved all the jobs
    of the project in another table TABLE_JOB with column name JOB_NAME. Query should iteratively start from the job and search all the child nodes and then display all child with the job name. Attached are the images of base table data and expected view data
    and also the excel sheet with data.Picture 1 is the sample data in base table. Picture 2 is data in the view.
    Base Table
    PARENT_OBJ
    PAREBT_OBJ_TYPE
    DESCEN_OBJ
    DESCEN_OBJ_TYPE
    JOB_A
    JOB
    WF_1
    WORKFLOW
    JOB_A
    JOB
    DF_1
    DATAFLOW
    WF_1
    WORKFLOW
    DF_2
    DATAFLOW
    DF_1
    DATAFLOW
    ADF_1
    ADF
    JOB_B
    JOB
    WF_2
    WORKFLOW
    JOB_B
    JOB
    WF_3
    WORKFLOW
    WF_2
    WORKFLOW
    DF_3
    DATAFLOW
    WF_3
    WORKFLOW
    DF_4
    DATAFLOW
    DF_4
    DATAFLOW
    ADF_2
    ADF
    View
    Job_Name
    Flow_Name
    Flow_Type
    Job_A
    WF_1
    WORKFLOW
    Job_A
    DF_1
    DATAFLOW
    Job_A
    DF_2
    DATAFLOW
    Job_A
    ADF_1
    ADF
    Job_B
    WF_2
    WORKFLOW
    Job_B
    WF_3
    WORKFLOW
    Job_B
    DF_3
    DATAFLOW
    Job_B
    DF_4
    DATAFLOW
    Job_B
    ADF_2
    ADF
    I implemented the same in oracle using CONNECT_BY_ROOT and START WITH.
    Regards,
    Megha

    I think what you need is recursive CTE
    Consider your table below
    create table basetable
    (PARENT_OBJ varchar(10),
    PAREBT_OBJ_TYPE varchar(10),
    DESCEN_OBJ varchar(10),DESCEN_OBJ_TYPE varchar(10))
    INSERT basetable(PARENT_OBJ,PAREBT_OBJ_TYPE,DESCEN_OBJ,DESCEN_OBJ_TYPE)
    VALUES('JOB_A','JOB','WF_1','WORKFLOW'),
    ('JOB_A','JOB','DF_1','DATAFLOW'),
    ('WF_1','WORKFLOW','DF_2','DATAFLOW'),
    ('DF_1','DATAFLOW','ADF_1','ADF'),
    ('JOB_B','JOB','WF_2','WORKFLOW'),
    ('JOB_B','JOB','WF_3','WORKFLOW'),
    ('WF_2','WORKFLOW','DF_3','DATAFLOW'),
    ('WF_3','WORKFLOW','DF_4','DATAFLOW'),
    ('DF_4','DATAFLOW','ADF_2','ADF')
    ie first create a UDF like below to get hierarchy recursively
    CREATE FUNCTION GetHierarchy
    @Object varchar(10)
    RETURNS @RESULTS table
    PARENT_OBJ varchar(10),
    DESCEN_OBJ varchar(10),
    DESCEN_OBJ_TYPE varchar(10)
    AS
    BEGIN
    ;With CTE
    AS
    SELECT PARENT_OBJ,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM basetable
    WHERE PARENT_OBJ = @Object
    UNION ALL
    SELECT b.PARENT_OBJ,b.DESCEN_OBJ,b.DESCEN_OBJ_TYPE
    FROM CTE c
    JOIN basetable b
    ON b.PARENT_OBJ = c.DESCEN_OBJ
    INSERT @RESULTS
    SELECT @Object,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM CTE
    OPTION (MAXRECURSION 0)
    RETURN
    END
    Then you can invoke it as below
    SELECT * FROM dbo.GetHierarchy('JOB_A')
    Now you need to use this for every parent obj (start obj) in view 
    for that create view as below
    CREATE VIEW vw_Table
    AS
    SELECT f.*
    FROM (SELECT DISTINCT PARENT_OBJ FROM basetable r
    WHERE NOT EXISTS (SELECT 1
    FROM basetable WHERE DESCEN_OBJ = r.PARENT_OBJ)
    )b
    CROSS APPLY dbo.GetHierarchy(b.PARENT_OBJ) f
    GO
    This will make sure it will give full hieraracy for each start object
    Now just call view as below and see the output
    SELECT * FROM vw_table
    Output
    PARENT_OBJ DESCEN_OBJ DESCEN_OBJ_TYPE
    JOB_A WF_1 WORKFLOW
    JOB_A DF_1 DATAFLOW
    JOB_A ADF_1 ADF
    JOB_A DF_2 DATAFLOW
    JOB_B WF_2 WORKFLOW
    JOB_B WF_3 WORKFLOW
    JOB_B DF_4 DATAFLOW
    JOB_B ADF_2 ADF
    JOB_B DF_3 DATAFLOW
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Permission to view content of table of SYS schema to newly created user

    Hi,
    I am facing issue giving permission to view contents of table p_users of SYS schema to newly created user.
    Regards,
    Phani Ram

    Hi Phani,
    Could you please check if you have an a authorization to give a permission to other users for particular schema.
    I mean check for privileges, user and roles.
    Warm Regards,
    Earesh kumar

  • Problem trying to create and manage external tables

    Hello guys,
    I am having problems having created my external tables trying to select from them. I created the table thus:
    create table job_ext
    (job_id number(3),
    FUNCTION varchar2(30) )
    organization external (type oracle_datapump default directory test_dir
    access parameters (records delimited by newline fields delimited by "~" (job_id number(3) ,
    FUNCTION varchar2(30) ) )
    location ('testdump.lst')
    but on running select * from job_ext, I get the error
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "identifier": expecting one of: "logfile, nologfile, version" etc..
    KUP-01008: the bad identifier was: records
    KUP-01007: at line 1 column 1
    ORA-06512: at "SYS.ORACLE_DATAPUMP", line 19
    ORA-06512: at line 1
    what am I not doing right.
    Secondly, I wish to ask if an directory object is created, will it be visible on the OS file system?? I am using Oracle 10g complete reference for study but it does not throw light on this.
    thanks

    Hi,
    It looks like you may need to grant permissions to the target directory.
    The ORA-29913 error can also happen in external tables when you don't grant read and write permissions to the directory:
    CREATE OR REPLACE DIRECTORY extdir AS '/u01/app/oracle./extdir';
    GRANT READ ON DIRECTORY extdir TO myowner;
    GRANT WRITE ON DIRECTORY extdir TO myowner;
    Also, see BUG 5172459 (MetaLink Note:373168.1)
    The problem is that the message file for external tables oin not the English version. These steps will address the issue:
    1. cd $ORACLE_HOME/rdbms/mesg
    2. cp KUP<lang>.msb KUP<lang>.msb.BAK
    3. cp kupus.msb KUP<lang>.msb
    http://www.dba-oracle.com/t_ora_29913_external_table_error.htm

  • Trouble Creating Views

    I'm not sure if this is a SQL Developer issue or a SQL issue, so if I'm in the wrong place, someone please let me know.
    Using SQL Developer 1.5.0.53, I'm trying to create a view. I've written my SQL for the view and I can run it in a SQL worksheet and it works just like I expect. So I go to my "Views" folder, right click and choose "New View" and enter the exact same SQL (without a semicolon at the end) that works in the SQL worksheet into the "SQL Query" window of the "Create View" dialog box. Then when I press the "Test Syntax" button I get the following error message
         The SQL syntax is valid, however the query is invalid or uses functionality that is not supported.
    This error sort of ticks me off, so I go to the SQL Worksheet and do a
         CREATE OR REPLACE FORCE VIEW… bla bla bla
    And it creates my view, and it seems to work just like I expect it to. Does anyone have any ideas why I can manually create this view in a SQL worksheet, but not through the "New View" dialog box?
    Below is the exact SQL I use to create my view
    SELECT
    "HS_FPR_ACCOUNT_T"."PARENT" "PARENT",
    "HS_FPR_ACCOUNT_T"."CHILD" "CHILD",
    "HS_FPR_ACCOUNT_T"."CHILD_ALIAS" "CHILD_ALIAS",
    "HS_FPR_ACCOUNT_T"."CHILD_STORAGE" "CHILD_STORAGE",
    "HS_FPR_ACCOUNT_T"."CHILD_AGG" "CHILD_AGG",
    "HS_FPR_ACCOUNT_T"."VAR_REPORTING" "VAR_REPORTING",
    "HS_FPR_ACCOUNT_T"."TIME_BALANCE" "TIME_BALANCE",
    "HS_ACCOUNT_MEMBER_V"."MEMBERFORMULA" "MEMBERFORMULA",
    level "PARENT_GEN"
    FROM
    "HS_FPR_ACCOUNT_T" "HS_FPR_ACCOUNT_T" left outer join "HS_ACCOUNT_MEMBER_V"
    on "HS_FPR_ACCOUNT_T"."CHILD" = "HS_ACCOUNT_MEMBER_V"."NAME"
    start with PARENT = 'Account'
    connect by prior CHILD= PARENT
    order by level,
    decode(CHILD, 'ZZZZZZ', '0',
    'COP', '1',
    'ZZZZ'),
    CHILD
    and it gives me this error:
    The SQL syntax is valid, however the query is invalid or uses functionality that is not supported.
    Cannot find relation "HS_ACCOUNT_MEMBER_V".
    Any insight anyone might have on this would be appreciated.
    Thanks

    I had this same problem.
    You have a corrupted file somewhere in this directory:
    C:\Documents and Settings\<your_user_name>\Application Data\SQL Developer
    Before you read further, recognize that this may be the default directory where sql developer will put your sql files, so make sure you don't harm those! Plus, you will lose your preferences and database connections, so make sure you know how to set them up again before you continue. Backups of this directory would be wise. :)
    I solved this problem (and a host of others, by the way), by deleting this directory (after backing up my sql files elsewhere) and running sql developer again.
    Of course, I lost all the preference settings, database connections, etc., so I had to type those in again.
    I believe it happened by importing a set of preferences built on another machine, but I haven't had time to go back and prove that.

  • Creating view on v$waitstat in my schema

    Hi,
    How can I create a view on v$.. objects in my schema?
    I have dba priveleges.
    SQL> create view my_waitstat as select class,count from v$waitstat;
    create view my_waitstat as select class,count from v$waitstat
    ERROR at line 1:
    ORA-01031: insufficient privileges
    SQL>

    I understatnd :-) that you very wise man
    I ask a question because I need to resolve my problem quickly
    How about this one?
    SQL> connect / as sysdba;
    Connected.
    SQL> grant select on x$kcbwait to dbmon;
    grant select on x$kcbwait to dbmon
    ERROR at line 1:
    ORA-02030: can only select from fixed tables/views
    SQL> grant select on v$waitstat to dbmon;
    grant select on v$waitstat to dbmon
    ERROR at line 1:
    ORA-02030: can only select from fixed tables/views

  • Create and access a table OUTSIDE SAPR3 schema

    Hi Gurus,
    Can you please help me how do I create a table outside SAPR3 schema in the same database, I have a user schema TEST in the sap database (Using SAPR3 4.6C). If any tcode does that? Or I need to use oracle sqlplus.
    HOW an ABAP progroam can access and manipulate the data available in this TEST schema?
    Reference to some SAP NOTE will be highly helpfull.
    Regards,
    Soumen.

    >
    Soumen Chattopadhyay wrote:
    > Dear Fiedel and Eric,
    Fiedel, Who?
    >
    > Thank you both for your suggestion,
    > me and my team are are checking up according to your idea....
    >
    > Actually, I do need to integrate one plant machinery equipment which has the backend database in MS SQL server and our SAP is using the backend Oracle and running on Linux.
    Very good, now we are getting more information.
    The data is NOT on the oracle database but outside.
    In this case DBCON (from DB+CONnection) can help
    >
    > As per the need of  business data need to be exchanged between these two.
    >
    > If you have may I request you to share some more information e.g. snotes on DBCO?
    >
    Very easy, follow my mantra (Top right box-Search functionality is very useful, also sap notes search)
    Lets chew this a little:
    117261     Multiconnect and DB procedure enhancements for 4.0B
    323151     Several DB connections with Native SQL
    738371     Creating DBCON multiconnect entries for SQL Server
    178949     MSSQL: Database MultiConnect with EXEC SQL
    >
    > But , why DBCON is not the right choice, Fiedel can U thow some more light?
    Lets see, in your first request you wanted to access to a different schema in the same database.
    you have the licence issues and DBCON is "overkill" (even when it can work) You would be connecting to yourself with a different usser.
    Probably it is easier to create synonyms at DB level and provide proper authorizations.
    In your second request the DBCON makes much more sense.
    You want to access to a different (external) DB. That is the reason DBCON exist.
    Now we have a little "issue". I'm not Windows/SQL expert, but, in order to connect to an external DB you need the SAP library "dbslib" (I think dbsmsslib is the correct name for the SQL server)
    Unfortunately, SQLServer is a Windows only program and this library is only available for Windows.
    To use it (use DBCON) you will have to install an AS on a windows machine and configure the DBCON on this server and execute the program to exchange data from this AS alone (if you execute it from another one it will fail because it does not find the dbslib)
    As mentioned, not much experience with non "real" Operating Systems, so perhaps someone else has more information.

  • Creat View from Multiple tables , Multiple Select

    Hello  Everyone ,
    I have a question and am not sure if this the correct forum to post it .
    I have two table studentTable and CourseTable which is each student  take more than one course . 1:M
    for example Student1 take 2 courses (C1 ,  C2).
    Student2 take 3 courses (C1,C2, C3).
    I need to create a table/View that contain student information plus all the courses and the score for each  course in one row.
    for example
    Row1= Student1_Id ,C1_code ,C1_name  ,C1_Score ,C2_code,C2_name ,C2_Score
    Row2=
    Student2_Id,C1_code,  C1_name,C1_Score,C2_code ,C2_name ,C2_Score ,  C3_code,C3_name,C3_Score
    and since Student 1 just took two courses  , I  should enter NULL in 'Course 3 fields'
    My Struggle is in the insert  statement
    I tried the following but it show an error
    Insert Into  Newtable
    ( St_ID, C1_code,c1_name, C1_Score ,C2_code  ,C2_name,C2_score,C3_code ,C3_name,C3_score)
    Select
    (Select St_ID from  StudentTable)
    (Select C_code,c_name,c_Score
    from  Coursetable,SudentTable
    where course.Stid =Studet.stid)
    (Select  C_code,c_name,c_Score
    from course ,student
    where course.Stid =Studet.stid  ),
    (Select C_code,c_name,c_Score
    from course ,student
    where  course.Stid =Studet.stid );
    I'm fully aware that the New table will break  the rules of normalization ,but I need it in this way for specifc purpose.
    I tried  also the PIVOT BY functionality but no luck with it .
    FYI , I'm not  expert in using SQL Syntax , I just know the basic.
    I will be great full for  any helpfull suggestions to try ,
    thank you very  much.

    First Table is Member table which Represent
    Students Information
    .The fields in this table are
    member_sk (PrimaryKey), full_or_part_time, gender, age_at_entry, age_band_at_entry, disability, ethnicity,
    widening_participation_level, nationality
    Second Table is Modules table which include
    the Courses' scores that Student took .
    The fields in this table are
    Module_result_k(Primary Key), member_sk(Foreign key to connect to Member table), member_stage_sk
    ,module_k(Foreign key to connect to Module table), module_confirmed_grade_src, credit_or_result
    Third Table is
    AllModuleInfo which is include
    general information for each course .The fields in this table are
    Module_k (Primary key), module_name ,module_code, Module_credit, Module stage.
    The New table
    that I will create has the following fields
    member_sk (PrimaryKey), full_or_part_time, gender, age_at_entry, age_band_at_entry, disability, ethnicity,
    widening_participation_level, nationality 
    " This will be retrieved from Member table"
    Also will include
    Module 1_name ,module1_code, Module1_credit, Module1_ stage, member1_stage_sk
    , module1_confirmed_grade_src, credit1_or_result
    Module 2_name ,module2_code, Module2_credit, Module2_ stage, member2_stage_sk
    , module2_confirmed_grade_src, credit2_or_result
    I will repeat this fields 14 times which is equal to Maximum courses number 
    that any of the students took.
    //// I hope now my questions become more clear

  • Unable to create view on COSP table for enpense related GL accounts.

    Hi,
    I want to extract only expense GL accounts related expense into BW. I tried to use standard data source: 0CO_OM_CCA_01 & 0CO_OM_CCA_02. but as these two data sources doesn't have profit center, trading partner and segment. so we are planning to use a view on table: COSP.
    When I am trying to create a view, its throwing error "the reference field is from some different table".
    Need your suggestion in creating the view.
    Regards,
    Ravi.

    Hi Ravi,
    Before deciding to create a generic DataSource, you should evaluate the options to enhance a Business Content DataSource. It is possible to extend the extract structure with additional fields and fill them in Enhancement RSAP0001 or BAdI RSU5_SAPI_BADI.
    If you would decide to go for a generic DataSource after all, then please share more details on the issue you are facing. I.e. detailed error message(s), screenshots, etc.
    Best regards,
    Sander

  • Trouble Creating View Using Derived Values From With

    I want to use the two values derived from the sql statements in my WITH to use in a view. This is my code:
    WITH a AS(
    SELECT
    CASE
    WHEN (SELECT stvterm_code
    FROM stvterm
    WHERE sysdate >= stvterm_start_date
    AND sysdate <= stvterm_end_date) IS NOT NULL
    THEN (SELECT stvterm_code
    FROM stvterm
    WHERE sysdate >= stvterm_start_date
    AND sysdate <= stvterm_end_date)
    ELSE
    (SELECT min(stvterm_code)
    FROM stvterm
    WHERE stvterm_start_date > sysdate)
    END cur_term
    FROM dual),
    b AS (
    SELECT
    CASE
    WHEN (SELECT substr(cur_term,5, 2) FROM a) = '60' OR (SELECT substr(cur_term,5, 2) FROM a) = '40'
    THEN (SELECT substr(cur_term,0, 4)||'20' FROM a)
    WHEN (SELECT substr(cur_term,5, 2) FROM a) = '20'
    THEN (SELECT to_char(to_number(cur_term)-100) FROM a)
    END endof_prior_aidy_term
    FROM dual
    CREATE OR REPLACE VIEW jbartling.current_term AS
    SELECT cur_term, endof_prior_aidy_term
    FROM a,bHowever, I get the error ORA-00928: missing SELECT keyword. Is it possible to use WITH like this in creating a view? If not can someone show me another way to accomplish what I'm trying to do?

    Hi,
    You need to put the CREATE at top, i.e
    CREATE OR REPLACE VIEW jbartling.current_term AS
    WITH a
    SELECT ..  FROM a,bRegards
    Peter

  • Creating View or  Pivot Table

    I have a query:
    SELECT circ.facilityid
    FROM ADMGID.CIRCUITSOURCE_DB CIRC,
    ADMGID.MINIRETICULATED_DB MN
    WHERE CIRC.DISTGRP_FID = MN.DISTGRP_FID
    AND Mn.Facilityid = 'NBRG 0002 0009'
    return me data , ever 4 rows
    BRG 0207
    BRG 0210
    BRG 0208
    BRG 0209
    of course when change Mn.Facilityid change rows
    I want that this rows show me as Columns , or to create a view thar return this columns

    this examples might be of help.
    SQL> select * from pivot_tab;
          COL1 COL2
             1 a
             1 b
             1 c
             2 h
             2 h
    SQL>
    SQL>
    SQL> select p.col1,
      2         substr(max(substr(sys_connect_by_path (p.col2,','),2)),1,60)
      3         as col2
      4    from (select col1,
      5                 col2,
      6                 row_number() over (partition by col1 order by col1, col2) rn
      7            from pivot_tab) p
      8  start with p.rn = 1
      9  connect by p.rn = prior p.rn + 1
    10  and prior p.col1 = p.col1
    11  group by col1;
          COL1 COL2
             1 a,b,c
             2 h,h
    SQL>

  • ORA-12054:while trying to create mview based on table in other schema

    HI all
    show user
    user is "NAAMA"
    CREATE TABLE USERS
      user_id               NUMBER,
       user_name             VARCHAR2(15 CHAR),
      user_password         VARCHAR2(50 CHAR),
    CONSTRAINT user_pk PRIMARY KEY (user_id));
    TABLE created.
    show user
    user is "TEST"
    create materialized view log on NAAMA.USERS WITH ROWID
    create materialized view users_mv
    build immediate
    refresh fast on commit with rowid
    as
    select  user_name  ,
              user_password        
    from naama.users;
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
      I suspect this problem is all about priviliges .
    please you help
    Thanks In advanced
    Naama

    Hi Ranit ,
    thanks for your response , i disagree with you lets take a look at those scenarios :
    scenario 1 :
    show user
    user is "NAAMA"
    create materialized view log on users with primary key;
    show user
    user is "TEST"
    CREATE MATERIALIZED VIEW users_mv
    BUILD immediate
    REFRESH FAST ON COMMIT  
    AS
    SELECT
    user_id,
    user_name  ,
    user_password , 
    naama.get_name(user_id) FIRST_name
    FROM naama.users
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view.
    according to this there is nothing to do to the primary key,scenarion 2:
    show user
    user is "NAAMA"
    create MATERIALIZED VIEW LOG ON USERS WITH rowid.
    create or replace function get_name (user_name_in IN varchar2) return varchar2
    is
    begin
    return 'NAAMA';
    end  get_name;
    show user
    user is "TEST"
    CREATE MATERIALIZED VIEW users_mv
    BUILD immediate
    REFRESH FAST ON COMMIT with primary key
    AS
    SELECT
    user_name  ,
    user_password , 
    naama.get_name(user_name) FIRST_name
    FROM naama.users;
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view.scenarion 3:
    show user
    user is "NAAMA"
    create MATERIALIZED VIEW LOG ON USERS WITH rowid.
    show user
    user is "TEST"
    CREATE MATERIALIZED VIEW users_mv
    BUILD immediate
    REFRESH FAST ON COMMIT   WITH rowid
    AS
    SELECT
    user_name  ,
    user_password , 
    SUBSTR(user_name,1,5)
    FROM naama.USERS;
    materialized view created.so we cannot say that the mview has problem using functions.
    What seems to be the problem ?
    Thanks In Advanced
    Naama

Maybe you are looking for

  • Quicktime Streaming of keynotes does not work

    When I want to watch the keynotes on apple.com all I get is stuttering audio and chopped video. Why? How can I solve this? It's independent of the resolution I select. btw. why am I forced to use that stone-aged Quicktime to watch a movie by the "HTM

  • What's "SVGA"? Need that for an HDTV hook up?

    I'm preparing to set up my friend's Mini, when it arrives. She will be using her new Samsung HD TV, with a VGA input. I already gathered that I need a Male to Male VGA cable (the adaptor comes in the box, right?) But I was just now on monoprice.com t

  • SALES DOC NO IS NOT CREATED

    I RUN THE SALESORDER_CREATEFROMDAT2 i wrote the code as giveb below please check the code and tell me if any modification. String DocType = "TA"; String xUploadFlag = "I"; String xDocType = "X"; String xSalesOrg = "X"; String xDisChan = "X"; String x

  • Where is Purchase Date?

    I am unable to find the purchase date on songs that I have just purchased in my library.  In iTunes old release all new songs purchased would appear at the top of my library and there was a purchase date column I could sort songs by date.  I am unabl

  • Need a replacement battery

    Hello, I have a macbook unibody aluminum from late 2008. My battery is in a poor state, lasts about an hour and a half tops and is in a "replace soon" condition. I was wondering where I could purchase a replacement battery and how much that would cos