【點擊:】
阿木伯 著
|
怎樣創(chuàng)建一個簡單的自定義過程并引用? |
|
- 軟件環(huán)境:
1、操作系統(tǒng):Windows 2000 Server
2、數(shù) 據(jù) 庫:Oracle 8i R2 (8.1.6) for NT 企業(yè)版
3、安裝路徑:C:\ORACLE
- 實現(xiàn)方法:
創(chuàng)建過程方法一:
SQL> set serveroutput on
SQL>
SQL> create or replace procedure test1(i in number) as
2 begin
3 dbms_output.put_line('輸入?yún)?shù)是'||to_char(i));
4 end;
5 /
過程已創(chuàng)建。
創(chuàng)建過程方法二:
SQL> create table a(a date);
表已創(chuàng)建。
SQL>
SQL> create or replace procedure test2 as
2 begin
3 insert into a values(sysdate);
4 end;
5 /
過程已創(chuàng)建。
如果出現(xiàn)錯誤,使用show error查看錯誤
運行過程方法一:
SQL> execute test1(1);
輸入?yún)?shù)是1
PL/SQL 過程已成功完成。
SQL> execute test2;
PL/SQL 過程已成功完成。
SQL> execute test2;
PL/SQL 過程已成功完成。
SQL> select to_char(a,'yyyy/mm/dd hh24:mi:ss') 時間 from a;
時間
-------------------
2001/01/05 20:33:52
2001/01/05 20:34:01
運行過程方法二:
SQL> begin
2 test1(2);
3 end;
4 /
輸入?yún)?shù)是2
PL/SQL 過程已成功完成。
SQL> begin
2 test2;
3 end;
4 /
PL/SQL 過程已成功完成。
|
【最后更新:】 |
|