Jump to content

perica

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About perica

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. My function does not return the date. I will publish the package body and call the function Can you tell me where the error is? My function in package body looks like this: 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 / The function is executed but does not return the data. SQL> set serveroutput on SQL> declare 2 res1 date; 3 begin 4 res1 := account_api.get_date(1); 5 end; 6 / PL/SQL procedure successfully completed.
×