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.
Similar Messages
-
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. -
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;
----------------------------------------- -
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 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.
-
Can i create any procedure or function inside a oracle reserve package?
Hi!
Can i create any procedure or function inside a oracle reserve package. Suppose, I want to create a function called x in the dbms_output package. Can i do that? Or can i extend the features of this package and create/derived a function from it like we extend any class in JAVA. I'm not sure - whether this is at all possible. I'll be waiting for your reply.
Thanks in advance.
Satyaki De.No, but you can write a wrapper package and use that instead of using the Built-In package directly. So, instead of calling DBMS_OUTPUT, you call your own Package.
Steven Feuerstein wrote a wrapper for DBMS_OUTPUT, called P:
Re: DBMS_OUTPUT.PUT_LINE -
Use a package function inside a select of the same package
Hi.
How can i use a function defined inside a package, with a select used inside that same package ?
Example
... package example
CREATE OR REPLACE PACKAGE BODY pkg_example
AS
FUNCTION sum_two_values(p_val1 NUMBER,p_val2 NUMBER) RETURN NUMBER
IS
BEGIN
RETURN p_val1 + p_val2;
END sum_two_values;
FUNCTION use_another_function_example RETURN VARCHAR2
IS
v_value NUMBER;
BEGIN
SELECT sum_two_values(2,2) INTO v_value FROM dual;
RETURN 'waaaazzzzupppppp'
END use_another_function_example;
END pkg_example;
This will not work
-- SELECT sum_two_values(2,2) INTO v_value FROM dual;
How can i call a function inside a select statement, a function of the same package where the query is being called.
(i have Oracle 9.2x)
Cheers.are you sure? you are not using package1, you are using pack1
SQL> CREATE OR REPLACE PACKAGE package1
2 IS
3 FUNCTION f1
4 RETURN NUMBER;
5
6 FUNCTION f2
7 RETURN NUMBER;
8 END;
9 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY package1
2 IS
3 a NUMBER;
4
5 FUNCTION f1
6 RETURN NUMBER
7 IS
8 BEGIN
9 RETURN 1;
10 END;
11
12 FUNCTION f2
13 RETURN NUMBER
14 IS
15 BEGIN
16 SELECT package1.f1
17 INTO a
18 FROM DUAL;
19
20 RETURN a;
21 END;
22 END;
23 /
Package body created.
Why not just this
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PACKAGE BODY package1
2 IS
3 a NUMBER;
4 FUNCTION f1
5 RETURN NUMBER
6 IS
7 BEGIN
8 RETURN 1;
9 END;
10 FUNCTION f2
11 RETURN NUMBER
12 IS
13 BEGIN
14 a:= f1;
15 RETURN a;
16 END;
17* END;
SQL> /
Package body created.formatted
Message was edited by:
devmiral -
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 -
Where can I see functions prototype in package wwv_name_value ?
Hi,
I'm interested to see function prototypes from packages wwv_name_value, wwv_standard_util, wwv_lang and others.
How is it possible ?
I used wwv_name_value.get_string function in Advanced PL/SQL window (following a given example), but in the future maybe I'll find other usefull functions which I would like to use...
I'm working with WebDB 2.1.
Thanks:
SzilardHi,
You can see public apis at this location.
http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/plsql/doc/astart.htm
For wwv_name goto the preference APIS.
For wwv_lang goto national language APIS
Thanks,
Sharmila -
Oracle Execution Time for function inside view
Hi Guys,
i would like to ask if i call a function inside a view , how does it behave in term of execution time and performance
For Example i have a view as below
create or replace view CUST.CUST_VIEW
select a.nice , a.getCustomDisplay(a.name,a.pin,a.dos,b.master_key) as custom from CUST.customer as a , CUST.master as b
where a.idno = b.main_id_no
AND the function look like this
create or replace function getCustomDisplay(a varchar2,b varchar2,c varchar2,d varchar2)
begin
select * from CUST.MAPPING_MATRIX order by idno asc;
for loop
//logic goes here to determine the result return from matrix
end
My Question is for example
1. If i do select * from CUST.CUST_VIEW ( return 1000 records for example ) , so the function getCustomDisplay will be executed 1000 times also right ( that means select * from CUST.MAPPING_MATRIX order by idno asc; will also be executed 1000 times ) ?
2. If i do select * from CUST.CUST_VIEW where rownum <= 20 , how many times getCustomDisplay() function will be executed ?
The reason i ask this because recently we saw a few million execution times per day from AWR report for this query
"select * from CUST.MAPPING_MATRIX order by idno asc;"
But when i investigate , and put a logger whenever it call getCustomDisplay , the query above as mention in item no 2 only will be executed as many as the record that will be returned from ( view + where condition ).
3. will it affect performance if my view return a lot of records ? or is there any way to improve it?
ThanksHi
i have other solutions that seems work for reducing number of execution times but do you think its scalable and feasible ?
CREATE OR REPLACE package body ACER.TYPE_CAT_PASS_UTIL_TEST as
*/* Private package data */*
TYPE g_rec IS RECORD (
id_no VARCHAR2 (4),
type_pass VARCHAR2 (3),
scheme_ind VARCHAR2 (5),
cat_pass VARCHAR2 (2),
entrepass VARCHAR2 (2),
display_type_pass VARCHAR2 (15),
display_cat_pass VARCHAR2 (5),
display_type_pass_desc VARCHAR2 (80),
rule_id VARCHAR2 (5)
TYPE g_tab_type IS TABLE OF g_rec INDEX BY BINARY_INTEGER;
g_tab g_tab_type;
i BINARY_INTEGER;
procedure initializeTypePassMatrix(test IN varchar2) as
begin
if(g_tab.COUNT < 1)then
FOR appln_rec in (
SELECT tb_type_cat_pass_matrix.id_no,
tb_type_cat_pass_matrix.type_pass,
tb_type_cat_pass_matrix.scheme_ind,
tb_type_cat_pass_matrix.cat_pass,
tb_type_cat_pass_matrix.entrepass,
tb_type_cat_pass_matrix.display_type_pass,
tb_type_cat_pass_matrix.display_cat_pass,
tb_type_cat_pass_matrix.display_type_pass_desc,
tb_type_cat_pass_matrix.rule_id
FROM tb_type_cat_pass_matrix ORDER BY id_no asc)
LOOP
dbms_output.put_line('g_tab.COUNT before insert: ' || g_tab.COUNT);
i := g_tab.COUNT + 1;
g_tab (i).id_no := appln_rec.id_no;
g_tab (i).type_pass := appln_rec.type_pass;
g_tab (i).scheme_ind := appln_rec.scheme_ind;
g_tab (i).cat_pass := appln_rec.cat_pass;
g_tab (i).entrepass := appln_rec.entrepass;
g_tab (i).display_type_pass := appln_rec.display_type_pass;
g_tab (i).display_cat_pass := appln_rec.display_cat_pass;
g_tab (i).display_type_pass_desc:= appln_rec.display_type_pass_desc;
g_tab (i).rule_id := appln_rec.rule_id;
DBMS_OUTPUT.put_line ('g_tab.count after insert: ' || g_tab.COUNT);
END LOOP;
else
DBMS_OUTPUT.put_line ('g_tab>=1, no need to initialize');
end if;
exception
when others then
dbms_output.put_line('error happen'||DBMS_UTILITY.format_error_backtrace);
Logger.ERROR('TYPE_CAT_PASS_UTIL.initializeTypePassMatrix',SQLCODE,SQLERRM || ' ' ||DBMS_UTILITY.format_error_backtrace,'SYSTEM');
end initializeTypePassMatrix;
procedure populateTypeCatPassFullDesc(typePass IN varchar2, schemeInd IN varchar2,catPass IN varchar2,entrePass IN varchar2, displayTypePass IN OUT varchar2,displayTypePassDesc IN OUT varchar2, displayCatPass IN OUT varchar2 )is
v_displayTypePass varchar2(15) :='-';
v_displayTypePassDesc varchar2(100) :='-';
v_displayCatPass varchar2 (2):='-';
v_type_pass varchar2(3) := '';
v_scheme_ind varchar2(5) := '';
v_cat_pass varchar2(2);
v_entrepass varchar2(2);
v_flag_valid_1 boolean:=false;
v_flag_valid_2 boolean:=false;
v_flag_valid_3 boolean:=false;
v_flag_valid_4 boolean:=false;
v_appln_rec g_rec;
begin
dbms_output.put_line('line 1');
initializeTypePassMatrix('test');
FOR nomor in g_tab.FIRST .. g_tab.LAST
LOOP
v_appln_rec := g_tab(nomor);
dbms_output.put_line('line 2.1');
v_flag_valid_1 :=false;
v_flag_valid_2 :=false;
v_flag_valid_3 :=false;
v_flag_valid_4 :=false;
v_type_pass := v_appln_rec.type_pass;
v_scheme_ind := v_appln_rec.scheme_ind;
v_cat_pass := v_appln_rec.cat_pass;
v_entrepass := v_appln_rec.entrepass;
dbms_output.put_line('line 2.2');
if(typePass = v_type_pass or v_type_pass = 'NA') then
v_flag_valid_1:= true;
end if;
if(schemeInd = v_scheme_ind or v_scheme_ind='NA') then
v_flag_valid_2 := true;
elsif(schemeInd is null and v_scheme_ind is null) then
v_flag_valid_2 := true;
end if;
if(catPass = v_cat_pass or v_cat_pass='NA') then
v_flag_valid_3 := true;
elsif(catPass is null and v_cat_pass is null) then
v_flag_valid_3 := true;
end if;
if(entrePass = v_entrepass or v_entrepass='NA') then
v_flag_valid_4 := true;
end if;
if(v_flag_valid_1 = true and v_flag_valid_2 = true and v_flag_valid_3 = true and v_flag_valid_4 = true) then
v_displayTypePass := v_appln_rec.display_type_pass;
v_displayCatPass := v_appln_rec.display_cat_pass;
v_displayTypePassDesc := v_appln_rec.display_type_pass_desc;
dbms_output.put_line('rule id got :'||v_appln_rec.rule_id);
dbms_output.put_line('rule no got :'||v_appln_rec.id_no);
exit when (0 = 0);
end if;
END LOOP;
displayTypePass := v_displayTypePass;
displayCatPass := v_displayCatPass;
dbms_output.put_line('1type:' || v_displayTypePassDesc);
displayTypePassDesc := v_displayTypePassDesc;
dbms_output.put_line('2type:' || displayTypePassDesc);
dbms_output.put_line('type:' || v_displayTypePass);
dbms_output.put_line('cat :' || v_displayCatPass);
exception
when others then
dbms_output.put_line('error happen'||DBMS_UTILITY.format_error_backtrace);
Logger.ERROR('TYPE_CAT_PASS_UTIL.populateTypeCatPass',SQLCODE,SQLERRM || ' ' ||DBMS_UTILITY.format_error_backtrace,'SYSTEM');
end populateTypeCatPassFullDesc;
function getDisplayTypePass(typePass IN varchar2, schemeInd IN varchar2,catPass IN varchar2,entrePass IN varchar2) return varchar2 is
v_displayTypePass varchar2(15) :='-';
v_displayTypePassDesc varchar2(100) :='-';
v_displayCatPass varchar2(2) :='-';
begin
populateTypeCatPassFullDesc(typePass,schemeInd,catPass,entrePass,v_displayTypePass,v_displayTypePassDesc,v_displayCatPass);
return v_displayTypePass;
exception
when others then
dbms_output.put_line('error happen'||DBMS_UTILITY.format_error_backtrace);
Logger.ERROR('TYPE_CAT_PASS_UTIL.populateTypeCatPass',SQLCODE,SQLERRM || ' ' ||DBMS_UTILITY.format_error_backtrace,'SYSTEM');
end getDisplayTypePass;
end TYPE_CAT_PASS_UTIL_TEST;
By Using like above even i do query on select * from <some_view) it will be only one execution for
SELECT tb_type_cat_pass_matrix.id_no,*
**tb_type_cat_pass_matrix.type_pass,**
**tb_type_cat_pass_matrix.scheme_ind,**
**tb_type_cat_pass_matrix.cat_pass,**
**tb_type_cat_pass_matrix.entrepass,**
**tb_type_cat_pass_matrix.display_type_pass,**
**tb_type_cat_pass_matrix.display_cat_pass,**
**tb_type_cat_pass_matrix.display_type_pass_desc,**
**tb_type_cat_pass_matrix.rule_id**
**FROM tb_type_cat_pass_matrix ORDER BY id_no asc*
the key point is the initializeTypePassMatrix function but it seems the variable only works for one session ?
if i open new session it will be reset again . -
How to check for the variable passed to a function inside a component
I'm trying to pass a variable to a function inside of a
component in a conditional statement.
How to check the existance of this variable inside the
function so that I can use the right <CFarguments>:
in aForm.cfm I have:
<cfinvoke component="#application.cfcroot#.business.Order"
method="selOrderItems"
returnvariable="q_OrderItems"
OrderItemAbbreviation="Min"></cfinvoke>
<cfset MCompIDs = ValueList(q_OrderItems.OrderItemID)>
<cfif listFind(MCompIDs,attributes.CompID)>
<cfset isM = true>
<cfelse>
<cfset isM = false>
</cfif>
<cfinvoke component="#application.cfcroot#.business.Order"
method="selOrderItems"
returnvariable="q_OrderItems"
OrderItemAbbreviation="SMEnroll"></cfinvoke>
<cfset SM_CompIDs =
ValueList(q_OrderItems.OrderItemID)>
<cfif listFind(SM_CompIDs,attributes.CompID)>
<cfset isSM = true>
<cfelse>
<cfset isSM = false>
</cfif>
<CFIF isSM>
<cfset temppath = frmcreator.buildFrm(isSMFlag=isSM)>
<CFELSE>
<cfset temppath = frmcreator.buildFrm(isMFlag=isM)>
</CFIF>
On aFormComp.cfc where the function is,
I checked the existance of isSMFlag this way and I got error
saying that :
Context validation error for tag CFARGUMENT.; The tag must be
nested inside a CFFUNCTION tag.
How can I properly check the existance of isSMFlag inside the
function so I can use the right cfarguments?
<CFFUNCTION NAME="buildFrm" access="public"
returntype="String" output="No">
<cfif StructKeyExists(arguments, "isSMFlag")>
<CFARGUMENT NAME="isSMFlag" REQUIRED="YES"
TYPE="NUMERIC">
<cfelse>
<CFARGUMENT NAME="isMFlag" REQUIRED="YES"
TYPE="NUMERIC">
</cfif>
........ etc
</CFFUNCTION><CFFUNCTION NAME="buildFrm" access="public"
returntype="String"
output="No">
<cfif StructKeyExists(arguments, "isSMFlag")>
<CFARGUMENT NAME="isSMFlag" REQUIRED="YES"
TYPE="NUMERIC">
<cfelse>
<CFARGUMENT NAME="isMFlag" REQUIRED="YES"
TYPE="NUMERIC">
</cfif>
........ etc
</CFFUNCTION>
NOT this way, that is for sure.
The <cfargument ...> tag is for defining the arguments
a function
accepts either optional or not, but they are not required.
Give this a
try to see the differences.
test.cfc
<cfcomponent>
<cffunction name="a">
<cfdump var="#arguments#">
</cffunction>
<cffunction name="b">
<cfargument name="foo">
<cfargument name="bar">
<cfdump var="#arguments#>
</cffunction>
</cfcomponent>
test.cfm
<cfset something = createObject("component","test")>
<cfoutput>
#something.a("blue","green")#
#something.b("blue","green")#
</cfoutput>
Not tested or debugged so watch out for typos. -
How to call a function inside a class?
Hello, i am trying to fire a function onPress .. this
function is inside a class.
In this function i refer to another function inside the calss
to call a Tween. It never arrives in the second function.
I tried to make an example.
In the fla file i have:
var test:makeMovie = new makeMovie(this);
You will see a red squere and you can press on it. It should
run the tween class. Am i using the delegate class wrong?I always have to use test movie and trace a couple of times
each time I start to use Delegate.
It wraps function.apply I think, which I tend to use more
often.
try using:
Container.onPress = Delegate.create(this,setAlpha);
and then just
setTween()
inside your setAlpha....
That's conceptually how I think I would try it above if I was
doing something similar.
I'm not sure it would have the desired effect even if the
delegate was executed as you have it coded. Unless you want
setTween's execution scope to be the Container clip in which case
you might need to do what kglad said and change the Container
reference to 'this'.
The way you have it at the moment inside setAlpha the
Delegate.create is simply creating a function...and not excuting
it.
its like : function something(){trace('what')}
and not like : something();
Below is some quick code that helps show how things work.
Notice that I assigned the delegate function to mainFunc....so that
along with the last example might provide a clue. Just paste it on
a frame and take a look at what's happening. -
Creating function inside a procedure.
Hi all I am on data base 10g,
is it possible to create a function inside a procedure I don't want to use package.
thanks in advance.Like
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure demo1
2 as
3 dd number;
4 function demo2( a number, b number ) return number
5 as
6 begin
7 return a+b;
8 end;
9 begin
10 dd := demo2(10,30);
11 dbms_output.put_line(dd);
12* end;
SQL> /
Procedure created.
SQL> exec demo1;
PL/SQL procedure successfully completed.
SQL> set serveroutput on
SQL> /
Procedure created.
SQL> exec demo1;
40
PL/SQL procedure successfully completed.
SQL> -
Call function inside running class
Hey All,
i have a two question in classes.
1- i have class and i called its before and its running on runtime. i need to call function inside this class from another class, but without call the first one again, because if i called it, it will run default class function again
is this doable ?
2- What super() mean ?
Thanks a lot.this is the default call, and when i call the method by this way its will run the default class function before call the method.
here my example:
i need to call checkboxes function in ChannelsMain class without pass by the grey script.
Note: the call_cb is working and the trace is working
so i now the class is running, i need to call the checkboxes without ( var ci:YourClass = new YourClass(); )
package com.link
import fl.controls.CheckBox;
import flash.events.*;
public class ChannelsMain
var cbLength:uint = Main.PV.channel_id.length;
public function ChannelsMain()
// constructor code
for (var i:int = 0; i < cbLength; i++)
var cb:CheckBox = new CheckBox;
cb.name = Main.PV.channel_id[i];
cb.label = Main.PV.channel_name[i];
cb.x = 50;
cb.y = 50 + i * 30;
cb.addEventListener(Event.CHANGE,call_cb);
Main.MS.addChild(cb);
//call xml function
if(i == cbLength - 1)
new ChannelsXML();
private function call_cb(evt:Event)
trace(evt.currentTarget.name,evt.currentTarget.selected);
public function checkboxes(evt)
trace(evt); -
How to trace static functions inside binary?
Hello Everybody
Is it possible to trace all statically linked functions inside some application with DTrace?
Here is an explanation. I have an application with source code like this:
int main(int argc, char * argv[])
custom_init();
�
void custom_init()
function1();
function2();
�
This code compiled into one binary so all functions like function1, function2 and so on are �statically linked�. I�d like to see calls tree say for function custom_init. I do not know all function names that maybe called from custom_init so I need to log everything down from custom_init.
Is this possible with DTrace if I only have a binary and it contains symbolic info?
Thank youjonathan
Thanks, I got huge list of function names with
supplied command (# dtrace -l -n
'pid$target:myprog::entry' -c /myprog)
Now I'd like to trace all that comes from function
myfunc() inside binary myprog - how do I do this?The usual idiom for this is something like:
# cat > trace.d <<EOF
#!/usr/sbin/dtrace -s
#pragma D option flowindent
pid$target:a.out:myfunc:entry
self->on++;
pid$target:a.out::entry
/self->on/
pid$target:a.out::return
/self->on/
pid$target:a.out:myfunc:return
/self->on/
self->on--;
pid$target:a.out:myfunc:return
/self->on <= 0/
exit(0); /* we've gotten the data we wanted, so exit dtrace */
EOF
# chmod +x trace.d
# ./trace.d -c 'command args'
...This will only get the static functions in the binary; to get all shared library functions as well, s/:a.out::/:::/g.
Inside the {}s for :entry and :return, you can do additional work; for
example, you could print a nanosecond timestamp:
trace(timestamp);
or (for ::return) the return value:
trace(arg1);
etc.
Cheers,
- jonathan
Maybe you are looking for
-
I have downloaded a few books from iBooks and they arrive with parts missing. Receive the error message This page contains the following errors, error in line 1 column 1...etc. Any advice?
-
Steps for creating new source system
Hi guys We are on BI 7 and ECC 6 now...We are planning to get the data from other source systems (R/3 4.6)which are existed in different place. Now my question is what are the steps to get the data from this new Source system and whats BI developer r
-
Validating a xpath against xml
try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = builder.parse(new File("d:\\eqcschema\\test.xml")); XPath xpath =XPathFactory.newInstance().newXPath()
-
Hey guys, I know how to create a custom script logic but lets say i have abcd.lgf file. Now can someone please tell me how to have the user run this script logic? I know that if i do #include abcd.lgf in default.lgf it will run automatically anytime
-
Hi all, we are moving to ECC 6.0 from 4.6C. I have a list of all user exits. How can i check that these exits are in use or not? Please help. Regards, AI.