function defined by the user in the package
Hi allis it possible to return a value greater than 1 when you use the function defined by the user in the package?
You must declare variables US1 and US2 as well. I also modified your code a little more assing numbers directly rather than using select.
First of all,
Your package body and specifications should have the same input parameter names. Your spec is seen cid and your body with ccid. Has changed.
CREATE OR REPLACE PACKAGE creator.marco_function_clienttype
IS
-- 0 - not found
-- 1 - small business
-- 2 - corporate
-- 3 - individual
FUNCTION f_clienttype
(ccid number
)
RETURN NUMBER;
END;
/
CREATE OR REPLACE PACKAGE BODY creator.marco_function_clienttype
IS
FUNCTION f_clienttype (ccid NUMBER)
RETURN NUMBER
IS
us NUMBER;
us1 NUMBER;
us2 NUMBER;
BEGIN
--officialtype = 2 - corporate, officialtype = 3 - individual
SELECT ct.officialtype
INTO us1
FROM contragenttype ct, contragent d
WHERE d.ID = ccid
AND ct.cid = d.contragenttypeid;
---
IF us1 = 3
THEN
us := 3;
ELSE
--ENTERPRISETYPE.id = 910 - small business
SELECT dd.enterprisetypeid
INTO us2
FROM contragent dd
WHERE dd.ID = ccid;
IF us2 = 910
THEN
us := 1;
ELSE
us := 2;
END IF;
END IF;
RETURN NVL (us, 0);
END;
END;
/
G.
Tags: Database
Similar Questions
-
You can use functions defined by the user in orardf: statement?
Hello, reading Chapter 5: refined for RDF data access control
I found this example:
OPTIONAL
{
? control pred: hasContractValue? Val.
? control pred: hasManager * ' sys_context ("his $ appctx ', 'app_user_uri') ' ^^ orardf: instruction *.
}
See the orardf type: statement, I got the question if you can use functions defined by the user in the place where he has used the sys_context?
Thank you.
PD: The translation was made from Spanish to English by using Google TranslatorHello Alberto,.
Only the sys_context function is supported. The user-defined functions are not supported.
Thank you
Matt -
call a procedure of package DB type complicated if the type defined in the package itself
Hello world
I use jdev 11.1.1.7.0
I defined a package of data with a procedure and internal two types as follows:
Create Or Replace Package Db_Package As Type rec Is Record(Rec_Type Varchar2(10), Rec_Desc varchar2(10) ); Type recordList Is Table Of rec; Procedure Test_Procedure(p_out out recordList); END db_package;
evil
I want to call this procedure in the module of the application. I know how to call a procedure or function db AM,
but in this case that I've defined two types in the package itself and I use one of these types as to the procedure output parameter, I had a problem.
below is the example of code to call the db procedure, but it does not work because the plsqlBlock.registerOutParameter () setting will not
CallableStatement plsqlBlock = null; String statement = "Begin DB_PACKAGE.Test_Procedure(:1); END;"; try { plsqlBlock = getDBTransaction().createCallableStatement(statement, 0); plsqlBlock.registerOutParameter(1, OracleTypes.ARRAY);// it doesn't work plsqlBlock.executeUpdate(); Object object = plsqlBlock.getObject(1); } catch (Exception e) { e.printStackTrace(); }
I know that if I set the types of packets (rec, recordList) as types of oracle (instead of setting in the packaging itself) so I can call the procedure with success, in this case I should use below:
plsqlBlock.registerOutParameter(1, OracleTypes.ARRAY,"Recordlist");
but I wonder how you can call a procedure from the package if the types defined in the package itself.
Kind regards
Habib
JDBC supports the types of oracle level package only from 12 c database and jdbc driver ojdbc7 (which requires java 7).
Dario
-
Hi all
Please help me understand why I receive PLS-00323 error when my function exists in the header and body of the package.
Please find below the source code.
Maybe I should post more details here, please tell me what else should I show to get help.
I tried to compile my drawing
EXEC DBMS_UTILITY.compile_schema (pattern = > 'ZVIT');
but still
Select * from user_errors
Returns
NAME TYPE SEQUENCE LINE (LINE)
------------------------------ ------------ ---------- ---------- ----------
TEXT
--------------------------------------------------------------------------------
ATTRIBUTE MESSAGE_NUMBER
--------- --------------
PACKAGE 2 8 12 PKG_PK8842_ACCNOTMOVE BODY
PLS-00323: subprogram or cursor "ACCNOTMOVEFIZ" is declared in a specific package
cation and must be defined in the package body
ERROR 323
PACKAGE 1 3 12 PKG_PK8842_ACCNOTMOVE BODY
PLS-00323: subprogram or cursor "ACCNOTMOVEJUR" is declared in a specific package
cation and must be defined in the package body
ERROR 323
2 selected lines.
source code:
CREATE OR REPLACE PACKAGE ZVIT. PKG_PK8842_AccNotMove
AS
FUNCTION AccNotMoveJUR)
p_contragentId dwh_CR_contragent.ID%TYPE,
p_date Date)
RETURN number;
FUNCTION AccNotMoveFIZ)
p_contragentId dwh_CR_contragent.ID%TYPE,
p_date Date)
RETURN number;
FUNCTION DtLastMove)
p_Id B2_OLAP. DIMAACCOUNT_ALL.ID%TYPE)
Date of RETURN;
END;
/
CREATE OR REPLACE PACKAGE BODY ZVIT. PKG_PK8842_AccNotMove
AS
FUNCTION AccNotMoveJUR)
p_contragentId zvit.dwh_CR_contragent.ID%TYPE,
p_date Date)
RETURN number
IS
l_Result Number (1);
l_contragentId zvit.dwh_CR_contragent.ID%TYPE;
l_dateopen Date;
Date of l_dtMove1;
Date of l_dtMove2;
BEGIN
l_Result: = 0;
BEGIN
Select Distinct a.contragentid
In l_contragentId
OF B2_OLAP. DIMAACCOUNT_ALL one
where a.contragentid = p_contragentId
and a.BACCOUNTID in (2600,2650)
and a.ACCOUNTSTATEID not in (1,2);
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_contragentId: = NULL;
END;
IF l_contragentId IS NOT NULL THEN
l_Result: = 0;
ON THE OTHER
BEGIN
Select MAX (a.dateopen)
In l_DateOpen
OF B2_OLAP. DIMAACCOUNT_ALL one
where a.contragentid = p_contragentId
and a.BACCOUNTID in (2600,2650)
and a.ACCOUNTSTATEID <>2
and a.DateOpen > p_date;
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_DateOpen: = NULL;
END;
IF l_DateOpen IS NOT NULL THEN
l_Result: = 0;
ON THE OTHER
BEGIN
SELECT MAX (d.arcdate)
In l_dtMove1
OF B2_OLAP. DIMAACCOUNT_ALL has,
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE a.contragentid = p_contragentId
and a.BACCOUNTID in (2600,2650)
and d.ACCOUNTBID = a.Id
and d.arcdate > = p_date
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3)
and not in Substr (d.accountano, 1, 4) ('2608 ', ' 2658');
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_dtMove1: = NULL;
END;
IF l_dtMove1 IS NULL THEN
BEGIN
SELECT MAX (d.arcdate)
In l_dtMove1
OF B2_OLAP. DIMAACCOUNT_ALL has,
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE a.contragentid = p_contragentId
and a.BACCOUNTID in (2600,2650)
and d.ACCOUNTBID = a.Id
and d.arcdate > = p_date
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3)
and not in Substr (d.accountano, 1, 4) ('2608 ', ' 2658');
- and d.DOCUMENTSTATEID = 2
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_dtMove1: = NULL;
END;
END IF;
IF l_dtMove1 IS NULL THEN
BEGIN
SELECT MAX (d.arcdate)
In l_dtMove1
OF B2_OLAP. DIMAACCOUNT_ALL has,
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE a.contragentid = p_contragentId
and a.BACCOUNTID in (2600,2650)
and d.ACCOUNTAID = a.Id
and d.arcdate > = p_date
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3);
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_dtMove1: = NULL;
END;
END IF;
IF l_dtMove1 IS NULL THEN
BEGIN
SELECT MAX (d.arcdate)
In l_dtMove1
OF B2_OLAP. DIMAACCOUNT_ALL has,
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE a.contragentid = p_contragentId
and a.BACCOUNTID in (2600,2650)
and d.arcdate > = p_date
and d.ACCOUNTAID = a.Id
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3);
- and d.DOCUMENTSTATEID = 2
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_dtMove1: = NULL;
END;
END IF;
IF l_dtMove1 IS NULL THEN
l_Result: = 1;
On the other
l_Result: = 0;
End If;
END IF;
END IF;
RETURN l_Result;
END AccNotMoveJUR;
--------------------------------------------------------------------------------
FUNCTION AccNotMoveFIZ)
p_contragentId zvit.dwh_CR_contragent.ID%TYPE,
p_date Date)
RETURN number
IS
l_Result Number (1);
l_contragentId zvit.dwh_CR_contragent.ID%TYPE;
l_dateopen Date;
Date of l_dtMove1;
BEGIN
l_Result: = 0;
BEGIN
Select Distinct a.contragentid
In l_contragentId
OF B2_OLAP. DIMAACCOUNT_ALL one
where a.contragentid = p_contragentId
and a.BACCOUNTID in (2620,2625)
and a.ACCOUNTSTATEID not in (1,2);
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_contragentId: = NULL;
END;
IF l_contragentId IS NOT NULL THEN
l_Result: = 0;
ON THE OTHER
BEGIN
Select MAX (a.dateopen)
In l_DateOpen
OF B2_OLAP. DIMAACCOUNT_ALL one
where a.contragentid = p_contragentId
and a.BACCOUNTID in (2620,2625)
and a.ACCOUNTSTATEID <>2
and a.DateOpen > p_date;
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_DateOpen: = NULL;
END;
IF l_DateOpen IS NOT NULL THEN
l_Result: = 0;
ON THE OTHER
BEGIN
SELECT MAX (d.arcdate)
In l_dtMove1
OF B2_OLAP. DIMAACCOUNT_ALL has,
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE a.contragentid = p_contragentId
and a.BACCOUNTID in (2620,2625)
and d.ACCOUNTBID = a.Id
and d.arcdate > = p_date
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3)
and Substr(d.accountano,1,4) <>'2628';
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_dtMove1: = NULL;
END;
IF l_dtMove1 IS NULL THEN
BEGIN
SELECT MAX (d.arcdate)
In l_dtMove1
OF B2_OLAP. DIMAACCOUNT_ALL has,
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE a.contragentid = p_contragentId
and a.BACCOUNTID in (2620,2625)
and d.arcdate > = p_date
and d.ACCOUNTBID = a.Id
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3)
and Substr(d.accountano,1,4) <>'2628';
- and d.DOCUMENTSTATEID = 2
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_dtMove1: = NULL;
END;
END IF;
IF l_dtMove1 IS NULL THEN
BEGIN
SELECT MAX (d.arcdate)
In l_dtMove1
OF B2_OLAP. DIMAACCOUNT_ALL has,
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE a.contragentid = p_contragentId
and a.BACCOUNTID in (2620,2625)
and d.ACCOUNTAID = a.Id
and d.arcdate > = p_date
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3);
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_dtMove1: = NULL;
END;
END IF;
IF l_dtMove1 IS NULL THEN
BEGIN
SELECT MAX (d.arcdate)
In l_dtMove1
OF B2_OLAP. DIMAACCOUNT_ALL has,
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE a.contragentid = p_contragentId
and a.BACCOUNTID in (2620,2625)
and d.arcdate > = p_date
and d.ACCOUNTAID = a.Id
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3);
- and d.DOCUMENTSTATEID = 2
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_dtMove1: = NULL;
END;
END IF;
IF l_dtMove1 IS NULL THEN
l_Result: = 1;
On the other
l_Result: = 0;
End If;
END IF;
END IF;
RETURN l_Result;
END AccNotMoveFIZ;
--------------------------------------------------------------------------------
FUNCTION DtLastMove)
p_Id B2_OLAP. DIMAACCOUNT_ALL.ID%TYPE)
Date of RETURN
IS
l_Result Date;
Date of l_DtLast1;
Date of l_DtLast2;
Date of l_DtLast3;
Date of l_DtLast4;
BEGIN
l_Result: = NULL;
BEGIN
SELECT MAX (d.arcdate)
In l_DtLast1
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE d.ACCOUNTBID = p_Id
- and d.arcdate > = p_date
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3)
and Substr (d.accountano, 1, 4) not in ('2608', ' 2658 ', ' 2628');
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_DtLast1: = NULL;
END;
BEGIN
SELECT MAX (d.arcdate)
In l_DtLast2
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE d.ACCOUNTBID = p_Id
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3)
and Substr (d.accountano, 1, 4) not in ('2608', ' 2658 ', ' 2628');
- and d.DOCUMENTSTATEID = 2
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_DtLast2: = NULL;
END;
BEGIN
SELECT MAX (d.arcdate)
In l_DtLast3
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE d.ACCOUNTAID = p_Id
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3);
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_DtLast3: = NULL;
END;
BEGIN
SELECT MAX (d.arcdate)
In l_DtLast4
B2_OLAP.AR_DOCUMENT d,
B2_OLAP. DIMDOCUMENTTYPE dt
WHERE d.ACCOUNTAID = p_Id
and d.DOCUMENTTYPEID = dt.id
and dt. OPERATIONTYPEBYSUMMAID not to (2,3);
- and d.DOCUMENTSTATEID = 2
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_DtLast4: = NULL;
END;
l_DtLast1:=NVL(l_DtLast1,to_date('01.01.1900','dd.mm.yyyy'));
l_DtLast2:=NVL(l_DtLast2,to_date('01.01.1900','dd.mm.yyyy'));
l_DtLast3:=NVL(l_DtLast3,to_date('01.01.1900','dd.mm.yyyy'));
l_DtLast4:=NVL(l_DtLast4,to_date('01.01.1900','dd.mm.yyyy'));
l_Result: = Greatest (l_DtLast1, l_DtLast2, l_DtLast3, l_DtLast4);
IF l_Result = TO_DATE('01.01.1900','dd.mm.yyyy') THEN
l_Result: = NULL;
END IF;
RETURN l_Result;
END DtLastMove;
---////////////////////////////////////////////////////
END;
/
You declare your parameter with a different type between the specification and body, your statements must match.
-
Functions defined by the user with several parameters
I set features three following user using "Define."
UF1 takes a single patameter;
UF2 takes two parameters;
and UFX takes two parameters - with the second is 'X' in the definition.
Œuvres F1. F2 is the EVAL of F1 version and it works too. User functions only seem to work fine.
F3, a function of two user settings, produces a graph of NaN.
F4 is the EVAL of F3 version. Note that 'B 'is not replaced by 1'. Also produces a NaN chart.
F5 produces a graph of NaN.
F6 is EVAL of F5. The 'X' is not replaced (even with the ' B' above), and even if it looks like 'X * X', it also produces a graph of NaN.
Is it possible to get defined by the user, with several parameters, features work by tracing the curve?
Hi!, Fortin:
If you download and install the ultimate Firmware with the version of the software: 2015 6 17 (8151), with the number of Version: 1.1.2 - 11, you can trace your examples of definition of the function, with curves and values, without NaN.
-
Function defined by the user in order by?
Hey guys. We try our postgres database to Oracle to port, and I fall on this issue. We have columns called "sortSequences", which are arrays of arbitrarily long integers. To some fine POC, I use varray(), but that probably won't work as a production application, due to its strongly defined by size. In any case, the crux of the problem is that I need to be able to select * from foo by sortSequence, where the evaluation order is custom code. The array of integers represent essentially mathematics of infinite precision and we have a deterministic algorithm to compare, but we can't just produce a value between them (what I think keeps me to use a card member function in a user-defined object type.) In other words, we don't really care what are the values, we are just using their collectively as an index of sort. An aggregate function like the right answer, and a simple scalar function is out of the question. We watched the field index, but it is not clear to me that even if we created an operator related to our type defined by the user that the db would use this function for order by rating...
Everyone can think of a solution to this problem? If we must live without this feature, we can reproduce in the application code, but we want to avoid that at all costs...
Thank you
Brian
The array of integers represent essentially mathematics of infinite precision and we have a deterministic algorithm to compare, but we can not simply to produce a value between them (I think preventing me to use a card member function in a user-defined object type.)
OK, but what about a method of ORDER?
Since you seem to have the algorithm already, is not just a matter of implementation of the COMMAND method?
Performance, it is not ideal but it's a start.
Something along these lines:
create or replace type array_t is varray (32767) integer;
/
create or replace type sort_sequence_t as object)
v array_t
member function serialize return varchar2
, for the integer return order member function match (o sort_sequence_t)
);
/
create or replace type body sort_sequence_t is
member function serialize return varchar2 is
RES varchar2 (4000);
Start
because me in 1... self.v.Count loop
If I have 1 > then
RES: res = | ',';
end if;
RES: res = | TO_CHAR (self.v (i));
end loop;
return res;
end;
order whole return leg (o sort_sequence_t) member function is
whole v1;
whole v2;
Start
because me in 1... Greatest (self.v.Count, o.v.Count) loop
If self.v.exists (i) then
v1: = self.v (i);
on the other
v1: = 0;
end if;
If o.v.exists (i) then
V2: = o.v (i);
on the other
V2: = 0;
end if;
If v1< v2="">
Returns - 1;
elsif v1 > v2 then
Return 1;
end if;
end loop;
return 0;
end;
end;
/
Tests...
SQL > with sample_data (id, sort_seq) as)
2 Select 1, sort_sequence_t (array_t (10,1,1)) of all the double union
3 select 2, sort_sequence_t (array_t (1,1, -1)) of all the double union
4 Select 3, sort_sequence_t (array_t (1,1,1)) of all the double union
5. Select option 4, sort_sequence_t (array_t (1,1,2)) of all the double union
6 select 5, sort_sequence_t (array_t (1,20,1)) of all the double union
7. Select 6, sort_sequence_t (array_t (1,7,1)) of double
8)
9. Select t.id
10, t.sort_seq.serialize (as seq_str)
sample_data 11 t
12 order by t.sort_seq;
ID SEQ_STR
---------- --------------------------------------------------------------------------------
2-1,-1, -1
3 1,1,1
4 1,1,2
6 1,7,1
5 1,20,1
1 10,1,1
6 selected lines
Post edited by: odie_63 - added example
-
function defined by the user in where clause
Hello
Please let me know how to use user-defined in the where clause. I need to use the function that returns the date for dateid.
It generates the error...
ErrorSELECT To_char(fnc_get_date_for_dateid(a.postdateid),'DD-MON-YYYY') transaction_date, SUM(A.points) POINTS_OR_MILES_CREDITED, SUM(CASE WHEN a.points is null THEN a.transactionamount ELSE a.points END), FROM accrual a JOIN datecal dc ON dc.dateid = a.postdateid join MemberALL m on m.memberid = a.memberid WHERE a.awardnumber IS NULL AND a.accrualtype = 'B' GROUP BY To_char(fnc_get_date_for_dateid(a.postdateid),'DD-MON-YYYY') ORDER BY a.postdateid;
Thank youORA-00979: not a GROUP BY expression 00979. 00000 - "not a GROUP BY expression"
SandyHi Sandy,
Have you tried like
===========================SELECT To_char (fnc_get_date_for_dateid (a.postdateid), 'DD-MON-YYYY') transaction_date,.
Sum (A.points) POINTS_OR_MILES_CREDITED,
SUM (CASE WHERE the a.points is null THEN a.transactionamount ELSE a.points END),
The ACCRUAL one
JOIN dc datecal ON dc.dateid = a.postdateid
Join MemberALL m on m.memberid = a.memberid
WHERE a.awardnumber IS NULL
AND a.accrualtype = 'B '.
GROUP BY a.postdateid - To_char (fnc_get_date_for_dateid (a.postdateid), 'DD-MON-YYYY')
ORDER BY a.postdateid;
==========================Thank you
Slokam -
Can I use function defined by the user in the control file Sql Loader?
Hi Master,
Can I use fuction user-defined in the sql loader control file? Please advise... !!
If you can provide an example... It's very kind of you.
Concerning
AR
Here are a few examples that should give you clues: Sql loader
I seriously wonder if why you use the century previous SQL * Loader instead of a external table:
ORACLE-BASE - external Tables: querying data from flat files in Oracle
-
Generator function defined by the user (normalize data points)
Hi all
You can use the function Scale1D to the Analisys Advanced library.
-
Need for a function defined by the user in order to obtain a weighted average
Hello
We have a table where we want to device the weighted average for a column of prices below using formula,
sum (quantity * price) / sum (qty)
We have a few lines where part or all of the columns that is price or quantity can be NULL.
We have tried to write the function as follows however, it fills even after 30 minutes, where as we have the addition of this feature request could was completed in 25 seconds.
Please note that we are dealing with big data i.e. the table could have 50 million records. It has appropriate indexing and other components to improve performance required.
We know that we did something wrong in the creation of feature below, but we are unable to resolve
CREATE OR REPLACE FUNCTION "WEIGHTEDAVGPRICE" (PCOLNAME NUMBER( ) RETURN NUMBER
IS
TEMP NUMBER (26,13);
BEGIN
SELECT SUM (QUANTITY * PCOLNAME) / SUM (QUANTITY) IN TEMP DE FEES;
RETURN TEMP;
END WEIGHTEDAVGPRICE;
Here, we send the parameter THAT PCOLNAME represents the name of the price column we want to do a weighted average.
We know we could do this without adding a feature, but we need instructions BOX, and then in our SELECT clause. We use toplink to query the database, in this case, it will be difficult to covert.
Also, we want this function to be used in other places as well.
Thank you
@Bhagyesh KNW
The reason for the decrease in performance when you use the function, you call the function from a query and which is originally a context switch between SQL and PL/SQL engines. That is known to slow down performance. If you can only do the task in SQL, you must do so, in order to avoid context switching.
It would be useful that you provided a few sample data and expected the output, as indicating the version of your database, so that people can understand and help you better.
Please read:
-
What is the difference between the function declared in the package and the CIP
What is the difference between the definition of a function in the package and package body?
Published by: user10641405 on November 19, 2009 13:29If you describe a package, you will see only the functions declared in the spec.
If you declare only in the body but are not available to other packages (they are private to the package, non-public) -
How to call the function defined by the user
Hello
I need help...
In my project, I have page Login.jspx where there is a user name text box.
I second success.jspx page that has its bean class of success.java I define a method "display(). Now, I want to display() cal on my success.jspx page.
can anyone help me what is the way to do it.
Thanks in advance...
Thank you
NehalHello
I think we can declare the variable txtVal of chain in the world or outside of the method and create the Set accessor method and the Get accessor.
Then, we could try to access the value like this...value = "#{backingBeanScope.backing_FrgtPwd.txtVal} '"
~ Abhijit
-
Defined by the user function in query...
I have included a function defined by the user in the SQL query that gave rise to the query takes a long time.
Select col1, col2 (col1, col2) fn_userfunction from table where col1 in (values);
The function calculate some values based on col1 and col2.
How this improved query performance?
Concerning
Jean-LouisHello
If it was before including quickly, then you must look at the function for the performance. Maybe you can include the function in the SQL code, which makes it faster. Something else may be to put the function in a subquery:
select col1, col2, (select fn_userfunction(col1, col2) from dual) xxx from table where col1 in (values);
But you should always try to put at least as possible function in SQL. He created above.
If the query is too slow without the function, then an index on col1 can help, but depends on the data and distribution.
If you need help with the feature, you must provide the code for the forum. Then, perhaps we can help.
Herald tiomela
http://htendam.WordPress.com -
Function of stored procedure defined by the user of the appellant
Hi all -
I am trying to call a function defined by the user of a stored procedure. I'm using something like
the above is correct.IF condition1 THEN function1(param1, param2); END IF;
I have PLS-00221 function1 is not a stored procedure or is not defined?Well, if it is a function, you will need to assign its result value in a variable.
Like this:
DECLARE some_variable [of the right datatype]; ... IF condition1 THEN some_variable := function1(param1, param2); END IF;
-
Function within the package error
Hi friends,
I have a package called xxhw_ams_utils with a function inside get_salary
When I tried to run this function in the package as below average way, im getting error as
ORA-00904: "XXHW_AMS_UTILS." "" GET_SALARY ": invalid identifier
where there are 1072 is the assignment IM id to the objective test.select apps.xxhw_ams_utils.get_salary(1072) from dual
This is the actually the get_salary function located in the package xxhw_ams_utils of coding
Suppose that if I performed as the way to way below, I get the correct resultFUNCTION get_salary (p_asg_id IN NUMBER) RETURN VARCHAR2 IS l_gross VARCHAR2(20); l_basic VARCHAR2(20); BEGIN select eev.screen_entry_value into l_basic from pay_element_entry_values_f eev, per_pay_bases ppb, pay_element_entries_f pe where ppb.pay_basis_id +0 = 61 and pe.assignment_id = 1072 and eev.input_value_id = ppb.input_value_id and eev.element_entry_id = pe.element_entry_id and sysdate between eev.effective_start_date and eev.effective_end_date and sysdate between pe.effective_start_date and pe.effective_end_date; EXCEPTION WHEN OTHERS THEN RAISE; END;
Suppose if I run as the means below it is back as invalid character error.select eev.screen_entry_value --into l_basic from pay_element_entry_values_f eev, per_pay_bases ppb, pay_element_entries_f pe where ppb.pay_basis_id +0 = 61 and pe.assignment_id = 1072------------------------------------>assignment id (that im passing) and eev.input_value_id = ppb.input_value_id and eev.element_entry_id = pe.element_entry_id and sysdate between eev.effective_start_date and eev.effective_end_date and sysdate between pe.effective_start_date and pe.effective_end_date;
Why might the problem friends.select apps.xxhw_ams_utils.get_salary(1072) from dual
Brgds,
MiniYour function must RETURN a VARCHAR2
Maybe you are looking for
-
Can not activate a Windows product key is already in use error message
Original title: product key which with pc, problem of activation key now prodct I do not have hcl pc with vista Home premium lic. is not recognized, see the message this number already in use how it is possible
-
Hello, I have a server that is running windows Server 2003, all 5 other computers are able to map the drive in the server and the connection with the credientials I. The problem: I should just a new computer, custom built, everything works fine, the
-
HP Pavilion m9340f using Seagate ST3000DM001 SATA 3 to disk BIOS sees as 800 GB
I bought a 3 TB drive SATA internal Seagate ST3000DM001.When I installed in the case the bios sees as 800 GB, not 3000 GB. I have the last m9340f bios HP installed and updates of windows drivers.
-
my remote desktop connection does not show the three options under DESK remotely
my remote desktop connection does not show the three options under DESK remotely like that: -. Allow the connection of computers running any version of remote desktoporThat allow the connection of computers running Office remotely with authentication
-
Resizing of bitmaps with Graphics.drawTexturedPath - bad ratio
Hello I used to resize bitmap images (to have the similar physical size on different phones) in my project with the following code - found in this thread: Without creating an encoded image bitmap image resizing public static Bitmap resizeBitmap(Bitma