Nisar Nisar - 7 months ago 20
SQL Question

missing or invalid schema element (ON CREATING SCHEMA)

I am trying to create new schema in

https://apex.oracle.com
workspace

but showing an error

ORA-02422: missing or invalid schema element



CREATE SCHEMA AUTHORIZATION NI***@GMAIL.COM

CREATE TABLE new_product
(color VARCHAR2(10) PRIMARY KEY, quantity NUMBER)
CREATE VIEW new_product_view
as select COLOR, QUANTITY from NEW_PRODUCT where COLOR = 'RED'
GRANT select ON new_product_view TO NI***@GMAIL.COM
;

Answer

The schema name on apex.oracle.com is the workspace name, which is not necessarily the same as the username you use to login.

Schema names with non-standard characters must be referenced using double quotes:

CREATE SCHEMA AUTHORIZATION "NI***@GMAIL.COM"
 CREATE TABLE new_product 
    (color VARCHAR2(10)  PRIMARY KEY, quantity NUMBER) 
Comments