How to execute private procedures in a package
Hi
I have created private procedures in a package.
now i want to execute the private procedure. how to execute the private one
Hi;
Pelase see below which could be helpful for your issue:
Private procedures in a package
http://stackoverflow.com/questions/924490/how-do-i-execute-private-procedures-in-an-oracle-package
Regard
Helios
Similar Messages
-
How to execute the procedure in sap b1
Hai to all,
I done a procedure in sql server .but i don't know how to execute that procedure in sap b1?
can anyone help me immediately.
Regards,
Ramya.SDear Ramya.S,
You could execute the store procedure by using Recordset object in SDK DI code. It is like:
Dim myRecordSet As SAPbobsCOM.Recordset
myRecordSet =
SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecord
set)
myRecordSet.Command.Name = "TestStoredProcedure"
myRecordSet.Command.Parameters.Item("@ItemLike").Value = "IT%"
myRecordSet.Command.Parameters.Item(2).Value = "C0001"
myRecordSet.Command.Execute() -
How to execute external exe in SSIS Package
Hi,
I wanted to know how to execute external exe from SSIS Package can any one explain me or provide me valuable links.
Regards ,
AjayThere are few things you need to take care before executing exe from SSIS
1. The arguments etc expected by exe should be clearly defined inside execute process task
2. The Path where exe exists should be accessible to the account executing the package. SO you should grant account required permissions
3. If executing from a job make sure you either define a proxy account with required permissions and configure it to run the job or give service account all access required for executing exe
see
http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Private procedures in a package
Can anybody give me the syntax for declaring a private procedure in a package
Hi,
did you know what is private procedure for any package.
The private procedure is that procedure you didn't specify in your package specification you can directly write in package body and call then with in any procedure with have declare in package specification.
I am giving you a very simple example:=
create or replace package p1 is
procedure pro1;
end p1;//package specification
create or replace package body p1 is //package body
procedure pro1 is
begin
dbms_output.put_line('test');
test_pro1;//private procedure call
end pro1;
procedure test_pro1 is
begin
dbms_output.put_line('private procedure');
end test_pro1;//private procedure
end p1;
Regards,
Kamod -
How to import only procedures, functions, and packages only
Hi everybody...
How to import only procedures, functions, and packages only from one user to another user.
Thanks in advance
palThanks for your reply...i did the following..can you please help from this how to proceed
---------------- getcode.sql -------------------------------
set feedback off
set heading off
set termout off
set linesize 1000
set trimspool on
set verify off
spool &1..sql
prompt set define off
select decode( type||'-'||to_char(line,'fm99999'),
'PACKAGE BODY-1', '/'||chr(10),
null) ||
decode(line,1,'create or replace ', '' ) ||
text text
from user_source
where name = upper('&&1')
order by type, line;
prompt /
prompt set define on
spool off
set feedback on
set heading on
set termout on
set linesize 100
------------------- getallcode.sql -------------------------
set termout off
set heading off
set feedback off
set linesize 50
spool c:\xtmpx.sql
select '@getcode ' || object_name
from user_objects
where object_type in ( 'PROCEDURE', 'FUNCTION', 'PACKAGE' )
spool off
spool c:\getallcode_INSTALL
select '@' || object_name
from user_objects
where object_type in ( 'PROCEDURE', 'FUNCTION', 'PACKAGE' )
spool off
set heading on
set feedback on
set linesize 130
set termout on
@xtmpx.sql
I did this one user and created the xtmpx.sql
and getallcode_INSTALL.LST.
From this, how to proceed to run these in another user.
Thanks,
Pal -
How to execute a procedure depending on the result of a query?
Hello, I'm new in ODI.
I want to execute a procedure depending on the result of a query Oracle table.
We have a Oracle Table whit a column that contains two possibles values.
I want read the table, row by row, and depending on this value, execute a Procedure or execute another.
How can i do?what you need to do is
1. create a variable which "new_var2" which has the count of the number of rows you want to process. must be data type numeric.
2. copy "new_var2" to the package screen.
3. duplicate the "new_var2" on the package screen and evaluate the variable and test for "> 0" zero, call it "new_var2_E"
3. create a new odi variable "new_var1" with a refresh of "select field1 fom (select field1,rownum as rownumber from tablex) where rownumber = #new_var2" in the relevant schema and technology.
4. copy "new_var1" into your package (some where in the flow)
5. right click the "new_var1" variable in you package screen and you should get the option duplicate step (click on that)
6. select the the duplicate "new_var1" on the package screen and correct the the name to something meaning full to you "new_var1_E", also change the "type" to "evaluate variable" then you should see a "value" box. enter one of the values you want to test in the box (remember do not put in quotes ' )
7. now back on the package screen join the "new_var1" to the "new_var1_E" with an OK line
8 you now join "new_var2" to "new_var2_E" with OK
9 you join "new_var2_E" to "new_var1"
10. you then join the "new_var1_E" with an OK or a KO line to the relevant procedure.
12. you need to duplicate "new_var2" in the package screen one more time this time and call it "new_var2_D" set the type to evaluate and then select the increment of -1
13. the relevant procedure to "new_var2_D" with an OK
14. join the "new_var2_D" to the "new_var2_E" with an OK
15. this should close off the loop now the exit point is "new_var2_E" with a KO line to the next part of your process....
Basically you should end up with a loop on new_var2 decementing, and it is used to get a specific next record row from your table.
Hope this helps, sorry it is a little long winded..
Edited by: DavidGD on Feb 8, 2009 3:29 PM -
Executing A Procedure In a Package Using DBLink
I need to execute a procedure which is residing in a package using dblink.
The package got a execute PUBLIC grant.
When I execute the following statement, I am getting error ORA: 00904, Invalid Identifier
select PKG_NAME.PROCEDURE_NAME@dblink(null,null,null,null,null,null,null,null,null,null,null) from dual
How can I execute the above statement.
Thanks in advanceI have a database INLABNEW in that i have done this
SQL> create table temp(no number)
2 /
Table created.
SQL> create or replace package pkg
2 as
3 procedure p;
4 end;
5 /
Package created.
SQL> create or replace package body pkg
2 as
3 procedure p
4 is
5 begin
6 insert into temp values(1);
7 end;
8 end;
9 /
Package body created.
SQL> select * from temp
2 /
no rows selectedNow i executed the procedure pkg.p from another database
SQL> exec pkg.p@to_inlabnew
PL/SQL procedure successfully completed.
SQL> commit
2 /And i query the table tmp in INLABNEW
SQL> select * from temp
2 /
NO
1Now question is have you given your procedure name properly.
as your procedure is in a package it should be Your_package_name.Your_procedure_name@Your_db_link -
How to execute a procedure if out parameter is table type
Hi,
I need to execute a procedure, output parameter of the procedure is table type.
Oracle version I am using is 9.2.0.8 . I am using SQL*Plus
Procedure declaration
PROCEDURE current_open_cycle (p_ban IN repl_cust2.billing_account.ban%TYPE,
v_bill_seq_rec OUT bill_seq_table) ;
Table type declaration
TYPE bill_seq_table IS
TABLE OF bill_seq_rectype INDEX BY BINARY_INTEGER ;
TYPE bill_seq_rectype IS RECORD (v_cycle_run_year repl_cust2.bill.cycle_run_year%TYPE,
v_cycle_run_month repl_cust2.bill.cycle_run_month%TYPE,
v_cycle_code repl_cust2.bill.cycle_code%TYPE,
v_open_cycle BOOLEAN, -- An open cycle
v_billed_cycle BOOLEAN, --
v_invoice_number VARCHAR2(13),
v_start_date DATE,
v_end_date DATE,
v_root_ban repl_cust2.bill.root_ban%TYPE) ;
I tried executing using this script, but it failed. When I execute this oracle lost connection to data base.
declare
r_bill_seq_rec ss_invoice_utilities.bill_seq_table;
begin
ss_invoice_utilities.current_open_cycle(934018003,r_bill_seq_rec);
end;
Please help me how I should write declare block to execute this procedure and also print output of the procedure.
Regards
RaghuI don't see anything wrong with the anonymous block, assuming ss_invoice_utilities is the correct package name. Perhaps a simplified test case would show up what's not working there.
As for printing the contents of an associative array, you'll have to write some code to loop through it and construct a string per row to output via dbms_output, assuming the text will fit within dbms_output's size restrictions in 9i. dbms_output is a debugging tool though - is that the requirement?
btw "pls_integer" is less to type than "binary_integer" ;)
Edited by: William Robertson on Apr 16, 2009 8:35 AM -
Execute all procedures in a package
Pls tell me how to execute all the functions and procedures in a Package in a single shot or is there any coding for the same
Please help me
Thanks in advanceYou would need to have a procedure or function in the package that ran all of the others. Given a package like:
CREATE PACKAGE p AS
FUNCTION f1 RETURN NUMBER;
FUNCTION f2 RETURN NUMBER;
PROCEDURE p1;
PROCEDURE p2;
PROCEDURE RUN_ALL;
END;
CREATE PACKAGE BODY p AS
FUNCTION f1 RETURN NUMBER IS
BEGIN
RETURN 1;
END; -- f1
FUNCTION f2 RETURN NUMBER IS
BEGIN
RETURN 2;
END; -- f2
PROCEDURE p1 IS
BEGIN
NULL;
END; -- p1
PROCEDURE p2 IS
BEGIN
NULL;
END; -- p2
PROCEDURE RUN_ALL IS
l_f1 NUMBER;
l_f2 NUMBER;
BEGIN
l_f1 := f1();
l_f2 := f2();
p1;
p2;
END; -- run_all
END; -- package bodyThen you would run all the procedures and functions by calling
p.run_all;If you will never wnat to run the other procedures and function individually, then you could define the package spec as:
CREATE PACKAGE p AS
PROCEDURE RUN_ALL;
END;HTH
John -
How to execute stored procedure that returns a cursor?
How to execute a stored procedure that returns a cursor?
Follow the code:
CREATE OR REPLACE PROCEDURE stp_cashin_grupo
(p_func IN VARCHAR
,p_cod_grup IN Integer
,p_des_grup IN VARCHAR
,p_logi IN VARCHAR
,p_curs_rset OUT infoc.pck_cashin_grupo.curs_rset
IS
BEGIN
if p_func = '1' then
OPEN p_curs_rset FOR
select
cod_grup
,des_grup
,dat_manu_grup
,des_logi_manu
from infoc.tbl_cashin_grupo
order by des_grup;
end if;
END stp_cashin_grupo;
and the package:
CREATE OR REPLACE PACKAGE pck_cashin_grupo
AS
TYPE curs_rset IS REF CURSOR;
END pck_cashin_grupo;
My question is how to execute in sql plus?
EXEC stp_cashin_grupo('1',0,'','465990', my doubt is how to pass the cursor as return
Thanksmy doubt is how to pass the cursor as returnExample :
TEST@db102 > var c1 refcursor;
TEST@db102 > create or replace procedure ref1 (
2 v1 in varchar2,
3 cur1 out sys_refcursor)
4 is
5 begin
6 open cur1 for 'select * from '||v1;
7 end;
8 /
Procedure created.
TEST@db102 > exec ref1('dept',:c1);
PL/SQL procedure successfully completed.
TEST@db102 > print c1
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
TEST@db102 > -
How to Execute the procedure?
Hi,
How to execute a below procedure with refcursor output parameter,
in that procedure refcursor declare in package
create or replace PROCEDURE prc_sam(
P_LIST OUT pkg_sam.REF_CURSOR_TYPE) IS
BEGIN
OPEN P_LIST FOR
SELECT 1+1 FROM dual;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20001,SQLERRM);
END prc_sam;
Regards,
FameSQL> create or replace PROCEDURE prc_sam(
2 P_LIST OUT SYS_REFCURSOR) IS
3 BEGIN
4
5 OPEN P_LIST FOR
6 SELECT 1+1 FROM dual;
7 EXCEPTION
8 WHEN OTHERS THEN
9 RAISE_APPLICATION_ERROR(-20001,SQLERRM);
10 END prc_sam;
11 /
Procedure created.
SQL> VARIABLE P_CURSOR REFCURSOR;
SQL> EXEC prc_sam(:P_CURSOR);
PL/SQL procedure successfully completed.
SQL> PRINT P_CURSOR;
1+1
2
Intead of SYS_REFCURSOR, you can use ur pkg_sam.REF_CURSOR_TYPE inside a package
AND
execute a procedure like EXEC pkg_sam.prc_sam(:P_CURSOR);
like this, then you will get the result............................
Thanks,
Ann -
Result of Executing a Procedure in a Package to check if a file exists
Hi,
I have a procedure where i want to check if a name exists in my Oracle Table , for exemple , select name from my_files_processed , if the statement give a result , escape a step and go back to the previous step in the package , if the file doesn't exist in my table go to the next step in my package.
Any issue on how to do this ??
Best RegardsFirst remove the horrible exception handler(s) which are hiding all errors;
ie the
when others
then
null;
end;Then remember the main syntax is
begin
packagename.procedurename;
end;
/But also remember that procedure name must be declared in the package header if you want to call it. (This is called a public procedure). A private procedure does not have to be declared in the package header and can only be called from within the same package body.
I always use sqlplus for verification as that is delivered with oracle. You know if it works with sqlplus it will work with any othere client and if it does not, it's usually a client issue.
from what you have posted, There is nothing obvious as to why it won't work. -
How to execute stored procedure in sqlplus
i have procedure something like this
create or replace "gettimeslots"
v_acc in varchar,
slot_cursor in out sys_refcursor
as
begin
open slot_cursor for
select * from tslots where tid=v_acc;
end
how to execute this proc in sqlplus?please help in this regardAs you perfectly know (since you're a member for more than a year now) you could have looked that up via google or the forum search. Just one link for you:
SQLPLUS in Morgan's Library! -
Can you tell me how to execute the procedure?
create or replace get_dob
(ss_number varchar2,dob out date)
as
begin
select birth_dae
into dob
from person
where soc_sec_num=ss_num;
exception when no_data_found
error_notify(ss_num);
end;
the question is that when i want to execute this procedure,how can I use the command?
I try to use the "execute get_dob('wang');"in the sql/plus,but the system give me wrong information.Errors:
1. You left out the word PROCEDURE after CREATE OR REPLACE.
2. You used ss_number in one place and ss_num in two others. These must be the same name.
3. You left out the word THEN after WHEN NO_DATA_FOUND.
Possible errors:
1. Is birth_dae spelled correctly? Or, should it be birth_date?
2. Is error_notify a user-defined procedure?
Additional suggestions:
1. It is better to use table_name.column_name%TYPE instead of specifying NUMBER, VARCHAR2, DATE, etc. for your parameters. That way if the column data types are changed in the future, you don't have to change your code.
2. You will need to SET SERVEROUTPUT ON and use DBMS_OUTPUT.PUT_LINE to display the contents of the variable that holds the value of the out parameter.
3. Please see suggested code for creation of procedure and execution of procedure below. I have included one row of test data so that some output will be displayed. I commented out the exception section, in order to test it, since I don't have your error_notify procedure.
SQL> -- test data:
SQL> CREATE TABLE person
2 (birth_dae DATE,
3 soc_sec_num NUMBER)
4 /
Table created.
SQL> INSERT INTO person
2 VALUES (SYSDATE, '123456789')
3 /
1 row created.
SQL> SELECT * FROM person
2 /
BIRTH_DAE SOC_SEC_NUM
06-DEC-02 123456789
SQL>
SQL>
SQL> -- create procedure:
SQL> CREATE OR REPLACE PROCEDURE get_dob
2 (ss_number IN person.soc_sec_num%TYPE,
3 dob OUT person.birth_dae%TYPE)
4 AS
5 BEGIN
6 SELECT birth_dae
7 INTO dob
8 FROM person
9 WHERE soc_sec_num = ss_number;
10 -- EXCEPTION
11 -- WHEN NO_DATA_FOUND THEN
12 -- error_notify (ss_number);
13 END get_dob;
14 /
Procedure created.
SQL> SHOW ERRORS
No errors.
SQL>
SQL>
SQL> -- execute procedure:
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 v_dob DATE;
3 BEGIN
4 get_dob ('123456789', v_dob);
5 DBMS_OUTPUT.PUT_LINE (v_dob);
6 END;
7 /
06-DEC-02
PL/SQL procedure successfully completed. -
How to Execute Remote procedures that use DBLinks?
Using Oracle 10g (RAC Linux) to remote connect Windows 10g to dblink to AS/400 <
<I have created a procedure that I execute remotely by issuing the following:
CALL GLOBAL.REFRESH_STAGING@KRONOSLINK();
The procedure errors as
Error at line 2
ORA-20001: ERROR OCCURED
ORA-06512: at "GLOBAL.REFRESH_STAGING", line 47
ORA-06512: at line 1
The procedure runs without error from the host database. The problem is when the procedure makes a call to the dblink.
I unsuccessfully attempted to capture the error message.
Question: Is it possible to execute remote procedures that use dblinks? If so, How is that accomplished.
Question: What is the proper way to handle exceptions in this case?
Bonus: What can be done to improve this procedure? (Suggestions, like adding return on the procedure).
CREATE OR REPLACE PROCEDURE GLOBAL.REFRESH_STAGING IS
NOOBJECT EXCEPTION;
OBJECTEXIST EXCEPTION;
PRAGMA EXCEPTION_INIT(NOOBJECT, -00942); -- Exception handling for ORA-00942 - table or view does not exist
PRAGMA EXCEPTION_INIT(OBJECTEXIST, -00955); -- Exception handling for ORA-009555 - name is already used by an existing object
sT LONG := '';
sS LONG := '';
sST LONG := '';
cursor csrO is
SELECT
SCHEMANAME,
TABLENAME
FROM GLOBAL.STAGING_TABLES;
csrR csrO%ROWTYPE;
BEGIN
FOR csrR IN csrO
LOOP
sT := csrR.TABLENAME;
sS := csrR.SCHEMANAME;
sST := sS || '.' || sT;
BEGIN
EXECUTE IMMEDIATE 'drop table global.' || sT || ' purge';
EXCEPTION
WHEN NOOBJECT THEN
NULL;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
END;
BEGIN
EXECUTE IMMEDIATE 'create table global.' || sT || ' nologging as select * from ' || sST || '@thebosslink';
COMMIT;
EXCEPTION
WHEN OBJECTEXIST THEN
NULL;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
DBMS_OUTPUT.PUT_LINE(SQLCODE || ' - ' || SQLERRM);
RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
END;
END LOOP;
END REFRESH_STAGING;
Thanks,
blevelsSET LINESIZE 500;
COLUMN DB_LINK FORMAT a20
COLUMN HOST FORMAT a20
COLUMN USERNAME FORMAT a20
COLUMN OWNER FORMAT a10
COLUMN TABLE_NAME FORMAT a20
select db_link,username, host from all_db_links where db_link = 'KRONOSLINK';
select privilege from dba_sys_privs where grantee = 'SYSTEM';
select owner, table_name from dba_tab_privs where grantee='SYSTEM';
DBLINK_ USERNAME HOST
KRONOSLINK SYSTEM ORCL
1 row selected.
PRIVILEGE
GLOBAL QUERY REWRITE
CREATE MATERIALIZED VIEW
CREATE TABLE
UNLIMITED TABLESPACE
SELECT ANY TABLE
5 rows selected.
OWNER TABLENAME_
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS DBMS_ALERT
SYS DBMS_SYS_ERROR
SYS DBMS_RULE_EXIMP
SYS DBMS_AQ
SYS DBMS_AQADM
SYS DBMS_AQ_IMPORT_INTER
NAL
SYS DBMS_AQELM
SYS DBMS_TRANSFORM_EXIMP
SYS SYS_GROUP
SYS DBMS_DEFER_IMPORT_IN
TERNAL
SYS DBMS_REPCAT
WMSYS WM$UDTRIG_INFO
SYS SET_TABLESPACE
SYS CHECK_UPGRADE
SYS AVINASH
SYS AVINASH
SYS AVINASH1
SYS AVINASH1
SYS DB_PMP
SYS DB_PMP
SYS DIR_TESTCASE
SYS DIR_TESTCASE
SYS EXPORT_FULL_DIR
SYS EXPORT_FULL_DIR
SYS PUMP
SYS PUMP
SYS LOGS
SYS LOGS
SYS DPUMP_DIR2
SYS DPUMP_DIR2
SYS AVIS
SYS AVIS
SYS DPDIR_LCLLGS
SYS DPDIR_LCLLGS
67 rows selected.
Edited by: user10860953 on Jan 28, 2010 10:43 AM
Maybe you are looking for
-
Adobe Muse page is shifting to the left
Hello, I love Adobe Muse and have been using it for some time now. I HAVE had this problem before but it was due to elements being placed outside of the page area, so of course I investigated that first. Unfortunately, I'm still having that problem a
-
Property Lists: How to insert a variable as a property?
Hi. I am trying to insert a variable in place of a newly defined property to be added to a poroperty list. This would normally add a new a new property to a poroperty list : Database [#needtogetvariablehere] = typedPassword -- 'Database' is the prope
-
hi gurus, i would like to know why we go for generic as we have lo with predefined data sources even if we want to add fields also we can populate them by cusomer exit then what is the necessity for generic extraction. thanks in advance. What is SID
-
Suddenly video in Premiere Pro CS 4.0.0 for Mac won't play back from source window, program window, or timeline, except for an occasional playback of < 1 second. Scarily this was described by a bunch of users in a thread started two years ago. Only o
-
Java.lang.NoSuchMethodError: getSocket using JavaMail inside JBoss
Hi, i built a library to easily send emails with JavaMail, via SMTP. When i use my lib in a stand-alone java application, it works fine, but when i need to use it inside my web application, deployed on JBoss AS, i get the following error: Servlet.ser