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.

Similar Messages

  • In iTunes, when I select the "Device" and then select "My iPod" there in no text

    In iTunes, when I select the "Device" and then select "My iPod", there is no text in the main screen......only the text "iPod", "Version" and "Options" appear with a picture on an iPod on the top of the screen?
    I uninstalled iTunes and installed the version (10-5.3???) for my 64bit computer but no luck. I can transfer songs from cd's and the itunes store easily enough but I just got this thing yesterday and I want to get the full experience and not half of it. I feel like I'm missing something and i'm about ready to take a hammer to it.
    Thank you in advance for any help you can give me.

    It has something to do with Segoe fonts in your system.
    Refer this link for solution
    iTunes 10.1 Missing Text

  • Re install CS5.1: Mac 10.7 failed - upgraded to Mac 10.9, CS 5.1 did not transfer. How do I reinstall - do I delete what I coped from external HD, then reinstall from disks?

    Re install CS5.1??
    Mac 10.7 failed - upgraded to Mac 10.9, CS 5.1 did not transfer from external HD. How do I reinstall - do I delete what I coped from external HD, then reinstall from disks?

    Adobe applications should be installed, not transferred.  If yoiu have the disks then yes, use them.  IF you do not you can download from:
    Download and Installation Help -
    https://helpx.adobe.com/download-install.html

  • Is restoring from icloud faster then itunes?

    Hi!
    Just getting ready to for the New iPad .  I have an iPad 2 (64gb) with about 38gb of data on it and is currently backed up to the cloud.  The question is what is the faster way of restoring my backup to the new iPad?  Will restoring from the cloud take forever with the amount of data I have?  What do you think?  Thanks!
    Mike

    What speed do you rate from your ISP?  One ISP that serves our area rates up to 40Mb/s which is only a 10th that of USB.  Unless you have some super hot ISP and super hot Wi-Fi setup and some ancient computer that only rates USB1 you are not going to beat a wired connection.

  • Is a delete with cascade faster then delete from 2 tables independently?

    Hi there,
    I have 2 tables, TableA and TableB. TableA's primary key is a foreign key of TableB.
    My question is, Would it be faster to delete the associated rows from TableA and TableB independently?
    Or is it faster to create TableB with the ON DELETE CASCADE clause?
    thanks for the help.

    Hi there,
    I have 2 tables, TableA and TableB. TableA's primary key is a foreign key of TableB.
    My question is, Would it be faster to delete the associated rows from TableA and TableB independently?
    Or is it faster to create TableB with the ON DELETE CASCADE clause?
    thanks for the help.

  • Select on view is long - Select on view definition short.

    Greetings Everyone -
    There is a view in Oracle called V$LOCK.
    If I do a count or a select on this view I get a result in *45 seconds*.
    There are only 77 records.
    However - If I do a select or a count on the view definition (found in V$FIXED_VIEW_DEFINITION)
    I get a result in no time. Immediately.
    I am signed in accordingly 'sqlplus / as sysdba'
    What's going on ??? My feable brain cannot comprehend!!!
    Thanks for any help,
    BB

    >
    There is a view in Oracle called V$LOCK.
    >
    On 11.2 that is not correct. A query of 'select * from dba_synonyms where synonym_name like '%LOCK%' shows
    V$_LOCK => V_$_LOCK
    V$LOCK => V_LOCK
    GV$_LOCK => GV_$_LOCK
    GV$LOCK => GV_$LOCK
    And a query of 'SELECT * FROM DBA_OBJECTS WHERE OBJECT_NAME LIKE '%LOCK%' shows
    GV_$LOCK => VIEW
    GV_$_LOCK => VIEW
    V_$LOCK => VIEW
    V_$_LOCK => VIEW
    So V$LOCK is a synonym. And you may be querying the correct underlying view for each of your queries but sometimes the queries may not be on the view that you think they are.
    >
    If I do a count or a select on this view I get a result in 45 seconds.
    There are only 77 records.
    However - If I do a select or a count on the view definition (found in V$FIXED_VIEW_DEFINITION)
    I get a result in no time. Immediately.
    >
    Let's see the first time you query data (when maybe there is nothing in the cache) it is slower than the second time you query the same data (when maby there is something in the cache)?
    That isn't unusual.
    >
    Well - that is interesting. Still it took you 11 seconds for 15 records !!!
    >
    Records? There aren't any 'records'. The V$s are 'dynamic' performance views not tables. And read consistency is not guaranteed for them. The data is continuously updated so if there are no updates the view data won't change and depending on the updated data the view data may barely change.
    It is unlikely that the data changed much, if at all, between your two queries.
    See 'About Dynamic Performance Views' in the Database doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28320/dynviews_1001.htm#i1398692
    >
    Oracle contains a set of underlying views that are maintained by the database server and accessible to the database administrator user SYS. These views are called dynamic performance views because they are continuously updated while a database is open and in use, and their contents relate primarily to performance.
    Although these views appear to be regular database tables, they are not. These views provide data on internal disk structures and memory structures.
    You can select from these views, but you can never update or alter them.
    >
    And see the NOTE just below (as well as the section that discuss the V$ and GV$ views
    >
    Because the information in the V$ views is dynamic, read consistency is not guaranteed for SELECT operations on these views.

  • New iPhone restore from iCloud backup then sync from computer

    Hello
    I am getting a new iPhone 6 tomorrow (fingers crossed delivery is ok).
    I back-up my current iPhone using iCloud and use iTunes match for music but I am getting a 128GB new iPhone so intend putting all my music on that new iPhone.
    What I want to do is use the iCloud restore function to have my new iPhone take on the same settings and app data etc as my current iPhone (which is backed up through iCloud) but then sync all my music from my iMac. It appears that when I plug in a phone to my iMac for the first time iTunes won't let me sync without first either setting the phone up as new or restoring the phone from a iTunes back-up (not an iCloud back-up). Is there anyway to get around this?
    I hope that is clear, it sounds convoluted when I read it back.
    PS additional question for extra credit. Do I need to update my current iPhone to iOS 8 before running a back-up to allow a restore to work on a new iPhone 6 (which will be running iOS 8)?

    If it were me, I would setup your iPhone as a new phone. You will be asked during the setup to enter your Apple ID and password so you can log into iCloud. As long as you have been using iCloud for your Contacts, Notes, Reminders, etc. once your phone is setup iCloud will sync your Contacts, Notes, Reminders, etc. I think you will also be prompted to setup your email account(s).
    I think iPad iCloud back ups are different than iPhone and you can't restore an iPad back up to an iPhone and visa versa. I'm not 100% sure since I don't own an iPad.

  • HT5361 Why can't I put a address from my address book in the to: by pressing click in address book ???? I have to select the name, and then go  to To: and press to get the name entered....

    I have been trying since I installed Mountain Lion to get my mail  to put my names from my address book into my new messages, but I must select the name and then select To: Box to transfer name, Why????

    You cannot mve the songs manually from iphone to your computer.
    The way you do this is exactly what you did :  File>Transfer Purchases

  • 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

  • Inserting the column values into table from view through procedure!!!

    below is my example code
    Create or replace procedure test_proc
    is
    cursor test_cur is
    select a.col1 , b.col2, c.col3, d.col4, e.col5
    from tableA a, tableB b, tableC c, tableD d, tableE e;
    test_cur_rec test_cur%rowtype;
    Begin
    insert into test_stg ( col1, col2, col3, col4, col5, col6, col7)
    Values ( test_cur_rec. col1,
    test_cur_rec .col2,
    test_cur_rec .col3,
    test_cur_rec .col4,
    test_cur_rec .col5
    -- col6, col7 );
    create view test2 (
    select f.col6, g.col7 from tableF f,tableG g);
    I m trying to insert values into the table test_stg but for col6 and col7 i need to get the data from the view test2.
    In simple word, all i need to do is get the 2 columns data from view and insert into a table through procedure. The above code is the example which looks very much like my actual code.
    How do i accomplish this task ??

    well there is joining condition for a, b,c ,d, e tables, i have not mentioned here. The where condition has nothing to do with the other two columns of the view.
    There is no relation ship between the these tables the view. The col 6 and 7 i m inserting from view is sysdate timestamp and the job_id number.
    so its pretty straight forward insertion into the table from view columns. These two columns has just one row with id number and timestamp. so i need to insert these data into the the table when i run a procedure.
    Thank you so much!!!

  • Materialized view fast refresh ...getting ORA-22992: error

    Hi All,
    Oracle version 11.1.0.7
    While creating a materialized view(Fast refresh) on remote tables ... i am getting the ORA-22992: cannot use LOB locators selected from remote tables ... error.
    but the actual scenario is... i am not selecting any of the BLOB/LOB columns from the remote tables. I did n't include them in my materialized query.
    I am able to refresh it complete but couldn't refresh it fast. Here i want to mention other thing... when ever i have records in Mat view log(Base table has a blob cloumns in it)
    i am getting the above error. when no record in the Mat view log(i.e on BLOB base table) .. i can able to refresh it as FAST.
    MV_CAPABILITIES table tells that ...My Mat view is able to refresh it FAST.I don't know howw to approach to solve this issue.could some one tell me the approach..to solve it?
    Here is the sample code ....this is what i have done so fat
    session 1 (REMOTE_ONE)
    I have created synonyms for the remote tables on current schema. That's why i didn't include @DBLINK.
    create table RT_A ( col1_A varchar2(20), col2_A BLOB,COL3_A NUMBER);
    create a table RT_B (COl1_B varchar2(20), col2_B BLOB, COL3_B NUMBER);
    create a table RT_C (COL1_C varchar2(20), col2_C VARCHAR2,COL3_C NUMBER);
    create  MATERIALIZED VIEW LOG ON RT_A 
    WITH  ROWID EXCLUDING NEW VALUES;
    create  MATERIALIZED VIEW LOG ON RT_B
    WITH  ROWID EXCLUDING NEW VALUES;
    create  MATERIALIZED VIEW LOG ON RT_C 
    WITH  ROWID EXCLUDING NEW VALUES;
    grant select on RT_A to CUURRENT_ONE with grant option;
    grant select on RT_B to CUURRENT_ONE with grant option;
    grant select on RT_C to CUURRENT_ONE with grant option;
    grant select on MLOG$_RT_A to CUURRENT_ONE with grant option;
    grant select on MLOG$_RT_B to CUURRENT_ONE with grant option;
    grant select on MLOG$_RT_C to CUURRENT_ONE with grant option;Session 2 (CUURRENT_ONE)
    create materialized view ABC_MV
    BUILD IMMEDIATE REFRESH FORCE ON DEMAND START WITH SYSDATE NEXT SYSDATE+1
    AS
    select A.ROWID AS A_ROWID,
    B.ROWID as B_ROWID,
    C.ROWID AS C_ROWID,
    A.COL1_A,
    B.col1_B,
    c.col1_c
    from RT_A, RT_B,RT_C
    where COL3_A = COL3_B(+)
    and COL3_B = COL3_C(+)Appreciate your help.
    Thanks,
    Mike

    Thanks for the reply
    In that he/she is selecting the LOB column from the remote database(master site).
    I am just referencing the table which has BLOB column in it.I am not referencing any LOB column in my select(Mat view) query...
    is there anything i need to check..?
    Regards,
    Mike

  • Why the componeng id exists in the view when create a dynmaic table?

    In the first page, i add a command button to create a managed bean containing a UIData component, whose the struture is dynamic in runtime, and then forward to other page to show the UIData:
    JSP code:
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <f:view>
    <body>
    <h:form id="welcomeform">
    <h:commandButton value="jump" action="#{welcomeForm.execute}"/>
    </h:form>
    </body>
    </f:view>JAVA code:
    package com.savage.dynweb;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    public class WelcomePage {
    public String execute() {
    DynPage dynPage = new DynPage();
    dynPage.init();
    FacesContext context = FacesContext.getCurrentInstance();
    ValueBinding vb = context.getApplication().createValueBinding("#{requestScope.dynPage}");
    vb.setValue(context, dynPage);
    return "success";
    }faces-config.xml:
    <managed-bean>
    <managed-bean-name>welcomeForm</managed-bean-name>
    <managed-bean-class>com.savage.dynweb.WelcomePage</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
    <from-view-id>/pages/test.jsp</from-view-id>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/pages/dynpage.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>dynpage.jsp code:
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <f:view>
    <body>
    <h:form id="dynform">
    <h:dataTable binding="#{dynPage.dynTable }" var="row" value="#{dynPage.records }"/>
    <h:commandButton value="next" actionListener="#{dynPage.execute}"/>
    </h:form>
    </body>
    </f:view>DynPage.java:
    package com.savage.dynweb;
    import java.util.*;
    import javax.faces.application.Application;
    import javax.faces.component.*;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.faces.event.ActionEvent;
    public class DynPage {
    private UIData dynTable;
    private List<Map<String, String>> records;
    public void init() {
    String[] headers = new String[] {"name", "age", "sex", "birthday"};
    records = new ArrayList<Map<String, String>>(10);
    for(int i = 0; i < 10; i++) {
    Map<String, String> record = new HashMap<String, String>(4);
    record.put("name", "name" + i);
    record.put("age", "age" + i);
    record.put("sex", "sex" + i);
    record.put("birthday", "birthday" + i);
    records.add(record);
    FacesContext.getCurrentInstance().getViewRoot().getChildren().clear();
    Application app = FacesContext.getCurrentInstance().getApplication();
    dynTable = new UIData();
    for(String header : headers) {
    UIColumn column = new UIColumn();
    UIOutput output = new UIOutput();
    ValueBinding vb = app.createValueBinding("#{requestScope.row." + header + "}");
    output.setValueBinding("value", vb);
    UIOutput facet = new UIOutput();
    facet.setValue(header);
    column.setHeader(facet);
    column.getChildren().add(output);
    dynTable.getChildren().add(column);
    public void execute(ActionEvent event) {
    init();
    public UIData getDynTable() {
    return dynTable;
    public void setDynTable(UIData dynTable) {
    this.dynTable = dynTable;
    public List<Map<String, String>> getRecords() {
    return records;
    public void setRecords(List<Map<String, String>> records) {
    this.records = records;
    }face-config.xml:
    <managed-bean>
    <managed-bean-name>dynPage</managed-bean-name>
    <managed-bean-class>com.savage.dynweb.DynPage</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>when I click the next button at the dynpage.jsp, it raised a exception:
    java.lang.IllegalStateException: ******************ID "dynform:_id0:_id4"(means the ID "dynform:id0:_id4" has been existed in the view)��
    com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:201)
    com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:204)
    com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:204)
    com.sun.faces.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:97)
    com.sun.faces.taglib.jsf_core.ViewTag.doAfterBody(ViewTag.java:189)
    org.apache.jsp.pages.dynpage_jsp._jspx_meth_f_005fview_005f0(dynpage_jsp.java:104)
    org.apache.jsp.pages.dynpage_jsp._jspService(dynpage_jsp.java:67)
    But when i append a code:
    FacesContext.getCurrentInstance().getViewRoot().getChildren().clear();
    in the method:init(), everything is ok, why?
    Can anyone to tell me the why it raise the exception, and why I clear the children of the UIViewRoot, the exception is gone.

    Hi Frank,
    Thank you and it can work.
    public void setLowHighSalaryRangeForDetailEmployeesAccessorViewObject(Number lowSalary,
                                                                              Number highSalary) {
            Row r = getCurrentRow();
            if (r != null) {
                RowSet rs = (RowSet)r.getAttribute("EmpView");
                if (rs != null) {
                    ViewObject accessorVO = rs.getViewObject();
                    accessorVO.setNamedWhereClauseParam("LowSalary", lowSalary);
                    accessorVO.setNamedWhereClauseParam("HighSalary", highSalary);
                executeQuery();
    but I have a quesiton in this way. in code snippet, it is first getting current row of current master VO to determine if update variables value of detail VO. in my case, current row is possibly null after executeQuery() of master VO and  I have to change current row manually like below.
    any idea?
                DCIteratorBinding dc = (DCIteratorBinding)ADFUtil.evaluateEL("#{bindings.SSForecastSourceBlockView1Iterator}");
                ViewObject vo = dc.getViewObject();           
                vo.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
                vo.ensureVariableManager().setVariableValue("DateTo", dateTo);
                vo.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
                vo.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
                vo.executeQuery();
                vo.setCurrentRowAtRangeIndex(0);
                ((SSForecastSourceBlockViewImpl)vo).synchornizeAccessorVOVariableValues();

  • 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 ....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to link individual picker view selections to download an individual file from a website or other location such as dropbox using Xcode?

    Alright, the question I have has to deal with how to link an app to a website to download files. How, or is it even possible to link individual picker view selections to download an individual file from a website or other location such as dropbox using xcode. Sorry if this is the wrong place to post this, but if anyone can help or can send a link to a place that can, I would greatly appreciate it!

    I am not getting anywhere with deploying my application or
    applet.
    I have set up my bc4j project. It contains all my VO info,
    links, application module. (proj a)
    I then have another project with DbInfo in it(has all my rowset
    info), Multiple Frames, and my Applet.java file.
    Actually I have an Applet.java file and a Application.java file
    because I was seeing if both/either worked. Anyway they seem the
    same, except for that extra window that comes up when you run the
    applet.
    I follow the steps in the oracle directions (from earlier post).
    And all seems ok. But at ---->
    [*] Select the subdirectory under myhtml where your applet's HTML
    file
    is located, and enter the directory path of the 'staging'
    directory you
    created in step 3 above, if different from the default.</li>
    [*]Select the HTML files that JDeveloper created to run your
    applet.</li>
    [*]Select all of the Java source files in your project that make
    up the
    applet.</li>
    I have no HTML file associated with my applet, at least that I
    know of.
    So do I need to create one, or should it of been done
    automatically.
    Also, I trying to figure out what will be the best way to deploy
    my project. Applet or stand alone application is what my first
    choices have been so far. I have read that there is some issues
    with applets being served from a different server than the
    database. So a stand alone application was my front runner, but
    I haven't gotten either way to work yet.

  • Views - SELECT from VIEW and SELECT from the query inside view definition returning different results

    Hi,
    I am facing this weird issue. Any help would be appriciated.
    I have view with the following definition:
    CREATE VIEW [marketing].[OpenedMails]
    AS
    SELECT
    ID_EmailAddress, 
    ID_Date_Opened, 
    ID_Contact, 
    ID_MailSendJobs,
    COUNT(ID_OpenedMails) AS OpenCount,
    CASE
    WHEN ROW_NUMBER() OVER (PARTITION BY CAST(ID_EmailAddress AS VARCHAR(10)) + ' ' + CAST(ID_MailSendJobs AS VARCHAR(10)) ORDER BY ID_Date_Opened) = 1 THEN 1 
    ELSE 0 
    END
    AS UniqueOpenCount
    FROM            
    dbo.Fact_OpenedMails
    where ID_Contact = 382340
    GROUP BY ID_EmailAddress, ID_Date_Opened, ID_Contact, ID_MailSendJobs;
    order by ID_MailSendJobs 
    When I run the the select statement in the view definition I get combination of both 1 and 0 for the 'UniqueOpenCount' column.
    But when I run the select from the view itself using the following query:
    SELECT [ID_EmailAddress]
          ,[ID_Date_Opened]
          ,[ID_Contact]
          ,[ID_MailSendJobs]
          ,[OpenCount]
          ,[UniqueOpenCount]
      FROM [marketing].[OpenedMails]
    I get equal amount of rows but only 0 values for the 'UniqueOpenCount' column which seems to be very weird to me. Why is this happening ? Can anyone help regarding how to solve this ??
    Result from the select inside view definition:
    Result from the select query directly from the view:
    Thanks in advance.
    Vivek Kamath

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You failed. Temporal
    data should use ISO-8601 formats – you failed again. Code should be in Standard SQL AS much AS possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    Things like “ID_Date_Opened” are wrong. The affixes “id” and “date” are called attribute properties in ISO-11179 and data modeling. Since a date is a unit of measurement on a temporal scale, it cannot be an identifier by definition. My guess is this would be
    “open_date” if it were done right. And the only display format in ANSI/ISO Standard SQL is ISO-8601 (yyyy-mm-dd)
    An email address of -1?? Email addresses are VARCHAR(256), not numeric. There is no reason to cast them AS string!
    Your vague “mail_send_jobs” is plural, but columns hold scalars and cannot be plural by definition. The partition cause can hold a list of columns: 
    WHEN ROW_NUMBER() 
         OVER (PARTITION BY email_address, mail_send_job 
                   ORDER BY open_date)
         = 1 
    THEN 1 ELSE 0 END 
    This still makes no sense, but the syntax is better. You do not understand how ROW_NUMBER() works. 
    Would you like to try again with proper Netiquette? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

Maybe you are looking for

  • Can my hp monitor be able to connect to iPad or watch tv if I've throw away thr tower.

    Hp monitor with able to watch tv  but not I can't couse my CPU was thrown away........?

  • Macbook and G4 pro

    ok so i have had a G4 tower sitting in my closet for some time now and i was wondering if theres some way i can browse the files on there, i tried remote desktop but i cant figure it out and i dont exactly have another monitor. any help?? thanks!

  • R12: "Login" Post-Installation check fails on OEL5

    I have installed EBS R12 on Oracle Enterprise Linux 5 (Update 2). All post-installation checks succeed except for the Login. The following error message is displayed: RW-50016: Error: -{0} was not created: File = {1} I already tried the following: -

  • Please help me resolve this JSP compilation error

    Hi, We have deployed our web app in Sun one web server 7.0 running on Sun os, and with JRE 5.0. Until recently, every thing was running fine, but since a few days, I am unable to get a JSP file compiled. This file, has a <%@include file= .. > to anot

  • Encoding-Vector Objects-Jaggies

    Greetings from Beautiful Boise I have Stroked a path in After Effects, rendered to uncompressed .avi, and imported into a Sequence in Premiere Pro. When I attempt to encode to either .flv or .f4v (so, ON2 or h.264) my vector Stroke is corrupted. Thes