ORA-00903 when selecting from a view

Hi,
I'm migrating our existing database on 8.1.7 to 9.2 and I keep getting an ORA-00903 error (on Oracle 9.2.0.1.0) when I try to select from a view with nested selects. Here's a very simple example - no rows are returned when I issue the query (its a dummy query, but it illustrates the problem). However, as soon as I turn it into a view, and do a select from the view, I get an Invalid Table Name error. Can anyone suggest why this is happening?
So... This works on its own
SELECT ID
FROM (
SELECT /*+ ORDERED */
t.id
FROM tblmsg t,
tblevent e,
e_workflowstate s,
(SELECT e_taskstatus_id
FROM e_taskstatus s,
e_workflowplntasks ws
WHERE s.e_taskstatus_id = ws.taskid
UNION ALL
SELECT e_taskstatus_id
FROM e_taskstatus s,
e_workflowmantasks ws
WHERE s.e_taskstatus_id = ws.taskid
UNION ALL
SELECT e_taskstatus_id
FROM e_taskstatus s,
e_workflowtrgtasks ws
WHERE s.e_taskstatus_id = ws.taskid) V
WHERE t.id = e.id
AND t.id = v.e_taskstatus_id
AND V.e_taskstatus_id = e.id)
But this doesn't
CREATE OR REPLACE VIEW TESTVIEW AS
SELECT ID
FROM (
SELECT /*+ ORDERED */
t.id
FROM tblmsg t,
tblevent e,
e_workflowstate s,
(SELECT e_taskstatus_id
FROM e_taskstatus s,
e_workflowplntasks ws
WHERE s.e_taskstatus_id = ws.taskid
UNION ALL
SELECT e_taskstatus_id
FROM e_taskstatus s,
e_workflowmantasks ws
WHERE s.e_taskstatus_id = ws.taskid
UNION ALL
SELECT e_taskstatus_id
FROM e_taskstatus s,
e_workflowtrgtasks ws
WHERE s.e_taskstatus_id = ws.taskid) V
WHERE t.id = e.id
AND t.id = v.e_taskstatus_id
AND V.e_taskstatus_id = e.id);
View created
SELECT * FROM TESTVIEW;
ERROR at line 1:
ORA-00903: invalid table name
This works fine on 8.1.7. I haven't tested it on 9.1 though.
Any ideas?
Thanks

One thing to try would be to use SCHEMA.TABLENAME rather than just TABLENAME to refer to the tables.
Its just a shot in the dark, but hopefully it may help.
Martin.

