472,353 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 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 102154
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...
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...
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...
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...
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...
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...
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...
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...
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.