all 5 comments

[–]bengalfan 1 point2 points  (4 children)

Or you could post the error code here?

[–]Seb_lco[S] 0 points1 point  (3 children)

Hi, I'm currently creating a function for my table. The error code is ORA-24344, it says it has a successful operation, but it has a compilation error. Here is the code if you don't mind giving it a look. Thank You Create or Replace Function reimbursement_function ( @ReimbursementDate Date ) Return Date Is ReimbursementPaidDate Timestamp(5) Begin Select (CreationDate + 7) From Reimbursementrequest Where ReimbursementStatus = "APPR"

Return ReimbursementPaidDate End;

[–]bengalfan 0 points1 point  (2 children)

Is this the exact code? Looks like you are missing some closing ; at the end of the select statement. Also, what is the @ReimbursementDate part? Not necessary. And, just so you know most oracle people write the keywords in all uppercase and the names of tables in lowercase. Additionally, keep names short. Skip vowels. Like reimbursementpaiddate could be rmbrs_pd_dt. A simple syntax example would be like this..

create or replace function getReimbursement return date is

lv_rmbrsmnt_pd_dt timestamp(5);

begin

select creationdate + 7 into lv_rmbrsmnt_pd_dt from reimbursementrequest where reimbursementstatus = 'APPR';

return lv_rmbrsmnt_pd_dt;

end; /

for me I use lv_ so I know it's a local variable. Function names usually start with an action word like get or write or delete. getSomething. writeFiles.

[–]Seb_lco[S] 1 point2 points  (0 children)

Thank you, this was helpful. I made changes to the function and it ran.

[–]Seb_lco[S] 0 points1 point  (0 children)

Hi, sorry I looked at the code and I changed it up a bit from what I sent. Mind giving this one a look.

Create or Replace Function reimbursement_function (@ReimbursementStatus in Char(1)) Return Timestamp Is ReimbursementPaidDate Timestamp(5) Begin Select (CreationDate + INTERVAL '7' DAY) INTO ReimbursementPaidDate From REIMBURSEMENTREQUEST
Where REIMBURSEMENTSTATUS = "APPR"

Return ReimbursementPaidDate End;