행위

오라클 구문 다이어그램

DB CAFE

thumb_up 추천메뉴 바로가기


1 오라클 예약어 다이어그램[편집]

https://docs.oracle.com/database/121/SQLRF/ap_syntx001.htm#SQLRF55485

1.1 Graphic Syntax Diagrams[편집]

구문 다이어그램은 유효한 SQL 구문을 나타내는 도면입니다. 다이어그램을 읽으려면 화살표로 표시된 방향으로 왼쪽에서 오른쪽으로 추적하십시오.

Syntax diagrams are drawings that illustrate valid SQL syntax.To read a diagram, trace it from left to right, in the direction shown by the arrows.

명령 및 기타 키워드는 사각형 안에 대문자로 표시됩니다. 사각형에 표시된대로 정확하게 입력하십시오.

Commands and other keywords appear in UPPERCASE inside rectangles.Type them exactly as shown in the rectangles.

타원 안에 매개 변수가 소문자로 나타납니다. 변수는 변수에 사용됩니다. 문장 부호, 연산자, 구분 기호 및 종결자가 원 안에 표시됩니다.

Parameters appear in lowercase inside ovals. Variables are used for the parameters. Punctuation, operators, delimiters, and terminators appear inside circles.

구문 다이어그램에 하나 이상의 경로가 있으면 임의의 경로를 선택할 수 있습니다.

If the syntax diagram has more than one path, then you can choose any path.

예를 들어 , 다음 구문에서 NOPARALLEL 또는 PARALLEL을 지정할 수 있습니다.

For example, in the following syntax you can specify either NOPARALLEL or PARALLEL:

parallel_clause.gif

하나 이상의 키워드, 연산자 또는 매개 변수를 선택할 수 있으면 옵션이 세로 목록에 나타납니다. 예를 들어 다음 구문 다이어그램에서 스택에 네 개의 매개 변수 중 하나 이상을 지정할 수 있습니다.

If you have the choice of more than one keyword, operator, or parameter, then your options appear in a vertical list. For example, in the following syntax diagram, you can specify one or more of the four parameters in the stack:

physical_attributes_clause.gif


다음 표는 구문 다이어그램에 나타나는 매개 변수를 표시하고 명령문에서 대체 할 수있는 값의 예를 제공합니다.

The following table shows parameters that appear in the syntax diagrams and provides examples of the values you might substitute for them in your statements:
Parameter 설명 예시
table The substitution value must be the name of an object of the type specified by the parameter. For a list of all types of objects, see the section, "Schema Objects". employees
c

The substitution value must be a single character from your database character set.

T s

'text'

The substitution value must be a text string in single quotation marks. See the syntax description of 'text' in "Text Literals".

'Employee records'

char

The substitution value must be an expression of data type CHAR or VARCHAR2 or a character literal in single quotation marks.

last_name

'Smith'

condition

The substitution value must be a condition that evaluates to TRUE or FALSE. See the syntax description of condition in Chapter 6, "Conditions".

last_name >'A'

date

d

The substitution value must be a date constant or an expression of DATE data type.

TO_DATE(

'01-Jan-2002',

'DD-MON-YYYY')

expr

The substitution value can be an expression of any data type as defined in the syntax description of expr in "About SQL Expressions".

salary + 1000

integer

The substitution value must be an integer as defined by the syntax description of integer in "Integer Literals".

72

number

m

n

The substitution value must be an expression of NUMBER data type or a number constant as defined in the syntax description of number in "Numeric Literals".

AVG(salary)

15 * 7

raw

The substitution value must be an expression of data type RAW.

HEXTORAW('7D')

subquery

The substitution value must be a SELECT statement that will be used in another SQL statement. See SELECT.

SELECT last_name FROM employees

db_name

The substitution value must be the name of a nondefault database in an embedded SQL program.

sales_db

db_string

The substitution value must be the database identification string for an Oracle Net database connection. For details, see the user's guide for your specific Oracle Net protocol.

1.1.1 필수 키워드 와 파라미터[편집]

필수 키워드 및 매개 변수는 단독으로 또는 수직 대체 목록에 나타날 수 있습니다.

하나의 필수 키워드 및 매개 변수가 현재 이동중인 수평선 인 기본 경로에 나타납니다. 다음 예제에서 library_name은 필수 매개 변수입니다.

drop_library.gif

만약 HQ_LIB라는 라이브러리가 있으면 다이어그램은 다음 명령문이 사용됩니다. If there is a library named HQ_LIB, then, according to the diagram, the following statement is valid:

DROP LIBRARY hq_lib;

만악 기본 경로와 교차하는 세로 목록에 여러 개의 키워드 또는 매개 변수가 나타나면 그 중 하나가 필요합니다. 키워드 또는 매개 변수 중 하나를 선택해야 하지만 반드시 기본 경로에 나타나는 것은 아닙니다. 다음 예는 ALL, STANDBY 또는 NONE을 선택해야합니다.

security_clause.gif

1.1.2 선택적 키워드 와 파라미터[편집]

키워드와 파라미터가 기본 경로 위의 세로 목록에 나타나면 선택 사항입니다. 다음 예는 세로선을 따라 이동하는 대신 기본 경로를 따라 계속 진행할 수 있습니다.

deallocate_unused_clause.gif size_clause.gif


다이어그램에 따르면 다음 명령문이 유효합니다.

DEALLOCATE UNUSED;
DEALLOCATE UNUSED KEEP 1000;
DEALLOCATE UNUSED KEEP 10G;
DEALLOCATE UNUSED 8T;

1.1.3 구문 반복[편집]

루프를 사용하면 원하는만큼 구문을 반복 할 수 있습니다. 다음 예제에서는 하나의 값 표현식을 선택한 후 쉼표로 구분하여 다른 값 표현식을 반복해서 다시 선택할 수 있습니다.

query_partition_clause.gif

1.1.4 멀티파트 다이어그램[편집]

모든 메인경로가 끝에서 끝까지 연결된 것처럼 멀티 파트 다이어그램을 읽습니다. 다음 예제는 세 부분으로 구성된 다이어그램입니다.

alter_java.gif

다이어그램에 따르면 다음 명령문이 유효합니다.

ALTER JAVA SOURCE jsource_1 COMPILE;


1.1.5 Database Objects[편집]

테이블 및 컬럼 같은 Oracle 식별자의 이름은 30자를 초과 할 수 없습니다. 첫 번째 문자는 문자여야 하지만 나머지는 문자, 숫자, 달러 기호 ($), 파운드 기호 (#) 및 밑줄 (_)의 조합 일 수 있습니다.

그러나 Oracle 식별자가 큰 따옴표(")로 묶인 경우 공백을 포함하여 따옴표를 제외한 유효한 문자 조합을 포함 할 수 있습니다.

Oracle 식별자는 큰 따옴표를 제외하고 대소 문자를 구분하지 않습니다.

1.2 Backus-Naur Form (BNF) 문법[편집]

Each graphic syntax diagram in this reference is followed by a link to a text description of the graphic. The text descriptions consist of a simple variant of Backus-Naur Form (BNF) that includes the following symbols and conventions:

[ ]	선택 목록 (Brackets enclose optional items.)
{ }	1개만 선택(Braces enclose items only one of which is required.)
|	중괄호,대괄호 안에서 대체 (A vertical bar separates alternatives within brackets or braces.)
...	앞의 구문이 반복 (Ellipsis points show that the preceding syntactic element can be repeated.)
delimiters	Delimiters other than brackets, braces, vertical bars, and ellipses must be entered as shown.
boldface	굵게 표시된 단어는 키워드입니다. 표시된대로 입력해야합니다. 
               키워드는 일부 운영 체제에서 대소 문자를 구분하지만 일부 운영 체제에서는 대소 문자를 구분하지 않습니다. 
               굵은 체로 표시되지 않은 단어는 이름이나 값을 대체해야하는 자리 표시자입니다.

(Words appearing in boldface are keywords. They must be typed as shown. (Keywords are case-sensitive in some, but not all, operating systems.) Words that are not in boldface are placeholders for which you must substitute a name or value.)

참고 BNF 표기법

:=          정의를 의미하며 예시 <digit>:=0|1|2|3|4|5|6|7|8|9 
<>          순서를 유지해야 하는 표현은 <operator><operand>(<연산자><피연산자>) 처럼 순서대로 나열.

[<sign>] 생략할 수 있는 선택표기 <digit>+ <digit>을 최소 한 개 있어야 하고 반복가능 <mid expr>* <mid expr>이 없거나 반복해서 올 수 있음