티스토리 뷰

Database/Oracle

[오라클] sqlplus 치환 변수

데브포유 2012. 11. 12. 14:40
반응형

1. 치환변수 사용하기


def size 100;


select level

from dual

connect by level <= &size;



2. 파라미터 사용하기

&1, &2  등등으로 사용가능


def size &1  로 사용하면 더 편리함



3. accept 명령어 사용

accept command, one of SQL*Plus commands, sets the value of the variable and used as followings.

 

accept variable  

accept variable number
accept variable char
accept variable date
accept variable binary_float
accept variable binary_double
accept variable format format-string
accept variable default default-value
accept variable prompt prompt-string
accept variable noprompt
accept variable hide
 
accept foo prompt 'Entry value for foo'
 
When you accept the password, use like this
accept pw prompt 'Enter your secret password' hide

반응형