SQL*PLUS操作應用
VARIABLE: Define sql*plus bind variable。
Note: 變數只能被用於PL/SQL Block中,且使用定義的變數,須加前置":"。
PRINT: Print out sql*plus bind variable

定義變數可用的資料類別:
NUMBBER
CHAR, CHAR(n): n = 1~255
VARCHAR2(n): n = 1~2000
REFCURSOR: Is a reference PL/SQL Cursor variable.

Sample:
$ sqlplus youruser/yourpass@yourdb;
SQL> var ss number
SQL> var aa varchar2(10)
SQL> var bb varchar2(10)
SQL> BEGIN (進入 anonymous PL/SQL Block)
2 :aa := 'Test';
3 :bb := '20110101';
4 :ss := pk_seq_pool.getSeqNo(:aa, :bb);
5 END ;
6 /

PL/SQL procedure successfully completed.
SQL> PRINT (顯示出在sqlplus定義變數內容,也可設定set autoprint on,這樣procedure執行完後會自動顯示內容)
SS
----------
1

BB
--------------------------------
20110101

AA
--------------------------------
Test

SQL> quit;
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production

arrow
arrow
    文章標籤
    Oracle 資料庫 SQL*PLUS
    全站熱搜

    mark528 發表在 痞客邦 留言(0) 人氣()