Oracle Apex application - oracle

We are doing a project on Oracle Apex for university. We have 12 tables and try to build an app for our project. When we try to add a new page for some of our tables (not all of them) we encounter this error error description.
Can someone know how to solve this issue which is really blocking us right now.
We tried everything to solve it. All of our constraints in our tables work. What we don't understand is why we can create sometimes new pages from some tables but for other it does not work.

To me, that (unfortunately) looks like bug as you don't have any impact on Apex' data dictionary tables.
If you connect as a privileged user and check what's exactly being violated, you'll see something like this.
Which table is that constraint related to? Apparently, none:
SQL> select table_name from dba_constraints where owner = 'APEX_200200' and constraint_name = 'WWV_DICTIONARY_CACHE_OBJ_IDX2';
no rows selected
Any luck with (unique) indexes, then? Yes!
SQL> select table_name from dba_indexes where owner = 'APEX_200200' and index_name = 'WWV_DICTIONARY_CACHE_OBJ_IDX2';
TABLE_NAME
------------------------------
WWV_DICTIONARY_CACHE_OBJ
Which columns are used to enforce uniqueness?
SQL> select column_name from dba_ind_columns where index_name = 'WWV_DICTIONARY_CACHE_OBJ_IDX2';
COLUMN_NAME
--------------------------------------------------------------------------------
SECURITY_GROUP_ID
OBJECT_ID
OBJECT_TYPE
SQL>
That's to get you started; you know which table you used for that page so write some more queries and you'll - hopefully - find some move info.
How to "fix" that error? I hope you won't delete or update anything on Apex' dictionary tables! Maybe you'd rather rename that table (to avoid uniqueness violation) and try to use it, with its new name, while creating the page in your application.

If a workspace contains other object types with the same name as a table, APEX data dictionary cache job, ORACLE_APEX_DICTIONARY_CACHE, fails with ORA-00001: UNIQUE CONSTRAINT (APEX_190200.WWV_DICTIONARY_CACHE_OBJ_IDX1)
Workaround: Remove the duplicate object that is not a table. You can list database objects by selecting from sys.dba_objects.
Oracle APEX 19.2 Known Issues

Related

Using oracle seq generator in Informatica Mapping [duplicate]

I use SQL developer and i made a connection to my database with the system user, after I created a user and made a another connection with that user with all needed privileges.
But when I try to proceed following I get the SQL Error
ORA-00942 table or view does not exist.:
INSERT INTO customer (c_id,name,surname) VALUES ('1','Micheal','Jackson')
Because this post is the top one found on stackoverflow when searching for "ORA-00942: table or view does not exist insert", I want to mention another possible cause of this error (at least in Oracle 12c): a table uses a sequence to set a default value and the user executing the insert query does not have select privilege on the sequence. This was my problem and it took me an unnecessarily long time to figure it out.
To reproduce the problem, execute the following SQL as user1:
create sequence seq_customer_id;
create table customer (
c_id number(10) default seq_customer_id.nextval primary key,
name varchar(100) not null,
surname varchar(100) not null
);
grant select, insert, update, delete on customer to user2;
Then, execute this insert statement as user2:
insert into user1.customer (name,surname) values ('michael','jackson');
The result will be "ORA-00942: table or view does not exist" even though user2 does have insert and select privileges on user1.customer table and is correctly prefixing the table with the schema owner name. To avoid the problem, you must grant select privilege on the sequence:
grant select on seq_customer_id to user2;
Either the user doesn't have privileges needed to see the table, the table doesn't exist or you are running the query in the wrong schema
Does the table exist?
select owner,
object_name
from dba_objects
where object_name = any ('CUSTOMER','customer');
What privileges did you grant?
grant select, insert on customer to user;
Are you running the query against the owner from the first query?
Case sensitive Tables (table names created with double-quotes) can throw this same error as well. See this answer for more information.
Simply wrap the table in double quotes:
INSERT INTO "customer" (c_id,name,surname) VALUES ('1','Micheal','Jackson')
You cannot directly access the table with the name 'customer'. Either it should be 'user1.customer' or create a synonym 'customer' for user2 pointing to 'user1.customer'. hope this helps..
Here is an answer: http://www.dba-oracle.com/concepts/synonyms.htm
An Oracle synonym basically allows you to create a pointer to an object that exists somewhere else. You need Oracle synonyms because when you are logged into Oracle, it looks for all objects you are querying in your schema (account). If they are not there, it will give you an error telling you that they do not exist.
I am using Oracle Database and i had same problem. Eventually i found ORACLE DB is converting all the metadata (table/sp/view/trigger) in upper case.
And i was trying how i wrote table name (myTempTable) in sql whereas it expect how it store table name in databsae (MYTEMPTABLE). Also same applicable on column name.
It is quite common problem with developer whoever used sql and now jumped into ORACLE DB.
in my case when i used asp.net core app i had a mistake in my sql query. If your database contains many schemas, you have to write schema_name before table_name, like:
Select * from SCHEMA_NAME.TABLE_NAME...
i hope it will helpful.

