Procedures/functions inside a package
Hi
Is there any database table when you can see the procedures/functions ids for each package? I mean a table similar to dba_objects
thanks
Did you try
SQL> desc <package name>
Similar Messages
-
How to find out list of procedures and functions inside a package
How I can find out the list of Procedures and Functions inside a Package.
Look at ALL_PROCEDURES and ALL_ARGUMENTS.
-
Call a function inside a package from a stored procedure
Hello:
I am kind of new to the stored procedure. Does anyone know how to call a function inside a package from another stored procedure?
I have a existing function (func_b) inside a package (pack_a) and it returns a cursor. I want to call this function from a stored procedure (proc_c) so that I use the data inside the cursor.
can I do the following in proc_c:
my_cursor1 SYS_REFCURSOR;
begin
my_cursor1 := exec pack_a.func_b
end
It will be very helpful if anyone can point me to any reading or example. Thank you very much for your information.guys:
Thank you for your information so far. I need some more help here. I was able to run the function in my stored procedure. However, I was not able to print the result on the screen to view the cursor result, although I am using dbms_output.put_line statement inside my stored procedure.
I use the following statement to execute my stored procedure on sql*plus. I can tell the stored procedure is executed successfully, but I did see anything printed:
DECLARE TEMP VARCHAR2(100);
BEGIN PROC_LAWS_CAD_NAME_SEARCH('LPD', 'TEST DEVICE ID', 'TEST LAST NAME', 'TEST FIRST NAME', 'F', '11112009', TEMP); END;
I tried to use 'set serveroutput on' and got the following error:
ERROR:
ORA-06502: PL/SQL: numeric or value error: host bind array too small
ORA-06512: at line 1
I am kind of confused now. thank you for your help.
Jack
Here is my procedure:
create or replace
PROCEDURE PROC_SEARCH
( AGENCY_ID IN VARCHAR2,
DEVICE_ID IN VARCHAR2,
L_NAME IN VARCHAR2,
F_NAME IN VARCHAR2,
SEX IN VARCHAR2,
DOB IN VARCHAR2,
CAD_NAME_SCH_RESULT_STR OUT VARCHAR2)
AS
v_agy_id varchar2(10);
v_device_id varchar2(20);
v_l_name varchar2(25);
v_f_name varchar2(15);
v_sex varchar2(1);
v_dob date;
-- this cursor is going to be used to store a list of warrant matching
-- name search criteria
cad_srch_cursor sys_refcursor;
objSrch SEARCH_RESULT_TEMP%ROWTYPE;
BEGIN
cad_srch_cursor := SEARCH_PKG.SEARCH('TESTING', 'TESTER', null, null,null, null, getPhonetic('TESTING'));
LOOP
FETCH cad_srch_cursor INTO objSrch;
EXIT WHEN cad_srch_cursor%NOTFOUND;
--insert into SEARCH_RESULT_TEMP (name_last) values (objSrch.name_last);
CAD_NAME_SCH_RESULT_STR := objSrch.name_last;
dbms_output.put_line('First:'||objSrch.name_first||':Last:'||objSrch.name_last||':Middle:'||objSrch.name_middle);
end LOOP;
END PROC_LAWS_SEARCH;
----------------------------------------- -
Running a function inside a package
This is kind of a noob question: I have a function. I want to use this function inside a package. The function is not created inside the package.
Here is an example;
1 create or replace function test_func(v_one number, v_two number)
2 return number
3 as
4 begin
5 return v_one + v_two;
6* end;
SQL> /
Function created.
SQL> select test_funct(10,20) from dual
2 /
select test_funct(10,20) from dual
ERROR at line 1:
ORA-00904: "TEST_FUNCT": invalid identifier
SQL> select test_func(10,20) from dual
2 /
TEST_FUNC(10,20)
30
SQL> create or replace package test_pkg as
2 procedure test_proc(v_name varchar2, v_one number, v_two number);
3 end test_pkg;
4 /
Package created.
SQL>
1 create or replace package body test_pkg as
2 procedure test_proc(v_name varchar2, v_one number, v_two number) is
3 begin
4 dbms_output.put_line(v_name || ' ' || test_func(v_one, v_two));
5 end;
6* end test_pkg;
SQL> /
Package body created.
SQL> set serveroutput on
SQL> exec test_pkg.test_proc('Krystian',10,20)
Krystian 30
PL/SQL procedure successfully completed.With kind regards
Krystian Zieja -
Custom aggregate function inside a package.
Hi there,
I'm trying to write a custom aggregate function and group that function inside a package together with some other functions that I have. As an example (to simulate the problem I have) suppose my custom aggregation to do a summation of numbers looks like:
CREATE OR REPLACE TYPE SUM_AGGREGATOR_TYPE AS OBJECT (
summation NUMBER,
STATIC FUNCTION ODCIAggregateInitialize(agg_context IN OUT
SUM_AGGREGATOR_TYPE) RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT SUM_AGGREGATOR_TYPE,
next_number IN NUMBER) RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT SUM_AGGREGATOR_TYPE,
para_context IN SUM_AGGREGATOR_TYPE) RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateTerminate(self IN SUM_AGGREGATOR_TYPE,
return_value OUT NUMBER, flags IN NUMBER) RETURN NUMBER
CREATE OR REPLACE TYPE BODY SUM_AGGREGATOR_TYPE IS
STATIC FUNCTION ODCIAggregateInitialize(agg_context IN OUT
SUM_AGGREGATOR_TYPE)
RETURN NUMBER IS
BEGIN
agg_context := SUM_AGGREGATOR_TYPE(NULL);
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT SUM_AGGREGATOR_TYPE,
next_number IN NUMBER)
RETURN NUMBER IS
BEGIN
IF self.summation IS NULL THEN
self.summation := next_number;
ELSIF summation IS NOT NULL THEN
self.summation := self.summation + next_number;
END IF;
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT SUM_AGGREGATOR_TYPE,
para_context IN SUM_AGGREGATOR_TYPE)
RETURN NUMBER IS
BEGIN
self.summation := self.summation + para_context.summation;
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateTerminate(self IN SUM_AGGREGATOR_TYPE,
return_value OUT NUMBER, flags IN NUMBER)
RETURN NUMBER IS
BEGIN
return_value := self.summation;
return ODCIConst.Success;
END;
END;
If I write the following function definition:
CREATE OR REPLACE FUNCTION MY_SUM(input NUMBER)
RETURN NUMBER PARALLEL_ENABLE AGGREGATE USING SUM_AGGREGATOR_TYPE;
and corresponding type declaration to test:
CREATE OR REPLACE TYPE VECTOR
IS
TABLE OF NUMBER;
this statement:
select my_sum(column_value) from table(vector(1, 2, 1, 45, 22, -1));
gives the correct result of 70. However, creating a package with the function definition:
CREATE OR REPLACE PACKAGE MY_FUNCTIONS AS
FUNCTION MY_SUM(input NUMBER)
RETURN NUMBER PARALLEL_ENABLE AGGREGATE USING SUM_AGGREGATOR_TYPE;
END;
and calling it via:
select MY_FUNCTIONS.my_sum(column_value) from table(vector(1, 2, 1, 45, 22, -1));
explodes with:
ORA-00600: internal error code, arguments: [17090], [], [], [], [], [], [], [], [], [], [], []
Is it possible to have custom aggregate functions nested inside package declarations?
I'm using Oracle 11g, Release 2 (11.2.0.1.0).HiddenName wrote:
Is it possible to have custom aggregate functions nested inside package declarations?Yes, it is possible, you have succesfuly created your function. Your problem is that the database throws ORA-600 on execute. And with ORA-600 you can do 2 things: 1) google ORA-600 17090 or 2) contact your Oracle Support.
You could also try to declare the function without PARALLEL_ENABLE - just to try to see if it changes anything. You can also try to call your function against a regular table with rows and columns - not against an collection type with table() operator.
Anyway - these 2 tests should be usefull for Oracle Support.
I never tried to put a custom aggregate function into a package. First - the cases when you need a custom aggregate function to be written for your system are very rare. Second - even if I needed 1 then I never needed 2 or more custom aggregate functions on my system. And as I do not like to make my life more complex than necessary, I have created it as a stand-alone function. And it is works (slowly).I tried using a standard table as you suggested:
CREATE TABLE TEST_DATA
test_value NUMBER
INSERT INTO TEST_DATA
(SELECT column_value test_value from TABLE(vector(1, 2, 1, 45, 22, -1)));
COMMIT;
select my_sum(test_value) from test_data;
select my_functions.my_sum(test_value) from test_data;
I also tried removing the PARALLEL_ENABLE clause to create the package as follows:
CREATE OR REPLACE PACKAGE MY_FUNCTIONS AS
FUNCTION MY_SUM(input NUMBER)
RETURN NUMBER AGGREGATE USING SUM_AGGREGATOR_TYPE;
END;
And unfortunately it still breaks with the following error: SQL Error: ORA-00600: internal error code, arguments: [17090]. This looks like an Oracle bug to me as the PL/SQL parsing engine should have disallowed me to even create this if it is not supported in Oracle. Instead, it allows me to create the package, and breaks when I call the function with this weird error (additionally cutting my connection from the database) instead of disallowing me to do this altogether and printing a nice error message telling me that Oracle doesn't support this. How would I go about logging a ticket for this?
Edited by: wcmatthysen on Dec 1, 2010 12:51 PM -
How to get a called procedure/function name within package?
Hi folks,
is it possible to obtain a called procedure/function name within package?
For a measuring and tracing purpose, I would like to store an info at the beginning of each procedure/function in package with timestamp + additional details if needed.
For example:
CREATE OR REPLACE PACKAGE BODY "TEST_PACKAGE" IS
PROCEDURE proc_1 IS
BEGIN
api_log.trace_data(sysdate, 'START.' || ???????);
api_log.trace_data(sysdate, 'END.' || ???????);
END;
PROCEDURE proc_2 IS
BEGIN
api_log.trace_data(sysdate, 'START.' || ???????);
proc_1;
api_log.trace_data(sysdate, 'END.' || ???????);
END;
END; I would like to replace "???????" with a function which would return a name of called procedure, so result of trace data after calling TEST_PACKAGE.proc_2 would be:
11.1.2013 09:00:01 START.*TEST_PACKAGE.proc_2*
11.1.2013 09:00:01 START.*TEST_PACKAGE.proc_1*
11.1.2013 09:00:01 END.*TEST_PACKAGE.proc_1*
11.1.2013 09:00:01 END.*TEST_PACKAGE.proc_2*I tried to use "dbms_utility.format_call_stack" but it did not return the name of procedure/function.
Many thanks,
Tomas
PS: I don't want to use an hardcodingYou've posted enough to know that you need to provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
>
is it possible to obtain a called procedure/function name within package?
For a measuring and tracing purpose, I would like to store an info at the beginning of each procedure/function in package with timestamp + additional details if needed.
>
I usually use this method
1. Create a SQL type for logging information
2. Put the package name into a constant in the package spec
3. Add a line to each procedure/function for the name.
Sample package spec
* Constants and package variables
gc_pk_name CONSTANT VARCHAR2(30) := 'PK_TEST';Sample procedure code in package
PROCEDURE P_TEST_INIT
IS
c_proc_name CONSTANT VARCHAR2(80) := 'P_TEST_INIT';
v_log_info TYPE_LOG_INFO := TYPE_LOG_INFO(gc_pk_name, c_proc_name); -- create the log type instance
BEGIN
NULL; -- code goes here
EXCEPTION
WHEN ??? THEN
v_log_info.log_code := SQLCODE; -- add info to the log type
v_log_info.log_message := SQLERRM;
v_log_info.log_time := SYSDATE;
pk_log.p_log_error(v_log_info);
raise;
END P_PK_TEST_INIT;Sample SQL type
DROP TYPE TYPE_LOG_INFO;
CREATE OR REPLACE TYPE TYPE_LOG_INFO AUTHID DEFINER AS OBJECT (
* NAME: TYPE_LOG_INFO
* PURPOSE: Holds info used by PK_LOG package to log errors.
* Using a TYPE instance keeps the procedures and functions
* independent of the logging mechanism.
* If new logging features are needed a SUB TYPE can be derived
* from this base type to add the new functionality without
* breaking any existing code.
* REVISIONS:
* Ver Date Author Description
* 1.00 mm/dd/yyyy me Initial Version.
PACKAGE_NAME VARCHAR2(80),
PROC_NAME VARCHAR2(80),
STEP_NUMBER NUMBER,
LOG_LEVEL VARCHAR2(10),
LOG_CODE NUMBER,
LOG_MESSAGE VARCHAR2(1024),
LOG_TIME TIMESTAMP,
CONSTRUCTOR FUNCTION type_log_info (p_package_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_proc_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_step_number IN NUMBER DEFAULT 1,
p_LOG_level IN VARCHAR2 DEFAULT 'Uninit',
p_LOG_code IN NUMBER DEFAULT -1,
p_LOG_message IN VARCHAR2 DEFAULT 'Uninitialized',
p_LOG_time IN DATE DEFAULT SYSDATE)
RETURN SELF AS RESULT
) NOT FINAL;
DROP TYPE BODY TYPE_LOG_INFO;
CREATE OR REPLACE TYPE BODY TYPE_LOG_INFO IS
CONSTRUCTOR FUNCTION type_log_info (p_package_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_proc_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_step_number IN NUMBER DEFAULT 1,
p_LOG_level IN VARCHAR2 DEFAULT 'Uninit',
p_LOG_code IN NUMBER DEFAULT -1,
p_LOG_message IN VARCHAR2 DEFAULT 'Uninitialized',
p_LOG_time IN DATE DEFAULT SYSDATE)
RETURN SELF AS RESULT IS
BEGIN
self.package_name := p_package_name;
self.proc_name := p_proc_name;
self.step_number := p_step_number;
self.LOG_level := p_LOG_level;
self.LOG_code := p_LOG_code;
self.LOG_message := p_LOG_message;
self.LOG_time := p_LOG_time;
RETURN;
END;
END;
SHO ERREdited by: rp0428 on Jan 11, 2013 10:35 AM after 1st cup of coffee ;) -
List of Procedures/Functions in a Package
Hi All,
Is it possible to get List of procedure/functions in a package with their number of lines? I tried querying user_source but it treat package and package as a separate object but not function/procedures in that package.
Thanks.dbdan wrote:
There are some standards related to Quality Assurance where the quality of product is determined based on the bugs per n number of lines of code. I guess it is 0.01 bug per 1000 lines of code in Six-Sigma (may be not exact). We need to present this to client. My manage want us to get granularity even function/procedures within a package, well that is meaningless, if we can count total lines in a package, but Boss is always right :)What a bunch of baloney. Quality of code is not measured by number of lines but by programming design. And if anything the C language showed that a single line of code can be the most complex part of a program - and more difficult to understand and maintain than 100 "+plain+" lines of code.
Also, what about comments and spacing and formatting? I break down SQL statements in PL/SQL into a properly indented statements that spans multiple lines. So if there are 20 columns to select, there will be 20 lines. Compare this to instead put all 20 columns on a single line.
So using pure line number calculation will make my formatting score a bigger number on the bug chart. Not formatting at all and simply stuffing everything onto a single line (a nice unreadable mess) will be considered to have less bugs!?
So you will need to count statements and not lines. But how accurate is that when some statements are significantly more complex than others? PL/SQL and other languages are not RISC machines where all statements are essentially equal.
Nah.. I think this approach is idiotic, severely flawed, and that your boss is in serious needs of basic education in the principles and fundamentals of software engineering. -
No procedure/function decomposition in packages in Rel 2
I noticed that one of the changes since the last release was:
"View Package Spec and Body - now decompose to display procedures and functions "
I tried doing this in Rel 2 but there is still no decomposition of procedures/functions.Maybe I have misunderstood what was being said ?
Also, if you click the package spec, a subfolder labelled "loading..." appears which just stays there ...
Platform: Xp SP1
Raptor version:1.0.0.07.96Thats a very good point about navigating to the point in a package spec of body where the sub-object resides.
In cases where packages are thousands of lines long and have numerous procedures/functions, debugging code is difficult if you cant jumpt to points in code that the navigator shows you are there.
This is one of the few things that plsql navigator does better than Toad in my opinion and I'd happuily use Raptor over both of these if it can emulate what was asked in the last post.
Am using build 08.97 -
Stragg Function inside a Package
Hi Experts,
When i tried to use Stragg Function inside package, it throws error
CREATE OR REPLACE PACKAGE PKG_TEST AS
FUNCTION STRAGG(INPUT VARCHAR2) RETURN VARCHAR2;
END PKG_TEST;
CREATE OR REPLACE PACKAGE BODY PKG_TEST AS
FUNCTION STRAGG (INPUT VARCHAR2) RETURN VARCHAR2 PARALLEL_ENABLE AGGREGATE USING string_agg_type;
END PKG_TEST;
SHOW ERRORS
Package created.
Warning: compiled but with compilation errorsAny Suggestions...
ThanksThanks Frank.
>
Why do you need (or even want) STRAGG to be in a package? If it's a stand-alone function, you can call it from within a package whne you want to.
>
Actually my requirement is to have all code inside package and not in open.
>
The second example is not referencing pkg_test. Maybe you have two functions called STRAGG, one inside pkg_test (which has a bug) and one that is not in any package (which works correctly).
>
No...just only one function.
>
Whenever you have problems with a user-defined function, post the code that creates the user-defined function. (Make sure it's formatted.)
Even if you just copied the function from AskTom, post exactly what's on your system. There may be a editing error of which you're not aware.
>
Here is what i have with me,
Type Object and Body.
CREATE OR REPLACE TYPE string_agg_type
AS OBJECT
total varchar2(4000),
STATIC FUNCTION
ODCIAggregateInitialize (sctx IN OUT string_agg_type )
RETURN NUMBER,
MEMBER FUNCTION
ODCIAggregateIterate
( self IN OUT string_agg_type
, value IN VARCHAR2)
RETURN NUMBER,
MEMBER FUNCTION
ODCIAggregateTerminate
( self IN string_agg_type
, returnValue OUT VARCHAR2
, flags IN NUMBER
RETURN NUMBER,
MEMBER FUNCTION
ODCIAggregateMerge
( self IN OUT string_agg_type
, ctx2 IN string_agg_type
RETURN NUMBER
CREATE OR REPLACE TYPE BODY string_agg_type
IS
STATIC FUNCTION
ODCIAggregateInitialize
( sctx IN OUT string_agg_type
RETURN NUMBER
IS
BEGIN
sctx := string_agg_type ( NULL );
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION
ODCIAggregateIterate
( self IN OUT string_agg_type,
value IN VARCHAR2
RETURN NUMBER
IS
BEGIN
self.total := SUBSTR(self.total || value, 1, 4000);
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION
ODCIAggregateTerminate
( self IN string_agg_type
, returnValue OUT VARCHAR2
, flags IN NUMBER
RETURN NUMBER
IS
BEGIN
returnValue := self.total;
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION
ODCIAggregateMerge
( self IN OUT string_agg_type
, ctx2 IN string_agg_type
RETURN NUMBER
IS
BEGIN
self.total := self.total || ctx2.total;
RETURN ODCIConst.Success;
END;
END;
SHOW ERRORSMy Package
CREATE OR REPLACE PACKAGE PKG_TEST AS
FUNCTION STRAGG(INPUT VARCHAR2) RETURN VARCHAR2 PARALLEL_ENABLE;
END PKG_TEST;
CREATE OR REPLACE PACKAGE BODY PKG_TEST AS
FUNCTION STRAGG (INPUT VARCHAR2) RETURN VARCHAR2 PARALLEL_ENABLE AGGREGATE USING string_agg_type;
END PKG_TEST;
/Any way ....i just looked in to Solomon Code and tried it similarly. Not getting the expected and i believe it is a bug.
Thanks a lot for your time to analyze and reply to my post. -
DTD verification procedure/function in xmlgen package??
Is there a function or procedure in xmlgen package that verifies if the xmldocument is compliant with the DTD just like an error is generated if we use Java OracleXML putXML while using Java. Also, I am getting a system class not found (/oracle/rdbms/aurora/compiler) error when loading xmparser.jar file. Should I load the aurora.zip file first using the sys user in C:\oracle\ora81\javavm\lib directory ??
We can build Java Stored Procedures on Java Classes. If this is your case then the java source will not be visible in the USER_SOURCE view.
You can see what classes you have loaded in the schema (and whetehr you have the source for them) by running this query (warning: very slow!):
select name, source
from USER_JAVA_CLASSES
/Alternatively you can run this
select dbms_java.longname(object_name), object_type
from user_objects
where object_type like 'JAVA%'
/or join the two together...
select name, kind, source
from USER_JAVA_CLASSES
where name in ( select dbms_java.longname(object_name)
from user_objects
where object_type = 'JAVA SOURCE')
/Cheers, APC -
Question about Table Function inside a Package
Hi … I am new in PL/SQL, I am trying to use a table function to create depending on a value passed to it (I am using 10g). Everything works great but the moment I add a parameter everything explode, I am creating it on a package.
SQL that work
CREATE OR REPLACE PACKAGE BODY financial_reports AS
FUNCTION Fund_Amount
RETURN financial_reports.Fund_Amount_Table
pipelined parallel_enable IS
cur_row financial_reports.Fund_Amount_Record;
BEGIN
FOR cur_row IN
SELECT
to_number(substr(bu5.usrdata, 1, 1)) As SECTION_ID
,to_number(substr(bu5.usrdata, 2, 1)) As SUB_SECTION_ID
,to_number(substr(bu5.usrdata, 4, 2)) AS LINE_NUMBER
,to_number(substr(bu5.usrdata, 7, 2)) As FUND_ID
,sum(be.amt) AS AMOUNT
FROM
linc.budgetdb_usr5@stjohnsfp bu5
JOIN linc.budgetdb_event@stjohnsfp be ON
bu5.keyvalue = be.acctno
WHERE
bu5.keyvalue like '__-__-__-____-____-_____'
AND bu5.usrdata like '__-__-__'
AND bu5.fieldnum = 1
AND bu5.ispecname = 'GLMST'
AND to_number(substr(bu5.usrdata, 7, 2)) = 1
GROUP BY
bu5.usrdata
ORDER BY
bu5.usrdata
LOOP
PIPE ROW(cur_row);
END LOOP;
END Fund_Amount;
END financial_reports;
SQL that do not work …
CREATE OR REPLACE PACKAGE BODY financial_reports AS
FUNCTION Fund_Amount (Fund_Id IN NUMBER)
RETURN financial_reports.Fund_Amount_Table
pipelined parallel_enable IS
cur_row financial_reports.Fund_Amount_Record;
fund_id_int NUMBER;
BEGIN
fund_id_int := Fund_Id;
FOR cur_row IN
SELECT
to_number(substr(bu5.usrdata, 1, 1)) As SECTION_ID
,to_number(substr(bu5.usrdata, 2, 1)) As SUB_SECTION_ID
,to_number(substr(bu5.usrdata, 4, 2)) AS LINE_NUMBER
,to_number(substr(bu5.usrdata, 7, 2)) As FUND_ID
,sum(be.amt) AS AMOUNT
FROM
linc.budgetdb_usr5@stjohnsfp bu5
JOIN linc.budgetdb_event@stjohnsfp be ON
bu5.keyvalue = be.acctno
WHERE
bu5.keyvalue like '__-__-__-____-____-_____'
AND bu5.usrdata like '__-__-__'
AND bu5.fieldnum = 1
AND bu5.ispecname = 'GLMST'
AND to_number(substr(bu5.usrdata, 7, 2)) = fund_id_int
GROUP BY
bu5.usrdata
ORDER BY
bu5.usrdata
LOOP
PIPE ROW(cur_row);
END LOOP;
END Fund_Amount;
END financial_reports;
Error … (This works without the parameter)
Error starting at line 43 in command:
select * from table(financial_reports.Fund_Amount(1) )
Error at Command Line:1 Column:14
Error report:
SQL Error: ORA-22905: cannot access rows from a non-nested table item
Any help would be greatly appreciatedtry renaming your parameter so as not to confuse with what you are using in your column " to_number(substr(bu5.usrdata, 7, 2)) AS FUND_ID":
CREATE OR REPLACE PACKAGE BODY financial_reports AS
FUNCTION Fund_Amount (pFund_Id IN NUMBER)
RETURN financial_reports.Fund_Amount_Table
pipelined parallel_enable IS
cur_row financial_reports.Fund_Amount_Record;
fund_id_int NUMBER;
BEGIN
fund_id_int := pFund_Id;
FOR cur_row IN ( SELECT to_number(substr(bu5.usrdata, 1, 1)) As SECTION_ID,
to_number(substr(bu5.usrdata, 2, 1)) As SUB_SECTION_ID,
to_number(substr(bu5.usrdata, 4, 2)) AS LINE_NUMBER,
to_number(substr(bu5.usrdata, 7, 2)) As FUND_ID,
sum(be.amt) AS AMOUNT
FROM linc.budgetdb_usr5@stjohnsfp bu5
JOIN linc.budgetdb_event@stjohnsfp be ON bu5.keyvalue = be.acctno
WHERE bu5.keyvalue like '__-__-__-____-____-_____'
AND bu5.usrdata like '__-__-__'
AND bu5.fieldnum = 1
AND bu5.ispecname = 'GLMST'
AND to_number(substr(bu5.usrdata, 7, 2)) = fund_id_int
GROUP BY bu5.usrdata
ORDER BY bu5.usrdata ) LOOP
PIPE ROW(cur_row);
END LOOP;
END Fund_Amount;
END financial_reports; -
Toad- See functions inside packages.
I use Toad for my Oracle data bases. So here i have oracle packages which i can see by clicking 'Packages' button in Toad. I have functions in those packages but i can't see those functions. When i scroll over to 'Functions' button its all empty. I get "insufficient privileges" note if i am locked to it but that not the case i am assuming. How do i see the code in for a particular function inside a package. Help me. Thanks in advance.
>
I use Toad for my Oracle data bases. So here i have oracle packages which i can see by clicking 'Packages' button in Toad. I have functions in those packages but i can't see those functions. When i scroll over to 'Functions' button its all empty. I get "insufficient privileges" note if i am locked to it but that not the case i am assuming. How do i see the code in for a particular function inside a package.
>
You don't. You can see the entire package code by expanding the package body in the navigation tree. Then you can select your function in the tree and double-click it and in the editor you will be positioned at that function.
The functions and procedure tabs are for standalone objects. -
Procedures inside Oracle Packages
Hello All,
Can I execute an procedure defined inside an Oracle package using jdbc?
Are the procedures defined inside Oracle packages are same as stored procedures ?
Any help would be grately appreciated.
regards,
Abhishek.Yes you can execute a procedure defined inside an Oracle package. Use the prepareCall method eg
String param1 = 'some value';
oracleCStmt = oracleConn.prepareCall("begin package_name.proc_name(?); end;");
oracleCStmt.setString(1,param1);
oracleCStmt.executeUpdate();Yes a stored procedure in a package is no different to on inside a package. A package is just a collection of PL/SQL objects.
Richard -
How to place a procedure/function definition into a package spec.
How can I declare procedure/function in a package specification so that it has public scope? Presently I am able to create a procedure in a package under sub program units. The problem I am encountering is when I generate the code, the procedure declaration is only ending up in the package body and not the package specification.
Set the scope property of the procedure to "public" and generate it again...
-
How to modify the Procedure which exists in Package individually?
Hi,
I need to modify the procedure which exists in package individually. I.e. I don't want to recompile the entire package.
This task to be done in SQL Plus not in TOAD. Because in TOAD, we can directly place the script and recompile using the option.
Do we have any syntax to modify the procedure which exists in package?
[Like..... create or replace schema.packagename.procudrename....etc...?]
Kindly reply if you are not clear on my query.
Kindly help me on this.Explain the reason why this would make any sense. Convenience. I wouldn't mind this option either.
1) Currently, i am working on a PACKAGE which has
over 2k lines. In general, changes are made in a
single PROCEDURE only. I then copy the code (from
notepad) and paste it into SQL*Plus. This takes a few
seconds. If i could just ALTER the one PROCEDURE, it
would save time. (The little adds up to a lot during
testing.)
2) If two developers want to modify the two parts of
the same PACKAGE they would have to rename the
PACKAGE so one's changes do not overwrite the other.
Allowing to change the particular PROCEDURE inside
the PACKAGE would obviate this need.
3) If PACKAGES are to be stored in a versioning
system, it might be convenient to store each
PROCEDURE separately, instead of storing the entire
PACKAGE as one file.
It is certainly not required, but it would be a nice
convenience. That is why it would make sense.OK, then why did you chose to make packages? You do realize you can make stand alone procedures / functions outside of packages don't you?
I can see how 2 seconds of waiting for a package to compile could set your testing back by weeks (warning, being highly sarcastic).
Maybe you are looking for
-
Boot camp probl"back up disk and use disk util. to reform as single MAC OS.
The disk cannot be partitioned because some files cannot be moved. Back up the disk and use Disk Utility to format it as a single Mac OS Extended (Journaled) volume. Restore your information to the disk and try using Boot Camp Assistant again. I am t
-
Boot camp or Parallel Desktop ??
I am running few applications like Winamp and then one DVD Authoring application which creates DVDs and burns them. So I want to know will parallel desktop work for these applications or I am better off using Boot camp windows ? Or is there something
-
Easily damaged, battery does not last at all.
For the last two months the battery has been severely weak. The charge lasts MAYBE an hour. Sometimes I charge it all the way and it's dead in 5 minutes. This happened in less then 6 months from purchase. The battery starting easily losing power afte
-
Mass rejection of sales orders
Dear All, How to reject the list of sales order which is in the past date. Some sales orders are incomplete, some are past documents. We need to reject all these sales order. Difficult to reject it individually. Any report which gives the list of pas
-
Is KDE Framework compatible with Windows?
As the topic says, is it possible to use KDE widgets in Qt to create applications, and run them on Windows? Do the libraries need to be compiled in DLL form first? There are lots of cool widgets for KDE and it'd be totally awesome if I can create Cro