473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to execute package

Dear all,

1)
I have created package ref test for declaring ref cursor as shown .....
create or replace package ref_test as
type empty is ref cursor;
end;


2)
created package ref_use and used the reference of that ref cursor .....

create or replace package ref_use as
procedure ref_pro (p_empno number,P_result out ref_test.empty);
end;


3)
created package body as shown


create or replace package body ref_use as
procedure ref_pro (p_empno number,P_result out ref_test.empty) as
begin
open P_result for select ename,sal,deptno from emp where empno=p_empno;
end;
end;
/


now i want to execute this package in SQL(+) .could u plz send me the execution code of
this package
Jun 18 '07 #1
6 102431
debasisdas
8,127 Expert 4TB
to execute any member of the package, it must be qualified by the package name

if package is PACK1

PROCEDURE NAME IS PROC1(PI,P2,....)

to execute

SQL> PACK1.PROC1(PI,P2,....)
Jun 18 '07 #2
Thanks for the answer ... But cud u plz tell me how to execute the given package ....I created Ref cusor type inside the package...
How to open that ref cursor inside the calling procedure ......
plz help
Jun 18 '07 #3
debasisdas
8,127 Expert 4TB
Once a ref cursor is declared with a package specification means it has global scope .

ans since your procedure inside the package has an OUT parameter it can't be executed from SQL pronpt.

For that u need to write an anonymous block.
Jun 18 '07 #4
That anonymous block i want ..cud u plz send it for given package .
Jun 18 '07 #5
You can view the result in the cursor as follows in sql prompt.

VARIABLE io_cursor refcursor;
Execute package_name.procedure_name(:io_cursor);
print io_cursor;

(hope this will be useful for others because you must be an expert by now.)
Feb 26 '09 #6
amitpatel66
2,367 Expert 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. DECLARE
  3. ref_cur SYS_REFCURSOR;
  4. e_name VARCHAR2(100);
  5. salary NUMBER;
  6. dept_no NUMBER:
  7. BEGIN
  8. ref_use.ref_pro (20,ref_cur);
  9. LOOP
  10. EXIT WHEN ref_cur%NOTFOUND;
  11. FETCH ref_cur INTO e_name,salary,dept_no;
  12. DBMS_OUTPUT.PUT_LINE(e_name||','||salary||','||dept_no);
  13. END LOOP;
  14. END;
  15.  
Feb 26 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rich Tasker | last post by:
My goal is to execute a DTS package that calls multiple child DTS packages from a C# (2003) app and display the progress of the entire process to the user. I have followed the model defined in...
4
by: chris.dunigan | last post by:
I'm looking for an example of how to execute an existing DTS­ package from an ASP (VB)script and would appreciate any and all response. ­I don't even know if it's possible Thanks - Chuck...
1
by: serge | last post by:
When I start creating a new DTS Package and I choose the Analysis Processing Task icon, I only have the option of working with the local Microsoft Analysis Server. How can I choose a remote...
0
by: CodeRazor | last post by:
How can I execute a DTS package from an asp.net page? I found the code below online, and altough it throws no errors, it doesnt execute the dts package either? What am i missing? ...
1
by: Dean R. Henderson | last post by:
I have a Windows library that I bind into a Windows Form application and into an ASP.NET Web Application. I have a procedure in the library that executes a DTS Package. I have also used...
3
by: Peter Afonin | last post by:
Hello, Our SQL server used to run under System account, and I had no problems executing DTS packages from the ASP.NET: Dim oPkg As DTS.Package oPkg = CreateObject("DTS.Package")...
2
by: juventusaurabh | last post by:
Hi all, I'm a rookie and would like to know how do I use the DTS package in my C# code. I actually want to input a pipe-delimited text file and convert it into SQL tables and also validate the...
1
by: juventusaurabh | last post by:
Hi, Has anyone managed executing a DTS package in SQL Server 2000 from a windows form created using c#? Also, I specify the path of the new file everytime through this windows form. Please...
1
by: Al-Pacino | last post by:
Hello All, I am am having a strange problem. I am trying to execute a DTS package from VB .NET (.aspx) page. The DTS package takes 21 minutes to execute. When the aspx page sends a command to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.