Oracle tables show "not_found?.TABLENAME

I am using Oracle. A legacy script created our table structure.
When I try to select from, say, tableA, sql developer very helpfully finds the table as I type. But instead of filling in a valid user it shows me (eg)
SELECT * FROM not_found?.tableA
I'm guessing the script pulled the user incorrectly, but the table seems to actually exist (or it wouldn't fill in the user, n'est ce pas?). Does anyone know WHERE THE HECK IT IS?
Use this to find the schema in which the table is:
select owner from all_tables where table_name = 'TABLEA';

SQLDeveloper Trigger Error report - ORA-00942: table or view does not exist

I put this code into SQL Developer's Worksheet:
CREATE TRIGGER T_testDSNa
before INSERT
on testDSNa
referencing new as new
for each ROW
BEGIN
SELECT S_testDSN.nextval INTO :NEW.SYSID FROM dual;
END;
I get this:
Error report -
ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
*Cause:
*Action:
Would anyone know why? This has worked for 3 previous tables until I tried to run the DDL to create a 4th. Alternatively, is there a better way to set up an autoincrementing PK?
The problem was lack of schema. Oracle Definition of a schema :
Collection of database objects, including logical structures such as
tables, views, sequences, stored procedures, synonyms, indexes,
clusters, and database links. A schema has the name of the user who
controls it.
If you want to know the objects accessible without alias. You have to look on [USER_OBJECTS]. Which describes the relational objects owned by the current user :
SELECT
OBJECT_NAME
, OBJECT_TYPE
, LAST_DDL_TIME
FROM USER_OBJECTS;
If you want to know the objects accessible to the current user :
SELECT
OWNER
, OBJECT_NAME
, OBJECT_TYPE
, LAST_DDL_TIME
FROM ALL_OBJECTS;
In your case to see your objects in the list of available tables you need:
SELECT * FROM ALL_OBJECTS WHERE OWNER = 'USER';
You can also alter the session to avoid alias :
ALTER SESSION SET current_schema = User;
For priviliges/ roles views you can look at :
SELECT * FROM USER_SYS_PRIVS;
SELECT * FROM USER_ROLE_PRIVS;
The last method but not the most secure to avoid alias. Is to log on with a user that has the same name as the schema.
Hoping that it can help
I was getting the same issue.
Solution: What I observed that my table which I created was surrounded by double quotes, which made it case sensitive.
So for each time I refer to my table, I need to surround it by double quotes.
CREATE TRIGGER T_testDSNa
before INSERT
on "testDSNa"
referencing new as new
for each ROW
BEGIN
SELECT S_testDSN.nextval INTO :NEW.SYSID FROM dual;
END;
refer this link: What exactly do quotation marks around the table name do?

oracle 11g dispaly user created tables

