oracle 經常使用的函數

SELECT CONCAT('CG',lpad(AM_APPLY_SEQUENCE.nextval, 5, '0')) as code FROM DUAL;函數

 

concat拼接字符串spa

concat(Str1,str2)拼接str1和str2code

 

lpad函數ci

lpad( string1, padded_length, [ pad_string ] )
     其中string1是須要粘貼字符的字符串
     padded_length是返回的字符串的數量,若是這個數量比原字符串的長度要短,lpad函數將會把字符串截取成padded_length;字符串

     pad_string是個可選參數,這個字符串是要粘貼到string1的左邊,若是這個參數未寫,lpad函數將會在string1的左邊粘貼空格。
    例如:
           string

lpad('tech', 7); 將返回' tech'

lpad('tech', 2); 將返回'te'
lpad('tech', 8, '0'); 將返回'0000tech'
lpad('tech on the net', 15, 'z'); 將返回 'tech on the net'
lpad('tech on the net', 16, 'z'); 將返回 'ztech on the net'
相關文章
相關標籤/搜索