Self-Improvement

DB별로 LEFT(), RIGHT(), LENGTH(), LEN() 본문

SQLi

DB별로 LEFT(), RIGHT(), LENGTH(), LEN()

JoGeun 2020. 4. 27. 17:08

MySQL

select left((select table_name from information_schema.tables limit 1),2)

select right((select table_name from information_schema.tables limit 1),2)

select length((select table_name from information_schema.tables limit 1))

 

MSSQL

select LEFT((select top 1 table_name from information_schema.tables),2)

select right((select top 1 table_name from information_schema.tables),2)

select len((select top 1 table_name from information_schema.tables))

 

Oracle

Oracle에서는 LEFT(), RIGTH() 함수가 존재하지 않는다.

select LENGTH((select table_name from (select rownum as rowidx,table_name from tabs)t where t.rowidx=1)) from dual