sequence 和索引函式呼叫

generators發表於2009-12-10

-------------------------------------------
重新編譯索引
alter index index_name rebuild;

drop sequence sys_tempid

create sequence sys_tempid minvalue 1 maxvalue 999999999999999999 start with 1 increment by 1 cache 20;
--------------------------'fm去空格-----
SQL> select TO_CHAR(card_id.nextval,'00000000') from dual;

TO_CHAR(CARD_ID.NEXTVAL,'00000
------------------------------
00001424
---多出一個空格
SQL> select TO_CHAR(card_id.nextval,'fm00000000') from dual;

TO_CHAR(CARD_ID.NEXTVAL,'FM000
------------------------------
00001425
OK!
如果不指名格式,oracle會自動補充0或者空白把輸出變成固定寬度的模式
fm字首用來去除首尾的空字元或0

----包函式呼叫
SQL> declare boo boolean;
2 begin
3 boo:=pack_common.func_callback_card('01',336,'','','6');
4 end;
5 /

PL/SQL procedure successfully completed

----過程呼叫
SQL> exec call_func;

PL/SQL procedure successfully completed

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9307930/viewspace-1029588/,如需轉載,請註明出處,否則將追究法律責任。

相關文章