Home » SQL & PL/SQL » Client Tools » usage of Package in 10g Form (Form 10g, Database 10.2)
usage of Package in 10g Form [message #579841] Sat, 16 March 2013 00:43 Go to next message
skamransajjad
Messages: 42
Registered: December 2008
Location: Pakistan
Member

Dear All;

I have made a package and define a variable in it as:
CREATE OR REPLACE package Scott.My_Pac as
CNT_UPD_USR Varchar2(20)
END My_Pac;

When I used the following in Toad it works fine but when I use the same in 10g form it gives the error "Cannot directly access remote package variable or cursor" Please guide.

Begin
Scott.My_Pac.CNT_UPD_USR := 'Ali';
DBMS_OUTPUT.PUT_LINE(Scott.My_Pac.CNT_UPD_USR);
End;
Re: usage of Package in 10g Form [message #579843 is a reply to message #579841] Sat, 16 March 2013 01:15 Go to previous messageGo to next message
Littlefoot
Messages: 19653
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Create a stored procedure which will set the package variable; then call that procedure from a form.
Re: usage of Package in 10g Form [message #579844 is a reply to message #579843] Sat, 16 March 2013 01:22 Go to previous messageGo to next message
skamransajjad
Messages: 42
Registered: December 2008
Location: Pakistan
Member

@Littlefoot; Thanks for the reply. Can you please share an example..
Re: usage of Package in 10g Form [message #579846 is a reply to message #579844] Sat, 16 March 2013 01:24 Go to previous messageGo to next message
Littlefoot
Messages: 19653
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
A procedure:
create or replace procedure p_set_pkg_var (par_usr in varchar2) is
begin
  Scott.My_Pac.CNT_UPD_USR := par_usr;
end;

A form trigger:
p_set_pkg_var(:some_block.some_item);

Re: usage of Package in 10g Form [message #579848 is a reply to message #579846] Sat, 16 March 2013 01:28 Go to previous messageGo to next message
skamransajjad
Messages: 42
Registered: December 2008
Location: Pakistan
Member

Smile Thanks.

And same step is to get the value. am i right?

create or replace Function p_get_pkg_var() return varchar2 is
begin
Return Scott.My_Pac.CNT_UPD_USR;
end;

variable := p_get_pkg_var;

Re: usage of Package in 10g Form [message #579856 is a reply to message #579848] Sat, 16 March 2013 01:53 Go to previous messageGo to next message
Littlefoot
Messages: 19653
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
am i right?

Your best option is to try it; then you'll know for sure.
Re: usage of Package in 10g Form [message #579857 is a reply to message #579856] Sat, 16 March 2013 01:55 Go to previous message
skamransajjad
Messages: 42
Registered: December 2008
Location: Pakistan
Member

Thanks a lot for being source of information for me.
Previous Topic: Comparison of Toad and Oracle enterprise manager
Next Topic: ORA-06502 in SQL*Plus, not in Toad
Goto Forum:
  


Current Time: Thu Oct 02 06:52:52 CDT 2014

Total time taken to generate the page: 0.24737 seconds