Similar Messages

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

  • How to avoid ORA-3113 when selecting from XMLTYPE table

    Hi,
    If I register an XML-schema, Oracle automatically creates a table xxxxxx_tab of XMLTYPE. (I use Oracle 9.2.0.1)
    When I do a DESCRIBE or a SELECT from this table I get the error: 'ORA-03113:
    end-of-file on communication channel' and my connection is dropped.
    I opened a TAR for this and Oracle says: 'It is an internal bug so cannot be viewed in metalink. This is fixed in release 10i.' (do they mean oracle DB rel 10i, or a new version of XDK?)
    I saw an example in Oracle Magazine (Jan
    2003) "Make XML Native and Relative" about Oracle 9i Rel 2 and XML. As you can see in codeListing 7, the author also does a select from such a
    table (CD331_tab): Why doesn't he have any problems?
    Is there a workaround for this bug? What's the purpose of being able to automatically upload XML-data to a registered schema if you can't do a select of the data?
    Thank you!

    It appears that the XML Schema is not entirely valid. Specifically, the definition of element "DeviceCategory" has two definitions of element "Audio" appearing within a <choice> model i.e. something like :
    <element name="DeviceCategory">
    <choice>
    <sequence>
    <element name="Audio">
    </sequence>
    <sequence>
    <element name="Audio">
    </sequence>
    </choice>
    This is disallowed by XML Schema spec per. the Unique Particle Attribution Constraint. The general idea is that a XML Schema describes a determinstic content model i.e. schema processor can always unambiguosly determine the matching declaration when it encounters an element. However that's not the case with the declaration above. On encoutering "Audio", it could match either the first or the second declaration of the element. Hence the error.
    You will have to rework the schema to avoid this constraint. One mechanism could be to define complexType and their restrictions.
    - Ravi

  • Ofen() hangs when selecting from a view with a database link.

    We have some old COTS software that recently started causing problems after upgrading our database from 9i to 10g (10.2.0.4) on HP Itanium server.
    The select statment in quesiton hits a view that references a table via a database link. After returning a few rows, the process hangs. Reducing the number of columns in the select statement resolves the problem.
    Any ideas? Note that the full sql statment was working prior to the 10g upgrade.

    One thing to try would be to use SCHEMA.TABLENAME rather than just TABLENAME to refer to the tables.
    Its just a shot in the dark, but hopefully it may help.
    Martin.

  • ORA-01446 when selecting ROWID from View with Union

    I have a View that uses a Union to select from 3 tables. I would like the View to return the ROWID for the record that is returned so that I can update it in my form. The View compiles fine but when I select from the View I get ORA-01446 error.
    Example of my view:
    SELECT ROWID, col_a, col_b, col_c
    FROM tab_a
    UNION ALL
    SELECT ROWID, col_a, col_b, col_c
    FROM tab_b
    UNION ALL
    SELECT ROWID, col_a, col_b, col_c
    FROM tab_c
    I need the ROWID because my tables do not contain UNIQUE/PRIMARY key constraints. In my form I want to update the view with an underlying INSTEAD OF database trigger.
    Any suggestions?

    I think it will work if you give the column an alias (ie a name after the first rowid) and select that instead.
    You will probably also need another column in your view indicating which table the row came from if you want to update it.

  • 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

  • Selection from maintenance view

    Hi,
    I have created and activated a maintenance view from tables EKPO and EKKO. I needed an outer join so I had to use maintenance view instead of datbase view. When I see the data in the view using SE11 it works fine. However, when I try to select some fields from it using code it gives me an error message.
    Eg.
    REPORT Z_TEST_REP.
    TABLES: Z_MAINTVIEW.
    SELECT * FROM Z_MAINTVIEW.
    WRITE: / Z_MAINTVIEW-MYFIELD1.
    ENDSELECT.
    When activating, this gives me the error message: "Z_MAINTVIEW" is not defined in the ABAP Dictionary as a table, projection view or database view.
    Does this mean that it is not possible to select single fields from a maintenance view using the select statement? Is there any way I can do this? Any help is appreciated. Thanks.
    Khan

    Hi Khan,
    it is in the nature of EKKO (header) and EKPO (items) that you have 1 to n records (ittems) in EKPO with the same EBELN (purchase order document number). They all have different EBELP (item number values).
    I just tried: You can create a database view with tables EKKO and EKPO with join condition EKKO-EBELN = EKPO-EBELN. In the view you also need EKKO-MANDT = EKPO-MANDT to make sure you stay in your client.
    In the view fields, put all fields you want and/or need.
    You can select from this view; works great.
    Alternative: Use BAPI_PO_GETDETAIL to get all the header and item data you need. This is 100 % compliant with standard and (as I am convinced) with any programming guidelines.
    - OK as I don't know the business scenario, it might be lesss than most appropriate...
    Regards,
    Clemens

  • Access 2010 on 64 Bit Windows 7 Access "Not Responding" when changing from forms view to design view and back

    I am running
    Windows 7 64 bit
    Access 2010 32 bit
    Developing an application with a split FE BE with both files local but continue to have the message "Not Responding" when switching from forms view to design view and back as well as if I try to connect to a subform or object on the sub form.

    I have seen this behavior when the form's RecordSource is a complex query such as a crosstab or a query with several nested queries. To test if this is your case, remove the RecordSource and see if the form starts acting normal again.
    Then again, if the form has several subforms they might be slowing up the loading time.
    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

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

  • Is selecting from a view more efficient than selecting from multiple tables

    Hi heres the problem
    Lets say i created a view from 2 tables (person and info). both have a ID column
    create view table_view (age,name,status,id) as
    select a.age, a.name, b.status, b.id
    from person a, info.b
    where a.id=b.idif i want to select a given range of values from these 2 tables which of the following queries would be more effective.
    select a.age, a.name, b.status, b.id
    from person a, info.b
    where a.id=b.id
    and a.id <1000
    select age, name, status, id
    from table_view
    where  id <1000

    Bear in mind that this concept of views storing the SQL text is something relative to Oracle databases and not necessarily other RDBMS products. For example, Ingres databases create "views" as tables of data on the database and therefore there is a difference between selecting from the view and selecting from the base tables.
    Oracle also has "materialized views" which differ from normal "views" because they are actually created, effectively, as tables of data and will not use the indexes of the base tables.
    In Oracle, you cannot create indexes against "views" but you can create indexes against "materialized views".

  • 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

  • Performance problem with select from _DIFF view

    Hi,
    we have a versioned table with more then one million records. We use the DBMS_WM.SetDiffVersions procedure and select from DIFF view to get data differences between two workspaces. The problem is that the select from the DIFF view is very slow. I takes more than 15 minutes. Has anybody an idea why it consumes so much time? Is there any way how to improve it?
    Thanks and regards
    Ondrej

    Hi,
    This can be due to any number of things, but is typically caused by an inefficient optimizer plan. Make sure that statistics on the _LT table have been recently analyzed.
    Also the following information would be useful:
    1. What is the relationship of the workspaces that you are trying to compare (parent/child, children of the same parent, etc) ?
    2. How many and of what type dml are being performed in the workspaces ?
    3. What version of Workspace Manager are you using and what is the version of the database ?
    4. What is the time needed to select from the _DIFF view based on the primary key ?
    Regards,
    Ben

  • Apple reminders do not disappear from "all" and "missed" view when dismissed from "today" view of notification center by marking the circle by the reminder. why is this?

    Firstly, I really like the new reminders in iOS 7. However, I noticed that apple reminders do not disappear from "all" and "missed" view when dismissed from "today" view of notification center by marking the circle by the reminder. it requires me to take an extra step and click on "all" and then click the "x" to make it completely disappear and clear from notification center.
    why is this? am i doing something from?

    unfortunately, that does not address my question. your link describes how to clear the missed section of center.  I know how to clear the missed section of notification center, as I said in the original question. I will re-peat my question to clarify. it is:
    apple reminders do not disappear from "all" and "missed" view when dismissed from "today" view of notification center by marking the circle by the reminder. it requires me to take an extra step and click on "all" and then click the "x" to make it completely disappear and clear from notification center. 
    why is this? am i doing something wrong?
    the behavior I would expect would be that when i click the circle on the "today" view. it would clear it out from the missed and all view so i would not have to clear in 2 areas.
    I Hope this clarifies...

  • LTR - Error occurred when selecting from database

    Hi,
    We created couple of configurations using LTRC in our SLT systems. When i try to check these in transaction LTR, they are not displayed, just getting the error - Error occurred when selecting from database (Attached screenshot). All the required SICF for SLT has already been activated. Any suggestions how to fix this issue?
    Thanks,
    Saravanan

    Hi Experts,
    Did anybody get the solution of this error ,if yes please reply?
    I am getting below error when I am refreshing the current config or creating a new one in LTR
    " Error occurred when selecting from database"
    Thanks for your help,
    Balwant

  • Music doesn't start when selected from playlist have to push pause then start. Always playing one track behind what is on screen

    Music doesn't start when selected from playlist have to push pause then start. Always playing one track behind what is on screen as my I-pad worksorks fine

    Same problem here, since upgrading to IOS-5.  Whenever I try to shuffle or play a genius mix (or even simply play an album) the iPod will skip the first one or two songs, play one song and then 'crash'.  I say 'crash' because it selects the next song and then nothing happens - the player isn't paused, and it appears to think it's playing, but the time bar doesn't change and no sounds come out.  Occasionally I've noticed the album artwork is wrong too.
    Rebooting does NOT work - I've tried it a number of times.
    Is this just an iPod problem??  If so, I would be surprised if Apple do anything quickly about it - they're more worried about iPhone problems I expect, and we (iPod users) are just the poor relations...  C'mon Apple - SORT IT OUT!!!!

