Oracle SQL Syntax

As I tend to forget the syntax of Oracle SQL commands, I will write them down here, every time I have to look them up. Beginning now:

Turn off variable replacement in SQL+

set define off;

Add Column

alter table <tablename> add <column_name> <column_datatype> <column_constraint>

Example:

alter table test_table add property varchar2(255) NOT NULL;

Drop Column

alter table <tablename> drop column <column_name>
Also look here.

Rename Column

alter table <tablename> rename column <column_name_old> to <column_name_new>;

Modify Column

alter table tablename modify darfabgerechnetwerden null;

Using SQL+ Command Line tool

Connect:

connect scott/tiger

Excecute a sql-file

@path/to/myscript.sql
also see this

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert