본문 바로가기

Computer Engineering/DB

(58)
오라클 sql 쿼리 임시 변수 사용하기, UNDEFINE (Using the &, && Subsitiution Variable) 1. sql에서 임시 변수를 사용하는 방법이다 WHERE 절에서 디비에필드 값을 직접 입력하지 않고 변수를 사용한다. 아래와 같이 변수명 앞에 & 연산자를 붙이고 실행하면 실행한뒤에 그에 해당 하는 값을 물어본다 여러 값을 바꾸어 가면서 실행할때 유용하다. 2. && 연산자는 DEFINE 처럼 한번 변수에 값을 입력하면 그 변수를 사용합면 입력한 값이 계속 실행된다. 3. && 연산자로 입력한 값을 초기화 하는 방법이다 값을 바꾸고 싶을때 아래와 같이 UNDEFINE 명령을 사용하여 할당된 값을 지운뒤 다시 실행하면 다시 입력 하라는 메시지가 뜬다.
오라클 sql 조건 비교 (Comparison Conditions ) Comparison Conditions Operator Meaning = Equal to > Greater than >= Greater than or equal to
오라클 quote 연산자 (oracle Alternative quote (q) Operator ) Alternative quote (q) Operator Specify your own quotation mark delimiter- Choose any delimiter- Increase readability and usability- q 연산자는 q'[ ]' 을 사용하여 [] 안에 잇는 문자열들을 그대로 사용하여 문자열을 합쳐주는것으로 '
오라클 컨케티네이션 연산자 (Oracle Concatenation Operator ) Concateneation Operator A Concatenation operator: links columns or character strings to other columns - 문자나 컬럼들을 연결한다. is represented by two vertical bars(||) -'||' 연산자를 사용한다. Crates a resultant column that is a character expression - 캐릭터로 표현된 컬럼 결과를 생성한다. 예제 ) 'last_name' 과 ',' 와 'job_id' 를 하나로 합쳐서 Employees 라는 컬럼으로 출력하였다. 출처 : 오라클 공인 교재 SQL Fundamentals 1-16
오라클 Null Value 정의 Defining a Null Value A null is a value that is nuavailable, unassigned, unknown, or inapplicable. - 널은 사용불가, 할당 불가, 알수 없는 값이며, 적용할수 없는 값이다. A null is not the same as a zero or a blank space. - 널은 0 도 아니고 공백이나 스페이스도 아니다. null 과 연산한 결과는 null 이다 . 출처 : 오라클 공인 교재 SQL Fundamentals 1-12
CTAS (Create Table as select ) 시타스 CTAS (Create Table as select ) 란 말그대로 새로운 테이블을 생성할때 기존의 테이블의 컬럼 속성과 해당데이터를 모두 똑같이 복제 하여 새로운 테이블을 만들때 사용하는 sql 명령어로 매우 간편하게 테이블과 데이터를 생성할 수 있다는 장점이 있다. 그러나 제약에 있어서는 not null 속성외에는 복제가 안된다. 따로 일일이 설정해줘야 한다 1. 복사할 원본 테이블의 데이터를 본다. SQL> SELECT * FROM 원본 테이블명; 2. CTAS 명령 실행 SQL> CRATE TABLE 생성할 테이블명 AS SELECT * FROM 원본 테이블명; 3. 생성한 테이블 속성을 확인해 본다. NOT NULL속성고 함께 컬럼 정보들이 그대로 복사생성되었다. SQL> DESC 생성된 테이블..
오라클 Oracle SQL*Plus Version 11.1 General Note: Oracle in its near infinite wisdom dropped sqlplusw.exe from the initial release of 11gR1. If want it you can copy in the executable from 10.2.0.1 and in most cases rename the DLL oraclient11.dll to oraclient10.dll. Then you will again have a usable interface. If you are as thrilled as we are about this send us an email and we will pass it along to Oracle. Constants Co..
오라클 show 명령어 General ALL Display SQL*Plus configuration parameters SHOW ALL conn uwclass/uwclass show all AUTORECOVERY Display whether AUTORECOVERY is enabled SHOW AUTORECOVERY show autorecover ERRORS Display information about the most recent PL/SQL compilation error SHOW ERRORS conn uwclass/uwclass CREATE PROCEDURE p IS BEGIN bad_code; END; / show errors INSTANCE Display the connect identifier for the defau..