Viewing a url selection from a JTree

Hi,
I was just wondering if someone can give me some help. I am trying to get a selected node from a JTree which is a url which has been converted into a string to add to the JTree. I use the following code to obtain the selected node by the user:
TreePath node = tree.getSelectionPath();
System.out.println(node);I have used system.out.println to see what is actually retreived. The following is retrieved from the tree:
[Test, http://www.whatever.com]
test is the node of the tree, all I want is to remove the root from the selection and get the url so I can connect to the net to display the page. How would i do this?
Many Thanks

Hi,
This is the code that I have used:
TreePath node = tree.getSelectionPath();
DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode)
(node.getLastPathComponent());
System.out.println(currentNode);Found an example, I learn better when I see examples. Do you know anything for connecting to the web to view the url or anywhere where i can find an example?
Many Thanks
p.s. sorry for snapping my deadline is at the end of the month and got lots of write up to do as well :(

Similar Messages

  • Is select from view faster then select from table..???

    Hello Gurus,
    I want to query some data from two tables, both of table have many columns (attributes) and many rows...
    I use several where clauses to retrieve data from those tables..
    witch one is faster, I create a view or I just "select" from those tables???
    Regards.
    Nia...

    riedelme wrote:
    3360 wrote:
    riedelme wrote:
    Selecting through a view almost never helps performance and frequently hurts.Views do not affect performance.
    Views are simply queries and like queries there are fast and slow ones.I disagree.
    First of all, to use a view you are executing a query to get a result set, then accessing the data from that result set - a built-in extra step to perform to get data.First of all that entire explanation of how views work is not correct. The optimizer will rewrite the query to make the view go away if possible.
    SQL> create or replace view v as select * from dual;
    View created.
    SQL> explain plan for select * from dual where dummy = 'X';
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 272002086
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |     2 |     2   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("DUMMY"='X')
    13 rows selected.
    SQL> explain plan for select * from v where dummy = 'X';
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 272002086
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |     2 |     2   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("DUMMY"='X')
    13 rows selected.Exactly the same.
    >
    Second, when accessing the data from the view the result sets don't have indexes for fast lookups and efficient joins on later steps.This is also known as just making stuff up and is not how the database works. care to share any references at all for any of this?
    >
    Third, the systems I've seen that use views extensively - I am looking at one now - tend to perform joins on views using the same tables with the same data over and over. This is a design issue and not specifically a problem with views but they lend themselves to this misuse much too easilyCorrect as I said a view is just a query, and just like queries there are good fast views and bad slow views
    >
    I'll concede that the problem is not specifically with views themselves but as I just said they lend themselves to misuse. Tuning views of views and views joined to views is difficultYes, queries can be misused as can almost all SQL functions and functionality.
    As I said - Views are simply queries and like queries there are fast and slow ones.
    Nothing that you have posted that is accurate changes that.

  • It's is possible to make a select from a view?

    I don't know if it's possible to make a select of a table-view like V_T5F99FW if it's possible does anybody tell me how can I do?
    Thanks a lot,
    Regards,
    Rebeca

    Hi Rebeca,
    You can surely do a selection from a projection and database view but not from a maintenance view.
    The selection from a view works like a normal selection only.
    watch this link
    http://sap.ionelburlacu.ro/abap/ABAPperformance.html#Select_with_view
    Regards,
    Manish
    Edited by: MANISH GUPTA on Aug 31, 2008 1:38 PM

  • Error when selecting from view created by OLAP_TABLE

    Hi all,
    I used OWB 10.2.0.4 to create a MOLAP datawarehouse.
    I created a view with this:
    CREATE OR REPLACE VIEW sales_view AS
    SELECT *
    FROM TABLE(OLAP_TABLE(
    'dw duration session',
    'MEASURE samt AS number(16,0) FROM SALES_SAMT
    DIMENSION cust_code AS varchar2(30) FROM cust
    DIMENSION prod_code AS varchar2(30) FROM prod
    DIMENSION sman_code AS varchar2(30) FROM sman
    DIMENSION time_id AS varchar2(30) FROM time
    DIMENSION orgn_code AS varchar2(30) FROM orgn'));
    and I try to run the following:
    select count(*) from sales_view;
    and I got the following error:
    Error starting at line 1 in command:
    select count(*) from sales_view
    Error report:
    SQL Error: ORA-29400: data cartridge error
    ORA-00600: internal error code, arguments: [xsvaluekeyget: type], [114], [], [], [], [], [], []
    29400. 00000 - "data cartridge error\n%s"
    *Cause:    An error has occurred in a data cartridge external procedure.
    This message will be followed by a second message giving
    more details about the data cartridge error.
    *Action:   See the data cartridge documentation
    for an explanation of the second error message.
    Can somebody give me some idea?
    Many thanks!
    - Andrew

    Brijesh,
    Really appreciate your help!
    With your hint (#2), I found my problems.
    I had 2 problems:
    1) I'm missing the 'Model' clause at the end of my view creation (in bold )
    2) I shouldn't do a count on all rows (e.g. I get result if I select with parameters)
    Here's my working view:
    CREATE OR REPLACE VIEW SALES_VIEW2
    AS
    SELECT * FROM TABLE(OLAP_TABLE(
    'DW DURATION SESSION',
    MEASURE SAMT FROM SALES_SAMT1
    DIMENSION PROD_CODE FROM PROD
    DIMENSION SMAN_CODE FROM SMAN
    DIMENSION TIME_CODE FROM TIME
    DIMENSION CUST_CODE FROM CUST
    DIMENSION ORGN_CODE FROM ORGN
    MODEL
    DIMENSION BY(PROD_CODE, CUST_CODE, SMAN_CODE, TIME_CODE, ORGN_CODE)
    MEASURES(SAMT)
    RULES UPDATE SEQUENTIAL ORDER();
    -----

  • Can select from table across db link but cannot create a materialized view

    dblink1 is a private db link (it could also be public)
    select count(*) from t1@dblink1;
    -->
    COUNT(*)
    5276
    create materialized view v1 as
    select * from t1@dblink1;
    -->
    select * from t1@dblink1;
    ERROR at line 2:
    ORA-00942: table or view does not exist
    This only applies to this particular db link. For another db link called "dblink2",
    create materialized view v2 as
    select * from t2@dblink2;
    -->
    Materialized view created.
    What gives? dblink1 and dblink2 are 2 different databases on 2 different machines.

    This is the simplest cause:
    dblink2 points to a database that has not a t1 table (as the message says, the table does not exist)
    This is the following simple cause:
    dblink2 uses a remote user user2, that can not select the t1 table because it exist in another schema, and user2 has not a synonym to the table (post the result of a query over dba_db_links that shows the remote users). Database objects has name and schema. If the objects are in your own schema you dont need to write the schema name, nor if you has a synonym to the object. But if the table t1 is in another schema, and you write t1, it means user2.t1 and fail.
    I hope this helps
    Regards,
    Alfonso

  • ORA-01031 insufficient privileges  error when selecting from a view

    OK I think this might be a dumb question but I can't figure it out:
    User John has been granted SELECT privilege (directly, not through a database role) to schema FRED.table1;
    User John can issue select * from FRED.table1; and it works just fine.
    User John has then been granted SELECT privilege (directly, not via a database role) to schema
    MARK.view1;
    MARK.view1 only selects from FRED.table1. No other tables are in the view1.
    Schema MARK can successfully query the views. SELECT * FROM VIEW1 returns results.
    I also checked the MARK schema to ensure that it has been granted SELECT on FRED.table1 directly which it has.
    Now, when logged into schema John, I try SELECT * FROM MARK.VIEW1; and I get ORA-01031 insufficient privileges error.
    I'm not sure how to troubleshoot this. If John is granted SELECT ANY TABLE, it of course works but I don't want John to have that powerful priv.
    To recap, John has SELECT on both MARK.VIEW1 and the table which VIEW1 selects from (FRED.TABLE1).
    John can select from FRED.TABLE1 no problem but receives a privilege error even though John has SELECT on MARK.VIEW1.
    Any thoughts?
    Oh, Oracle EE 10.2.0.4

    JSebastian wrote:
    OK I think this might be a dumb question but I can't figure it out:
    User John has been granted SELECT privilege (directly, not through a database role) to schema FRED.table1;
    User John can issue select * from FRED.table1; and it works just fine.
    User John has then been granted SELECT privilege (directly, not via a database role) to schema
    MARK.view1;
    MARK.view1 only selects from FRED.table1. No other tables are in the view1.
    Schema MARK can successfully query the views. SELECT * FROM VIEW1 returns results.
    I also checked the MARK schema to ensure that it has been granted SELECT on FRED.table1 directly which it has.
    Now, when logged into schema John, I try SELECT * FROM MARK.VIEW1; and I get ORA-01031 insufficient privileges error.
    I'm not sure how to troubleshoot this. If John is granted SELECT ANY TABLE, it of course works but I don't want John to have that powerful priv.
    To recap, John has SELECT on both MARK.VIEW1 and the table which VIEW1 selects from (FRED.TABLE1).
    John can select from FRED.TABLE1 no problem but receives a privilege error even though John has SELECT on MARK.VIEW1.
    Any thoughts?
    Oh, Oracle EE 10.2.0.4Are you certain John has been granted select on Mark.view1 ? In order for that to work Mark would have to have been given select on Fred.table1 WITH GRANT OPTION ... otherwise the grant would fail and then John would not be able to select from the view because the grant was never successfully issued.
    Here's a basic test case (which i think conforms to what you've outlined) to get it working.
    drop user u1 cascade;
    drop user u2 cascade;
    drop user u3 cascade;
    create user u1 identified by u1;
    grant connect, resource to u1;
    create user u2 identified by u2;
    grant connect, resource, create view to u2;
    create user u3 identified by u3;
    grant connect, resource to u3;
    connect u1/u1@orcl
    create table test1 (col1 number);
    grant select on test1 to u2 with grant option; --> this is the important part
    grant select on test1 to u3;
    connect u2/u2@orcl
    create view test2 as select * from u1.test1;
    grant select on test2 to u3;
    connect u3/u3@orcl
    select * from u2.test2;

  • Select * from user_grants ?

    Hi!
    - If I want to know all my objects, I write SELECT * FROM
    USER_OBJECTS
    - If I want to know all my tables, I write SELECT * FROM
    USER_TABLES
    - If I want to know all my views, I write SELECT * FROM
    USER_VIEWS
    What do I write if I want to know all the grants I have given?
    Thank you for your help.
    Peter

    try this tables
    user_col_privs
    user_col_privs_made
    user_col_privs_recd
    user_tab_privs
    user_tab_privs_made
    user_tab_privs_recd
    column_privileges
    table_privileges
    Base table is sys.objauth$
    Rajesh

  • DB Trigger: select from and into current table

    I'm running 8.0.5 and facing a table looking like MYTAB(RECID,RECLABEL,..., PARENTRECID, PARENTRECLABEL) where:
    . RECID = current record UID (say: employee number)
    . RECLABEL = current record label (say: employee name)
    . PARENTRECID = RECID of another record in table MYTAB (say: employee ID of the manager of the current employee)
    . PARENTRECLABEL = must be made to hold automatically the contents of RECLABEL in the parent record (say: the name of the manager of the current employee)
    I know an easy way to get this info would be to use a view like CREATE VIEW MYVIEW AS SELECT A.RECID, A.RECLABEL, A.PARENTRECID, B.RECLABEL "PARENTRECLABEL" FROM MYTAB A, MYTAB B WHERE A.PARENTRECID=B.RECID but for various reasons I would really love to denormalize that info into column PARENTRECLABEL using a database trigger.
    Obviously, table MYTAB itself cannot be selected from during the execution of the dB trigger: mutating table error !
    I tried:
    . to select from a view defined as "SELECT * FROM MYTAB" as suggested in another thread, but this trick didn't seem to be sufficient to lure Oracle (it still says I'm trying to select from a mutating table !)
    . to use a package within which a PL/SQL table variable is filled with the list of affected RECID on a FOR EACH ROW basis, and to issue updates in a after statement (thus: not AFTER EACH ROW) AFTER UPDATE trigger - but it's too late already and those updates are apparently not taken into account by the database.
    Any other suggestions?
    Thx - Didier

    Here's the code, if the formatting in unpreserved please do let me I'll mail the same.
    The Package
    CREATE OR REPLACE PACKAGE save_table_package
    AS
    TYPE saved_test2_type
    IS TABLE OF test2%ROWTYPE
    INDEX BY BINARY_INTEGER;
    saved_test2 saved_test2_type;
    saved_test2_num NUMBER:= 1;
    PROCEDURE save_test2_row(i_id NUMBER
    ,i_ename VARCHAR2
    ,i_mgr_id NUMBER
    ,i_mgr_ename VARCHAR2
    PROCEDURE clear_rows;
    END save_table_package;
    show err
    CREATE OR REPLACE PACKAGE BODY save_table_package AS
    PROCEDURE save_test2_row(i_id NUMBER
    ,i_ename VARCHAR2
    ,i_mgr_id NUMBER
    ,i_mgr_ename VARCHAR2
    IS
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Enter pkg.save_test2_row:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
    save_table_package.saved_test2(saved_test2_num).id := i_id;
    save_table_package.saved_test2(saved_test2_num).ename := i_ename;
    save_table_package.saved_test2(saved_test2_num).mgr_id := i_mgr_id;
    save_table_package.saved_test2(saved_test2_num).mgr_ename := i_mgr_ename;
    DBMS_OUTPUT.PUT_LINE('Saved Details Of Row ###:' | |
    TO_CHAR(save_table_package.saved_test2_num,'099999') | |'('| |
    TO_CHAR(save_table_package.saved_test2(saved_test2_num).id,'099') | |','| |
    save_table_package.saved_test2(saved_test2_num).ename | |','| |
    save_table_package.saved_test2(saved_test2_num).mgr_id | |','| |
    save_table_package.saved_test2(saved_test2_num).mgr_ename | |')'
    save_table_package.saved_test2_num := save_table_package.saved_test2_num + 1;
    DBMS_OUTPUT.PUT_LINE('Leave pkg.save_test2_row:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
    END save_test2_row;
    PROCEDURE clear_rows IS
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Enter pkg.clear_rows :'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
    save_table_package.saved_test2_num := 1;
    DBMS_OUTPUT.PUT_LINE(' Leave pkg.clear_rows :'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
    END clear_rows;
    END save_table_package;
    show err
    The Triggers
    CREATE OR REPLACE TRIGGER trig_bfr_iup_test2_fer
    BEFORE INSERT OR UPDATE OF mgr_id ON test2 FOR EACH ROW
    DECLARE
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Enter before insupd:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
    save_table_package.save_test2_row(:new.id
    ,:new.ename
    ,:new.mgr_id
    ,:new.mgr_ename);
    DBMS_OUTPUT.PUT_LINE('Leave before insupd:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
    END;
    show err
    CREATE OR REPLACE TRIGGER trig_aft_iup_test2_stm
    AFTER INSERT OR UPDATE OF mgr_id ON test2
    DECLARE
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Enter after insupd:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
    FOR i IN 1 .. save_table_package.saved_test2_num - 1
    LOOP
    UPDATE test2 eme
    SET mgr_ename = (SELECT mgr.ename
    FROM test2 mgr
    WHERE mgr.id = eme.mgr_id)
    WHERE eme.id = save_table_package.saved_test2(i).id
    DBMS_OUTPUT.PUT_LINE('MGR_ENAME Set Row#:'| |TO_CHAR(i,'099999'));
    END LOOP;
    save_table_package.clear_rows;
    DBMS_OUTPUT.PUT_LINE('Leave after insupd:'| |TO_CHAR(save_table_package.saved_test2_num,'099999'));
    END;
    show err
    null

  • Setting current row of a view based on row selected from another view.

    Hi,
    We have two Views V1 and V2. Both views are based on the same tables except that V1 is based on multiple tables. In our application we are showing a read only table which is based on V1. The user can select a particular record for edit. But the edit page is based on V2 and as a result the first record always shows up for editing even though the user may have selected another record.
    Is there a way we can pass the primary key of the record selected from V1 to V2 and set that record as the current record.
    We have tried setCurrentRowWithKey, but this did not help.
    Regards
    RHY

    Hello,
    post the PK as an URL parameter within the link you open the edit page. Then read this parameter in your page (the page with this link) action class and send it to an ActionBinding:
    JUCtrlActionBinding action = (JUCtrlActionBinding) bc.findCtrlBinding("nameOfBinding");
    ArrayList arrayList= new ArrayList();
    arrayList.add(0,primaryKey);
    action.setParams(arrayList);
    action.doIt();
    In your AppModule create a method nameOfBinding with primaryKey as in parameter
    public void nameOfBinding (Number primaryKey )
    getV2().setWhereClause("PRIMARY_KEY=:0");
    getV2().setWhereClauseParam(0,primaryKey );
    getV2().executeQuery();
    In the AppModule you have to publish this method in "ClientInterface".
    Create an Action binding for this method in your list jsp.
    Hope this helps
    Britta

  • Selection from a Maintenance View

    Hi,
        I have to fetch data from a view, unfotunately that view is a mainteance view. Is there any other way to select/fetch data from that view in my report program ?
    Regards,
    Bharath Mohan B

    Hi
    U cannot access the data from maintanence view.
    Only projection and database view can be used in ABAP code.
    If u want to access the Data from more the one table , Create the DATABASE VIEW and use this view in ur program.
    For example : UR Database view name is Ztest
    in ur program
    table Ztest.
    select * from Ztest ***************
    *******************UR Business Logic
    <b>Reward if useful</b>

  • Can't select from view even though it appears in ALL_VIEWS

    Oracle's documentation states that all_views "describes the views accessible to the user":
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2117.htm
    DBA_OBJECTS appears in the ALL_VIEWS, yet I get a "table or view does not exist" error when I try to select from it.
    Any thoughts on why this is happening?
    SQL> SELECT COUNT(1)
      FROM all_views
      WHERE owner = 'SYS'
      AND view_name = 'DBA_OBJECTS'
      COUNT(1)
             1
    1 row selected.
    SQL> SELECT *
      FROM sys.dba_objects
    SELECT *
      FROM sys.dba_objects
    Error at line 2
    ORA-00942: table or view does not exist

    That's not standard behaviour:
    DBA >create user u1 identified by u1;
    Utente creato.
    DBA >grant connect to u1;
    Concessione riuscita.
    DBA >conn u1/u1
    Connesso.
    DBA >select count(0) from all_views;
      COUNT(0)
           856
    DBA >select view_name from all_views
      2  where view_name like 'DBA%'
      3  or view_name like 'V$%';
    VIEW_NAME
    DBA_PROCEDURES
    DBA_PUBLISHED_COLUMNS
    V$OBJECT_USAGE
    DBA >select 'select count(*) from '||owner||'.'||view_name||';'
      2  from all_views
      3  where view_name like 'DBA%'
      4  or view_name like 'V$%';
    'SELECTCOUNT(*)FROM'||OWNER||'.'||VIEW_NAME||';'
    select count(*) from SYS.DBA_PROCEDURES;
    select count(*) from SYS.DBA_PUBLISHED_COLUMNS;
    select count(*) from SYS.V$OBJECT_USAGE;
    DBA >select count(*) from SYS.DBA_PROCEDURES;
      COUNT(*)
          6793
    DBA >select count(*) from SYS.DBA_PUBLISHED_COLUMNS;
      COUNT(*)
             0
    DBA >select count(*) from SYS.V$OBJECT_USAGE;
      COUNT(*)
             0All the DBA* or V$ visible are also accessible, DBA_OBJECTS is not present in ALL_VIEWS.
    There's something strange on your user's priviledges...
    Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/02/query-gerarchiche/]

  • Error while selecting from view that references external table

    Can someone explain why the error near the bottom of the code below is occuring? If USER1 grants SELECT on the external table to USER2, then USER2 can select from the view without any problems; however, I want to avoid giving USER2 access to all of the columns in the external table. (I only want to give USER2 access to two of the four columns.)
    SQL> CONNECT sys AS SYSDBA
    Connected as SYS@ as sysdba
    SQL> CREATE USER user1 IDENTIFIED BY user1
    User created.
    SQL> CREATE USER user2 IDENTIFIED BY user2
    User created.
    SQL> GRANT CONNECT, CREATE TABLE, CREATE VIEW TO user1
    Grant complete.
    SQL> GRANT CONNECT TO user2
    Grant complete.
    SQL> GRANT READ, WRITE ON DIRECTORY EXT_DATA_DIR TO user1, user2
    Grant complete.
    SQL> CONNECT user1/user1
    Connected as USER1@
    SQL> CREATE TABLE emp_xt
      emp_id     NUMBER,
      first_name VARCHAR2(30),
      last_name  VARCHAR2(30),
      phone      VARCHAR2(15)
    ORGANIZATION EXTERNAL
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY EXT_DATA_DIR
      ACCESS PARAMETERS
        RECORDS DELIMITED BY NEWLINE
        FIELDS TERMINATED BY ','
        OPTIONALLY ENCLOSED BY '"'           
      LOCATION ('emp.txt')
    REJECT LIMIT 0
    Table created.
    SQL> SELECT COUNT(1) FROM emp_xt
      COUNT(1)
             4
    1 row selected.
    SQL> CREATE OR REPLACE VIEW emp_xt_view AS SELECT first_name, last_name FROM emp_xt;
    View created.
    SQL> SELECT COUNT(1) FROM emp_xt_view
      COUNT(1)
             4
    1 row selected.
    SQL> GRANT SELECT ON emp_xt_view TO user2
    Grant complete.
    SQL> CONNECT user2/user2
    Connected as USER2@
    SQL> SELECT COUNT(1) from user1.emp_xt_view
    SELECT COUNT(1) from user1.emp_xt_view
    Error at line 0
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    ORA-04043: object "USER1"."EMP_XT" does not exist
    SQL> CONNECT user1/user1
    Connected as USER1@
    SQL> GRANT SELECT ON user1.emp_xt TO user2
    Grant complete.
    SQL> CONNECT user2/user2
    Connected as USER2@
    SQL> SELECT COUNT(1) from user1.emp_xt_view
      COUNT(1)
             4
    1 row selected.
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    user503699 wrote:
    user1983440 wrote:
    Can someone explain why the error near the bottom of the code below is occuring? If USER1 grants SELECT on the external table to USER2, then USER2 can select from the view without any problems; however, I want to avoid giving USER2 access to all of the columns in the external table. (I only want to give USER2 access to two of the four columns.)As you have demonstrated, I guess the view approach only works for database tables. External tables are actually files on the file system. Even through OS, it is not possible to grant READ/WRITE access to only part of the file. The access is for entire file. An "External Table" is just a "wrapper" provided by oracle (using data cartridge) to allow user to be able to access the file as a "table". So it can definitely not do something that underlying OS can not do.
    p.s. In fact, oracle does not even allow to edit data in external tables using SQL.Why not just make a second external table (only including the 2 columns you need) and grant select directly on that to the user. I know you say "views only" but there's an exception to every rule ... just because it's called a table doesn't make it so. You could argue an external table is nothing more than a fancy view.
    Worst case, make a view on top of the second external table.
    CREATE TABLE emp_xt_less_information
      first_name VARCHAR2(30),
      last_name  VARCHAR2(30)
    ORGANIZATION EXTERNAL
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY EXT_DATA_DIR
      ACCESS PARAMETERS
        RECORDS DELIMITED BY NEWLINE
        FIELDS TERMINATED BY ','
        OPTIONALLY ENCLOSED BY '"'   
             emp_id      number,
             first_name  char,
             last_name   char,
             phone       char
      LOCATION ('emp.txt')
    REJECT LIMIT 0
    {code}
    Should do it, but my syntax may be off a touch ....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error while selecting from a view ORA-01031: Insufficient privileges

    As DBA I have granted select privileges on a view to a user, but whenever I login as that user and try to select from the view I get the message 'ORA-01031'. When I run the query in the view as the user I do not have problem and can see the results. This view joins tables from more than one schema and does a distinct on the resultset. I am new to Oracle and would appreciate any help I can get.
    Thanks

    Back on this problem when I created another user with select permission on the same view and a default role that has reference on all the objects on the other schemas, I end up with the same error message. Although this time the schema owner of the view has select privileges on all the tables from other schemas referenced in the view.
    Thanks

  • Can ResultSetMetaData() return the table name if it is selected from a view

    hi all
    can anyone tell me if ResultSetMetaData() can return the name of the table if it is selected from a view? thanks, i tried and it didn't return nothing. is it because the view is treated differently than table in ResultSetMetaData?

    hi all
    can anyone tell me if ResultSetMetaData() can return
    the name of the table if it is selected from a view?
    thanks, i tried and it didn't return nothing. is it
    because the view is treated differently than table in
    ResultSetMetaData?I would say "no". A view could be a multi-table join query, or maybe even a no-table query. The bigger picture I think though, is that you shouldn't need to know what the underlying table(s) were for this query - smells of a mis-design.

  • Invalid Column Name on select from materialized view?

    Hey all, I have created this materialized view for my java to select from. For some reason when I try to select from it, I get invalid column name. Here is my mat view statement in its simplest form:
    create materialized view mv_pgridtcevcluster_property as
    select distinct clustername_ as "OBJECT_ID", CLUSTERNAME_, LICENSEMODE_
    from p_gridtcevcluster p
    order by clustername_;
    Now when I run my select statement from jdbc:
    SQL: select object_id from MV_PGRIDTCEVCLUSTER_PROPERTY
    java.sql.SQLException: Invalid column name
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
         at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3319)
         at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1926)
         at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1515)
         at com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342)
         at historian.objects.mgmt.udrManagerTest.gatherObjects(udrManagerTest.java:73)
    Anyone have issues with this before? It seems to throw the error sporatically, any help would be much appreciated!
    Regards,
    TimS
    Edited by: TimS on Mar 30, 2009 1:54 PM
    Nevermind, figured it out. Was using wrong column name identifier when picking values from resultset.

    Since you have "OBJECT_ID" in quotes, Oracle stores the column name literally and case sensitively, and the column name must be capitalized when referenced.
    From a regular sql*plus window, try
    select object_id from mv_pgridtcevcluster_property;
    select OBJECT_ID from mv_pgridtcevcluster_property;
    select "OBJECT_ID" from mv_pgridtcevcluster_property;What is the result from each of them?

Maybe you are looking for

  • Problem with *serial no. profile* in work sheduling view of material master

    Hi ! ! I am here with a problem with serial no. profile in work sheduling view of material master. By mistake for some FHMI type ( PRODUCTION RESOURCE TOOLS )materials, serial no profile exist in 'work sheduling' view. Due to that we are facing probl

  • Servlet cannot invoke package classes

    I have two class which is authenticateController and userAuthentication store in authencation package with path WEB-INF/class/authentication/. My jvm is unable compile authenticateController in authentication directory but it is not problem in path W

  • First call fails on iOS 4.1

    I installed iOS 4.1 onto my iPhone 4 last week and didn't notice this problem over the weekend, but today several times when someone called me, they were able to hear me but I wasn't able to hear them. They would hang up and call back and then everyt

  • Invalid Drive C:\ Message

    I have a windows 2003 terminal server that needed to have the Drive C changed to Drive X for a special application to run under terminal services.  When I try to install Crystal Reports XI Runtime i get "Invalid Drive c:\". How do i get Crystal Repor

  • Several cases in a case structure ?

    is it possible to have several in one case structure and using a boolean switch to run them ?? thanks.