我将发布程序包主体并调用函数
该函数正在执行,但不返回数据。
也许我的调用功能不好。
你能告诉我错误在哪里吗?
预先感谢
我在程序包主体中的功能如下:
TiXmlDocument
该函数已执行,但不返回数据。
SQL> CREATE OR REPLACE PACKAGE BODY account_api AS
2 PROCEDURE add_new_account
3 ( p_acc_id accounts.acc_id%type
4 , p_acc_name accounts.acc_name%type
5 , p_acc_amount accounts.acc_amount%type
6 , p_acc_date accounts.acc_date%type)
7 IS
8 BEGIN
9 INSERT INTO accounts(acc_id, acc_name, acc_amount, acc_date)
10 VALUES (p_acc_id, p_acc_name, p_acc_amount, p_acc_date);
11 COMMIT;
12 EXCEPTION
13 WHEN OTHERS THEN
14 ROLLBACK;
15 RAISE;
16 END;
17 PROCEDURE upd_account
18 (p_acc_id accounts.acc_id%type
19 , p_acc_name accounts.acc_name%type
20 , p_acc_amount accounts.acc_amount%type
21 , p_acc_date accounts.acc_date%type
22 )
23 IS
24 BEGIN
25 UPDATE accounts
26 set acc_name = p_acc_name
27 , acc_amount = p_acc_amount
28 , acc_date = p_acc_date
29 WHERE acc_id = p_acc_id;
30 COMMIT;
31 END;
32 PROCEDURE del_accounts
33 (p_acc_id accounts.acc_id%type)
34 IS
35 BEGIN
36 DELETE FROM accounts WHERE acc_id = p_acc_id;
37 COMMIT;
38 EXCEPTION
39 WHEN OTHERS THEN
40 ROLLBACK;
41 RAISE;
42 END;
43 FUNCTION get_amount
44 (p_acc_id accounts.acc_id%type)
45 return Number is res number;
46 begin
47 select acc_amount into res
48 from accounts where acc_id =p_acc_id;
49 return res;
50 end;
51 FUNCTION get_date
52 (p_acc_id accounts.acc_id%type)
53 RETURN date IS res1 date;
54 BEGIN
55 SELECT acc_date INTO res1
56 FROM accounts WHERE acc_id = p_acc_id;
57 RETURN res1;
58 end;
59 end account_api;
60 /
答案 0 :(得分:0)
尝试通过打印检查日期。它将显示输出。
set serveroutput on
declare
res1 date;
begin
res1 := account_api.get_date(1);
dbms_output.put_line(res1);
end;
/