when-button-pressed problem [message #407792] |
Thu, 11 June 2009 11:50 |
Roger22
Messages: 98 Registered: April 2009 Location: Brasov, ROMANIA
|
Member |
|
|
Hello,
i have in when-button-pressed a line containing
select pachet_salarizare.ani_vechime(data_min, to_number(to_char(sysdate,'YYYY')), to_number(to_char(sysdate,'MM'))) into ani_vechime from dual;
so i call a function which is in pachet_salarizare package (package created in program units, in Forms).
when compiling, i get: function 'PACHET_SALARIZARE.ANI_VECHIME' mai not be user in SQL.
how can i deal with this? i need the result of that function in a variabie, ani_vechime.
Thanks!
|
|
|
|
Re: when-button-pressed problem [message #407796 is a reply to message #407794] |
Thu, 11 June 2009 12:04 |
Roger22
Messages: 98 Registered: April 2009 Location: Brasov, ROMANIA
|
Member |
|
|
ok, thanks for reply
but:
1. i'm with dba role, so i have all privileges and roles
2. that function and package also exists in database, i created them in Forms (Program Units) too
3. When used in SELECT statement they cannot contain DML : my function contains DML?
or what's wrong in my code? i really don't know why happens this to me..
function ani-vechime is:
PACKAGE BODY pachet_salarizare IS
function ani_vechime (datasv angajat_functie.data_start%type, an IN salarii.an%type, luna salarii.luna%type) return transe_sv.ani_limita_inf%type
AS
prima_zi DATE:=to_date('01-'||luna||'-'||an,'dd-mm-yyyy');
begin
return trunc(months_between(prima_zi, datasv)/12,0);
end ani_vechime;
end pachet_salarizare;
Thanks
[Updated on: Thu, 11 June 2009 12:07] Report message to a moderator
|
|
|
|
|
Re: when-button-pressed problem [message #407914 is a reply to message #407792] |
Fri, 12 June 2009 05:59 |
cookiemonster
Messages: 13960 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You should never have a package in both forms and the db. Use one or the other.
Packages in forms can not be used in SQL.
If the package exists in both the one in the form will be used.
So delete it from the form.
That said this function didn't need to be called from SQL in the first place and your new code is fine.
I'd still get rid of the duplicte package though.
|
|
|