No results when querying wwv_flow_files - oracle

Oracle SQL Developer 3.0.03
Why do I not see any results when I run the following query in SQL Developer?
select * from wwv_flow_files;
Yet, if I run the same query in APEX SQL Commands, I see results.

It may be because
WWV_FLOW_FILES is view top of table WWV_FLOW_FILE_OBJECTS$. From
WWV_FLOW_FILES
view you can access files only associated to your workspace.

Related

Crystal Reports not returning data from some Oracle views using Oracle driver

I'm using Crystal Reports 2013 and have Oracle ODAC 32 and 64 bit versions installed. If I create a new report and use the "Oracle Server" data source, I can select from any tables to which I have access. However, I find I retrieve no data from some, not all, views.
The queries work fine in SQL Plus or SQL Developer. The queries retrieve data in Crystal Reports using outdated drivers like OLE DB and ODBC.
I can't find a commonality between the views that do or don't work. All the views I've tested with belong to the same schema. they all involve tables that belong to a third schema -- that is, I log in as USER1, query from a view belonging to USER2, which pulls data from tables belonging to USER2 and USER3. In order to create a view on a table and make that view available to others, Oracle requires SELECT WITH GRANT OPTION permission, which is in place. Again, the queries work fine in other SQL tools.
UPDATE: I've tried logging in as the owner of the views and was unable to query them. I've tried querying the underlying tables as the view owner (user2) and as the Crystal Reports owner (user1). Both users are able to query the underlying tables. The view itself seems to be the problem.
I'm studying the differences between the views that work and the views that don't work. I was optimistic when I found that the views that don't work were all using ORDER BY clauses that referenced column position (ex: ORDER BY 2, 1). I tried rewriting the ORDER BY to use column names. Didn't work. Tried removing the ORDER BY clauses. Didn't work. Back to the drawing board.
I found that the problem was that the Oracle view was using Oracle-specific, non-standard SQL. In addition to the ORDER BY 2, 1 mentioned above, there was an implicit date conversion in the WHERE clause e.g.
WHERE date_col = '01-JAN-2016'
When I added the TO_DATE function:
WHERE date_col = TO_DATE ('01-JAN-2016', 'dd-MON-yyyy')
Crystal Report was able to query the view.

Oracle 12c query results in sqlplus but not SQL Developer

I have a single instance called sp_admin with several tables. One of them is called 'tenant_api_user'. From sqlplus, I can select * from any of the tables, including tenant_api_user (or select count(*) etc) and the results are fine. However, when I run queries against this one specific table in SQL Developer, it always returns zero records.
When I run the select * from tenant_api_user; from SQL Developer, it returns 0 records instantly - no waiting. That same query from sqlplus returns the only record in the table. When I try to update a record that is visible from sqlplus, SQL Developer says 0 rows updated.
Has anyone experienced this kind of behavior before? It seems to be isolated to just this table. SQL Developer doesn't behave this way with any other table.
If you have entered the data in one session and you have not run a commit statement then you will not be able to see the data in another session until it has been committed.

Script to compare Oracle Schema with Teradata Views

I have a task to compare some Teradata Views with actual Oracle Tables.
I need a script for that.I have taken Java approach in which I connect to a specific schema from Oracle and then call the SELECT * FROM all_tables order by TABLE_NAME query and write this into a file.
I do the same for other schema but now my problem is Teradata.
Can you people please suggest me some script or query by which I can get proper details like it does with Oracle.
There is no complex Java Code but if you still want I can post it.
Edited:
Okay now I have a schema in Oracle which has all the tables.so views for those tables are created in Teredata.
I have to compare oracle tables and Teradata views every morning and send the differances.
So I use SELECT * FROM all_tables order by TABLE_NAME in Oracle and for Teradata I use SELECT * FROM dbc.tables WHERE tablekind='V' AND databasename='SCHEMA' order by TableName so now when I compare them I dont get accurate results, so I wanted to know does any script exists or how do I approach.
If your question is "How can I programmatically determine the structure of a view in Teradata?", then this should be a step in the right direction: HELP VIEW yourviewname;.
To get a list of views on a given table:
SELECT TableName
FROM DBC.Tables
WHERE Tablekind = 'V'
AND requestText LIKE '%yourtablename%'
GROUP BY 1
ORDER BY 1;
This information was gleaned from the official Teradata forums. You might also be interested in the Teradata users manuals. (Select your release version on the top right.)

SSIS breaks Oracle Privileges

I make a privileges to user on one schema at Oracle, when accessing oracle database using SSIS I saw all tables and schema. When I use SQL Plus show me only one schema.
What is the problem here?
What query are you running to see tables in SQL*Plus? If you are querying USER_TABLES, you will only see the tables that the current user owns. If you are querying ALL_TABLES, you will see all the tables that you have permission to query regardless of the owner. If you are querying DBA_TABLES, you will see all the tables in the database (though you need additional privileges to query the DBA% objects.
There is another question on how to get a list of all the tables in a database that goes into more detail about this.

Possible to link to another database link?

We have an existing database link in an Oracle database that links to data in a Sql Server database. Now, a 2nd Oracle database needs to use that same data. Due to security setup, the 2nd Oracle database cannot "see" the Sql Server database, but it can see the 1st Oracle database.
If we create a database link in the 2nd Oracle database that points to the 1st Oracle database, will we be able to query data from the Sql Server database in the 2nd Oracle database by going through 2 database links? Would the query syntax look like this:
SELECT * FROM myTable#2ndLink#1stLink
Has anyone done something like this before?
Vincent's solution will work, and another solution is to create a synonym instead of a view.
DB1:
CREATE SYNONYM X FOR MyTable#sqlServerDB
DB2:
(assumes db link to DB1 connects as owner of synonym)
SELECT * from X#DB1
I'm not sure this synthax would work (although it would be interesting to test it I can not do it right now). However, even if it doesn't work, you can still create a view in Database 1 that points to a table in your SQL Server Database. From Database 2, you could then query:
SELECT * FROM myView#db1
That would point to the correct table.

Resources