ORA-01436: CONNECT BY loop in user data in Toad Used by Tab for tables - oracle

As you know in TOAD, we can see where a table is used (in package or in view).
But when i try to see where my table is used it is showing the error :ORA-01436: CONNECT BY loop in user data.
Other tables are showing up their used status nicely.
Any help??enter image description here

Alternatively you can use ALL_SOURCE to check where your table has been referred in the code.

Related

How to resolve error ORA-20987: APEX - ORA-02015?

I have a page in apex with multiple interactive grid. In one of the interactive grid i am trying to update the data of a column of a table in the database. The column named defect kind is a dropdown in the grid and on click of save should be able to updated the column value in database with the selected value in the grid.
While clicking on save apex is showing an error as follows:
Ajax call returned server error ORA-20987: APEX - ORA-02015: cannot select FOR UPDATE from remote table for.
I have used the type interactive grid - automatic row processing(DML) for saving the grid. Only defect kind is selected by the user rest all column value are coming directly from the table.
Interactive grid image:
NOTE:For this workspace the tables are accessed through a database link. I am using APEX 5.1.
This error is raised specifically because you are working over a database link.
Error code: ORA-02015
Description: cannot select FOR UPDATE from remote table
Cause: An attempt was made to select FOR UPDATE on a remote table (directly, or via a view) that had abstract data type columns, and the
view or select list contained abstract data type columns or non-column
items.
Action: To attempt a select FOR UPDATE, use a view or select list that consists only of base columns from the remote table, none of
which may be abstract data type columns.
I can't tell from what you've posted if the issue is with the query you're using to populate the IG or with some underlying view or the table itself. Depending your ability to locate and remove the "abstract data type columns or non-column items" (if that's even possible with an IG) you may not be able to make this work with automatic row processing over a database link at all. It may require a custom PL/SQL API instead.
Have you tried to set the attribute Lock Row (group Settings) to No in your Interactive Grid - automatic row processing(DML) process?

How can I create a table with same attributes of a View another system delivers me?

An external system granted to my system a view named V_EXT so that I can make selections on it, reading all its content:
SELECT *
FROM V_EXT;
this view has a lot of fields and I would like to create an empty table in my system with the exactly same attributes of this view (same names and same types). Is there a way to do this without simply guessing from the content I received what each attribute is?
I am using Oracle SQL Developer.
With Code.
create table objects_copy2
as
select *
from all_objects
where 1=2; -- add this line if you want NO data, otherwise you get all the data too
With SQL Developer specifically, it's actually harder. You would need to find the underlying OBJECT(s) used in the query. Then look up those data types, and manually build out your CREATE TABLE statement.
CREATE TABLE AS SELECT is the way to go. (Docs)
Note there are some limitations, for example this won't pick up Identity Column definitions from the source table used in the view.
An example:

:APP_USER usage in SQL query. Oracle Application Express (Apex) 5.0.4

I want to use session variable :APP_USER in query in selection database statement like this:
select * from :APP_USER.data
I have users john.doe and johny.b.
I have table john.doe.data and i want to get all data from this table. Also i have table johny.b.data and when johny.b will login in, I want to get data from table johny.b.data.
I hope you understand my plan, so it is like every user have own data table and I want to display table according to logged in user. What will be the right way to do this?
I would say this would be possible but shouldn't be done. You'd be better off doing select * from apex_user.table (prefix not needed) where column = :APP_USER and having them all in one big table or having a different table (but same apex_schema) per user. How you'd go about creating this table is up to you - you could select a pseudo-table from dual and then only create it when necessary to prefent any table not found issues.
You'll no doubt run into tablespace permission issues down the line or worse - give the apex user more security permissions than it requires if you go down your intended route which will make exporting and importing a nightmare.

Selection of table (or view) in oracle, that I cannot find in TOAD

I am reverse-engineering an application which administers an Oracle database.
Everything is new to me (application + database)
There is a statement there somewhere, which is:
SELECT * FROM XXX#YYY (XXX is a word, YYY another word)
If I go into my database with TOAD I can't find an 'XXX#YYY' table nor view. If I copy paste the statement in TOAD's editor, I get results as if the table exists.
I know that the '#' symbol is allowed for naming an Oracle object. Is it possible that it means something else here though?
How can I find the table (or view)? Is it possible to get information through a statement such as which schema does 'XXX#YYY' belong to or weather it is a table or a view, so that I can track it?
The database consists of many schemas. There is a default one. Is it possible that XXX#YYY may belong to another schema, rather than the default?
Please help me find the table.
Identifier behind # is database link. It is a way to access objects on some remote Oracle server. more info on http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_5005.htm#SQLRF01205
In Toad/Oracle XXX#YYY means object#database_link.
Look for the schema in your DB, there you will find the table.
Btw: I think its better to use SCHEMA.TABLENAME
If you have problems finding the SCHEMA, go to View->Toad Options, select Treeview at Browser style and then it should display all schemas.

How to dump individual view statements in MySQL

I want to be able to dump individual view statements/definitions from a MySQL database (version 5.5.28) so I can edit them and insert them into a new database. I've been trying to do it with MySQL Workbench (version 5.2.44 on OSX) but it dumps the views as 'CREATE Table' statements without the view logic.
I'm looking for something to analyze a db, give an options for views to dump, and dumps 'CREATE VIEW...' statements to a file to re-create those views.
MySQL has a SHOW CREATE VIEW statement that should do what you need.
Example usage, assuming you view's name is sampleView:
SHOW CREATE VIEW sampleView;
As a note, your user will need the SHOW VIEW and the SELECT privileges to be able to use the SHOW CREATE VIEW command.
An alternative, you can also get this information from the information_schema.VIEWS table.
Using the sampleView name again, the query would look something like:
SELECT
VIEW_DEFINITION
FROM
INFORMATION_SCHEMA.VIEWS
WHERE
TABLE_NAME = 'sampleView';

Resources