Hi I m new to oracle using 11g exprs edition and familiar with mysql. We can use the below code to display all databases in mysql
show databases;
What is the corresponding command in Oracle. Or how can i display all databases. Also We have
use mydatabase;
to chanage database in mysql. How can i change database in oracle. I tried to display all owners and their tables using the following command
select table_name, owner from all_tables;
It working fine. But when I tried to display tables I have created, by adding a where cluase
select table_name, owner from all_tables where owner='root';
it shows no rows were selected. Why this happens? Also I am facing the same problem with most of the queries when using the where clause. Without where clause it works fine. but when using it, the result is no rows selected for example
select * from all_tab_comments where owner='root';
select constraint_name, constraint_type from user_constraints where table_name='location';
Is there anything special in oracle for where clause or the problem with my query.
Your username is very unlikely to be root; it could however be ROOT, in which case you could do:
select table_name, owner from all_tables where owner='ROOT';
The owner name is case-sensitive, and all objects including users and table names are upper-case by default (unless they're created with double-quotes, which is a bad idea). If you're connected as that user, to see only your own tables you can also do:
select table_name from user_tables;
And there is the dba_tables view which also shows you tables you don't have permissions on, but you can only see that with elevated privileges.
Oracle doesn't have 'databases' in the same sense as other products. You probably means schemas, as the logical grouping of objects. And schemas and users are essentially synonymous.
To get a list of all schemas you can query dba_users (if you have the right privileges), or to get a list of schemas that have objects - as you may have users who only use objects in other schemas - you can do:
select distinct owner from dba_objects;
... or all_objects to again only see things you have permissions for. To see what kind of objects:
select owner, object_type, count(*) from dba_objects group by owner, object_type;
The documentation explains the static data dictionary views which hold all of this information. You won't be able to see all of them though, unless you're connected as a privileged user.
There will be a lot of differences between the two products; you might be better off trying to find a tutorial that works through them rather than using trial and error and trying to understand what's gone wrong at each step. Or at least familiarise yourself with the Oracle documentation so you can research issues.
First, there is going to be a terminology difference when you change platforms. What MySQL calls a "database" is most similar to what Oracle calls a "schema". If you are using Oracle XE, you can only have one database (using Oracle terminology) on the machine. You can have many schemas within that database.
The owner in all_tables is the name of the schema that owns the table. Assuming that you created an Oracle user root (which seems like an odd choice for a database user) and assuming that you did not create a case-sensitive user name in all lower case (which would create a ton of issues down the line), the owner will always be upper-case.
SELECT owner, table_name
FROM all_tables
WHERE owner = 'ROOT'
In Oracle, you do not generally change from one schema to another. You either fully qualify the table name
SELECT *
FROM schema_name.table_name
or you create synonyms (public or private) for objects that you want to reference
CREATE SYNONYM synonym_name
FOR schema_name.table_name;
SELECT *
FROM synonym_name
If you really want to, however, you can change your current schema for name resolution purposes
ALTER SESSION SET current_schema = <<schema name>>
use the view : tabs
select * from tabs;

Need to update an Oracle view, but the base table doesn't exist

I'm trying to make an extremely minor change to a view on an oracle database, but what's confusing me is that the base table/view for the view I want to change doesn't seem to exist.
First I did this:
select text from all_views where view_name='(view name)';
and got the view text, which of course was something like this:
SELECT
(fields)
FROM (table)
Trying to run this query on its own returns an error saying that this table or view does not exist. Searching through the lists of table names and views on the all_ tables returns nothing. Creating a new view with the same source select statement tells me I can't make it because the table or view doesn't exist. Now, this is a production database, so this should work because I can use the existing view just fine. I don't have much experience with oracle databases, so I'm probably missing something here.
I'm betting the view is in another schema. Does this return the same as your first query:
select text from all_views where view_name='(view name)' and owner = user;
If that returns no rows, then you need to find the view's owner:
select owner from all_views where view_name = '(view_name)';
And change your SQL to
select (fields) from (view_owner).(table);
You can create a view even if there doesn't exist base table by "FORCE" option("NO FORCE" is
the default) by this way:
CREATE FORCE VIEW test_view AS
SELECT c1, c2 FROM test_table; -- table, which does not exist yet.
Since we did not use the FORCE option, the view was not created.However, trying to access the
view gives an error, because the table TEST_TABLE does not exist yet.
Wow, nevermind. They weren't even asking me to do this. I missed that part in the original email.
By using "FORCE" we can also create a view by dual table(default table for oracle).
1-Example:create force view v1 as select a,b,c from dual;
Warning:view created with compilation error.
2-Example:create force view v2 as select *from dual;
Answer:view created.
Your should use force keyword..
create force view my_view as elect column1 from table_test -- table is not exists here..

Resources