Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create a blank table with no column

Tags:

sql

oracle10g

Is it possible to create a table without any column? If YES then how can I do it in oracle.

like image 906
Tanvir Patel Avatar asked Oct 06 '15 03:10

Tanvir Patel


2 Answers

  1. Create table without columns:
    CREATE TABLE tab();

ORA-00904: : invalid identifier

  1. Create with one column and try to drop it:
    CREATE TABLE tab(t INT);
    ALTER TABLE tab
    DROP COLUMN t;

ORA-12983: cannot drop all columns in a table

The construct with no column does not have any sense. If you need table as placeholder use DUAL like:

SELECT 1 + 1 AS result
FROM dual;
like image 139
Lukasz Szozda Avatar answered Sep 21 '22 19:09

Lukasz Szozda


A table is a collection of columns and rows. You need at least one column.

like image 23
Jayanti Lal Avatar answered Sep 21 '22 19:09

Jayanti Lal