Bootstrap FreeKB - Oracle Database - Create Table
Oracle Database - Create Table

Updated:   |  Oracle Database articles

This assumes you have an Oracle database up and running. If not, check out my article Install Oracle Express Database on Docker.

The select sys_context('USERENV', 'CURRENT_SCHEMA') from dual statement can be used to list the schema being used by the user you are logged in as.

SQL> select sys_context('USERENV', 'CURRENT_SCHEMA') from dual;

SYS_CONTEXT('USERENV','CURRENT_SCHEMA')
--------------------------------------------------------------------------------
SYS

 

And here is an example of how to create a table in your users schema.

SQL> CREATE TABLE SYS.persons(person_id NUMBER GENERATED BY DEFAULT AS IDENTITY, first_name VARCHAR2(50) NOT NULL, last_name VARCHAR2(50) NOT NULL, PRIMARY KEY(person_id));

Table created.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter c4ff99 in the box below so that we can be sure you are a human.