Home » Developer & Programmer » Forms » when-button-pressed problem (Oracle 10gR2, Windows XP)
when-button-pressed problem [message #407792] Thu, 11 June 2009 11:50 Go to next message
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 #407794 is a reply to message #407792] Thu, 11 June 2009 12:00 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Check this.

By
Vamsi
Re: when-button-pressed problem [message #407796 is a reply to message #407794] Thu, 11 June 2009 12:04 Go to previous messageGo to next message
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 #407799 is a reply to message #407796] Thu, 11 June 2009 12:12 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Quote:
my function contains DML?
No.
Post you exact code in the trigger and error.

By
Vamsi
Re: when-button-pressed problem [message #407809 is a reply to message #407799] Thu, 11 June 2009 12:53 Go to previous messageGo to next message
Roger22
Messages: 98
Registered: April 2009
Location: Brasov, ROMANIA
Member
it worked with

ani_vechime:=pachet_salarizare.ani_vechime(data_min, to_number(to_char(sysdate,'YYYY')), to_number(to_char(sysdate,'MM')));


Regards,
Re: when-button-pressed problem [message #407914 is a reply to message #407792] Fri, 12 June 2009 05:59 Go to previous message
cookiemonster
Messages: 12410
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.
Previous Topic: i want to decrypt image value
Next Topic: How to write condition in Duplicate record
Goto Forum:
  


Current Time: Wed Dec 07 04:42:43 CST 2016

Total time taken to generate the page: 0.10270 seconds