q友問題之刪除外加雙引號表一點小想法--dump--ascii--to_number
q友問題
請教個問題我怎麼刪除
dsg使用者下的表名為 segm.tawces的表(我登不了dsg使用者)
只能在sys使用者下刪除
drop table dsg. segm.tawces purge 報錯
我是不是直接escape轉義即可
結論
1,正常建立表和在表名字元加雙引號,建立不同,2,不同之處於
A,不正常建立只能建立一種雙引號括起來的字元,要麼是大寫,要麼是小寫,再次建立會提示物件已存在
B,
3,可見dump的十六進位制是對真實字串以每個字元的16進位制進行儲存的,可以用ascii及to_nubmer進行檢視
SQL> select object_name,length(object_name),object_id,dump(object_name,16) from dba_objects where owner='SCOTT' and lower(object_name) like '%t_spec%';
OBJECT_NAME LENGTH(OBJECT_NAME) OBJECT_ID DUMP(OBJECT_NAME,16)
------------------------------ ------------------- ---------- --------------------------------------------------
T_SPEC 6 46418 Typ=1 Len=6: 54,5f,53,50,45,43
t_spec 6 46419 Typ=1 Len=6: 74,5f,73,70,65,63
SQL> select to_char(ascii('t'),'xxxxxxxx') from dual;
TO_CHAR(A
---------
74
SQL> select to_char(ascii('T'),'xxxxxxxx') from dual;
TO_CHAR(A
---------
54
4,也就是正常建立表是以大寫字元儲存的,而非正常建立(即在正常建立的基礎上外加比引號)它是以小寫字元儲存的,可見ORACLE並不會把外加的雙引號儲存進去,由此可見ORACLE的聰明
測試
SQL> select * from v$version where rownum=1;BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
SQL> show user
USER is "SCOTT"
SQL> create table t_spec(a int);
Table created.
SQL> select object_name,object_id,dump(object_name) from dba_objects where owner='SCOTT' and object_name like '%T_SPEC%';
OBJECT_NAME OBJECT_ID DUMP(OBJECT_NAME)
------------------------------ ---------- --------------------------------------------------
T_SPEC 46418 Typ=1 Len=6: 84,95,83,80,69,67
SQL> create table 't_spec'(a int);
create table 't_spec'(a int)
*
ERROR at line 1:
ORA-00903: invalid table name
SQL> create table "t_spec"(a int);
Table created.
SQL> select object_name,object_id,dump(object_name) from dba_objects where owner='SCOTT' and lower(object_name) like '%t_spec%';
OBJECT_NAME OBJECT_ID DUMP(OBJECT_NAME)
------------------------------ ---------- --------------------------------------------------
T_SPEC 46418 Typ=1 Len=6: 84,95,83,80,69,67
t_spec 46419 Typ=1 Len=6: 116,95,115,112,101,99
SQL> select to_char('849583806967','xxxxxxxxxxxx') from dual;
TO_CHAR('8495
-------------
c5cf2419f7
---可見小寫字元對應上述的"t_spec"
SQL> select dump('t_spec') from dual;
DUMP('T_SPEC')
-----------------------------------
Typ=96 Len=6: 116,95,115,112,101,99
---大寫字元對應上述的t_spec(即正常建立表)
SQL> select dump('T_SPEC') from dual;
DUMP('T_SPEC')
-------------------------------
Typ=96 Len=6: 84,95,83,80,69,67
SQL> drop table scott."t_spec"
2 ;
Table dropped.
SQL> select object_name,length(object_name),object_id,dump(object_name) from dba_objects where owner='SCOTT' and lower(object_name) like '%t_spec%';
OBJECT_NAME LENGTH(OBJECT_NAME) OBJECT_ID DUMP(OBJECT_NAME)
------------------------------ ------------------- ---------- --------------------------------------------------
T_SPEC 6 46418 Typ=1 Len=6: 84,95,83,80,69,67
t_spec 6 46419 Typ=1 Len=6: 116,95,115,112,101,99
SQL> conn scott/system
Connected.
SQL> create table "T_SPEC"(a int);
create table "T_SPEC"(a int)
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
--可見dump的十六進位制是對真實字串以每個字元的16進位制進行儲存的,可以用ascii及to_nubmer進行檢視
SQL> select object_name,length(object_name),object_id,dump(object_name,16) from dba_objects where owner='SCOTT' and lower(object_name) like '%t_spec%';
OBJECT_NAME LENGTH(OBJECT_NAME) OBJECT_ID DUMP(OBJECT_NAME,16)
------------------------------ ------------------- ---------- --------------------------------------------------
T_SPEC 6 46418 Typ=1 Len=6: 54,5f,53,50,45,43
t_spec 6 46419 Typ=1 Len=6: 74,5f,73,70,65,63
SQL> select to_char(ascii('t'),'xxxxxxxx') from dual;
TO_CHAR(A
---------
74
SQL> select to_char(ascii('T'),'xxxxxxxx') from dual;
TO_CHAR(A
---------
54
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-1867640/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Postgresql中DDL的雙引號問題SQL
- js中關於單引號和雙引號的一點用法JS
- 網友遇到的問題---資料被莫名的刪除
- PHP雙引號的小隱患PHP
- ORACLE 單引號 雙引號Oracle
- 臨時表空間資料刪除問題
- linux 單引號,雙引號,反引號Linux
- HTML 單引號與雙引號HTML
- mybatis大於號,小於號,去地址符,單引號,雙引號轉義說明MyBatis
- Mysql建表語句中顯示雙引號MySql
- Golang的單引號、雙引號與反引號Golang
- oracle資料庫--Oracle雙引號和單引號的區別小結Oracle資料庫
- 關於 json 單引號和雙引號區別--請使用雙引號JSON
- python中單引號,雙引號,多引號區別Python
- Linux Shell 中的反引號,單引號,雙引號Linux
- oracle 中使用單引號(')和雙引號(")Oracle
- Oracle中的 單引號 和 雙引號Oracle
- oracle 裡的單引號與雙引號Oracle
- JZ18刪除表的節點
- latex的雙引號 ``'
- 雙向連結串列————查詢、刪除、插入結點
- layer彈框刪除ztree節點非阻塞問題解決
- 【C進階】14、單引號和雙引號
- Jquery單引號和雙引號的使用注意jQuery
- SQL語句中的單引號與雙引號SQL
- LeetCode 26 號問題 刪除陣列中的重複項LeetCode陣列
- win10雙系統怎麼刪除一個 如何正確刪除雙系統之一的步驟Win10
- grep 後加單引號、雙引號和不加引號的區別
- shell 指令碼中雙引號、單引號、反引號的區別指令碼
- Python中 單引號,雙引號和三引號的區別Python
- 【原創】一對雙引號引發的goldengate血案Go
- 【Oracle】刪除大表操作一則Oracle
- 看JIVE原始碼的一點想法和疑問原始碼
- 向SQLServer插入單引號問題SQLServer
- linux bash中的引號:單雙引號、反撇號Linux
- Solr小技巧之快速刪除index的方法SolrIndex
- Oracle中單引號和雙引號的區別Oracle
- Linux Shell 單引號 雙引號 使用區別Linux