強制擷取序列下一個值/當前值(oracle函數),oracle函數

來源:互聯網
上載者:User

強制擷取序列下一個值/當前值(oracle函數),oracle函數

原文連結——http://blog.csdn.net/qq525099302/article/details/47146393
為什麼要使用函數來擷取序列值請看這裡

-- 建立擷取序列下一個值的函數create or replace function get_seq_next (seq_name in varchar2) return numberis  seq_val number ;begin  execute immediate 'select '|| seq_name|| '.nextval from dual' into seq_val ;  return seq_val ;end get_seq_next;-- 建立擷取序列下一個值的函數(得先擷取下一個值後才能使用)create or replace function get_seq_curr (seq_name in varchar2) return numberis  seq_val number ;begin  execute immediate 'select '|| seq_name|| '.currval from dual' into seq_val ;  return seq_val ;end get_seq_curr;

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.