Maybe you are looking for

  • Failure using {CALL } syntax & passing string params w/ # (hash)

    We are experiencing a problem calling functions using the {CALL } syntax and passing string parameters that contain # (hash) symbols. Apparently, something interprets the # inside the string literal and fails the call. We use this syntax with procedu

  • Import metadata table error

    I am facing the problem in the Oracle Warehouse Builder(OWB). The following is the error description. Please guide us. Cwm Error Message: SQL Exception Cwm Error: SQL Exception Class Name: CacheMediator Method Name: getDDEntryFromDB Repository Error

  • EWA  Report  as Word Attachment to email address

    hi Currently I have html format of  EWA report automatically sent to Basis Team email id . How do I get EWA  report file  as  MSWORD  Attachment in email. Yes. I can see that   in Solman System , MSword file is generated ., But emailed  only HTML  ve

  • Back up DVD issues

    Recently I used Mac the Ripper to back up my small personal dvd library...the dvd's play fine on my Pioneer dvd player however they won't play on my mac computer...why is that? Any ideas are greatly appreciated. Angela

  • Question about my system and install

    If you take a look at my sig, you'll see what i have running. It all runs like a champ, but one thing gets to me. In my tray there is the "Safely Remove hardware"  Is that just something on the nforce boards, or is that a result of the way I may have