How to use a function inside the package?
HelloYou will need to convert weight unit of kilogram kips when filling out the weight values into a temporary table. In our database, schema there is a function called convert_units is available.
How could I use this feature in my package? My package is also resides in the same database schema.
Here, I pasted the function.
convert_units
(
in_base_unit_id NUMBER,
in_conversion_unit_id NUMBER,
in_value NUMBER
) RETURN NUMBER AS
CURSOR unit_cur IS
SELECT *
FROM units_conversion
WHERE base_unit_id = in_base_unit_id
AND conversion_unit_id = in_conversion_unit_id;
unit_rec unit_cur%ROWTYPE;
BEGIN
OPEN unit_cur;
FETCH unit_cur INTO unit_rec;
IF unit_cur%NOTFOUND THEN
unit_rec := NULL;
END IF;
CLOSE unit_cur;
RETURN (in_value+unit_rec.pre_adjust_add)*(unit_rec.rate);
END convert_units;
Hello
It seems that the first two arguments of this function are ID in the units_conversion table. If you know this id = 1234 means kilograms, 9876 means kips, then you can do things like:
wt_kips := convert_units (1234, 9876, wt_kilograms);
or
INSERT INTO tmp_table ( ..., weight_val, ...)
VALUES ( ..., convert_units (1234, 9876, wt_kilograms), ...);
I can't just look at the code which could be any valid ID. I'm not even sure of the order of the arguments. I hope you have instructions on how to use the function.
If the function is in a package named pk_xyz (a different package to the one in which you call it), add the name of the package, like this
wt_kips := pk_xyz.convert_units (1234, 9876, wt_kilograms);
Tags: Database
Similar Questions
-
How to use variable bin in the package without asking a user?
Hello
I would write a SQL but I want to use bind variable as static package, without asking the user? As below?
I would ask you, below it is a variable emp_id? Is this variable BINDING?
DECLARE
bonus NUMBER (8.2);
emp_id NUMBER (6): = 100;
BEGIN
SELECT salary * 0.10 IN employees OF bonus
WHERE employee_id = emp_id;
END;
/
If this isn't the case, as this SQL, how can define a CONNECTION variable as static inside a code? don't ask a user?
version of DB. 9.2.0.8
best regards and thank youOracleADay wrote:
I would write a SQL but I want to use bind variable as static package, without asking the user? As below?
Yes, as you did in this code example.
All SQL statements must be analyzed as sliders to be filled. PL/SQL source code can contain code PL/SQL (programming language) and the source SQL.
So, indeed you are coding 2 languages of different source code in the same source program. The PL/SQL compiler is a pretty smart to understand what is PL/SQL code and what is the SQL code. To obtain the SQL source code, he creates transparently calls to the SQL engine - this call to the SQL engine will contain instructions on how to analyze the SQL and bind constants or variables in PL/SQL to SQL.
The SQL engine saves the sliders in the Shared Pool (the memory of the SGA structure) of Oracle. And you can easily watch the content of the present to see what SQLs cursors here - and what bind variables, if any, they use.
I posted an example - creating a procedure containing a SQL, execution of the PL/SQL code and then watching the cursor that has been created in the shared Pool. See {message identifier: = 2243507}. And it's a little easier to do that (more detailed) SQL tracing approach Pierre indicated above.
If this isn't the case, as this SQL, how can define a CONNECTION variable as static inside a code? don't ask a user?
A PL/SQL variable or a constant that you use in a SQL statement in the PL/SQL code, will be treated as a variable binding when parsing SQL and create the cursor so that it (or re - using an existing cursor).
-
How can I escape commas inside the function listQualify?
I have
am a newbie in coldfusion. I need help. My database has records of names of companies as: abc, Inc. For now I'm using this query:
SELECT DISTINCT COMPANY FROM ComapanyTable WHERE (Company IN (#ListQualify(form.cCompanyList2, "'", ",")#))
This problem is that it separates CBA, Inc..
SELECT DISTINCT Company FROM CompanyTableWHERE (Company IN ('abc',' Inc.','xyz','Inc.'))
I need to get the list, as it is, i.e. as: "abc, Inc.", "xyz, Inc." so that I can later insert these values into a new table.
Insert the code:
<cfquery name="insertPair" datasource="#DSN#" dbtype="ODBC"> INSERT INTO tblChildCompanyToParent (Parent_Account_ID, Child_Account_ID) SELECT DISTINCT <cfqueryparam value = "#form.pCompanyList#" CFSQLType = "CF_SQL_VARCHAR">, Company FROM CompanyTable WHERE Company IN (<cfqueryparam value="#ValueList(insertSelect.Company,';' )#" CFSQLType = "CF_SQL_VARCHAR" list="true" separator=";">) </cfquery>
Code of the selection list
<select multiple name="cCompanyList2" id="cCompanyList2" class="selectCCompany" data-attribute="selCCompany" size="10"> <cfloop query="childCompanyList"> <option value="#childCompanyList.Child_Account_ID#">#childCompanyList.Company#</option> </cfloop> </select>
Y at - it anyway to solve this problem.
Thank you for your help.
I managed to fix it.
I posted the solution to StackOverflow
SQL - how can I escape commas inside the function listQualify? -Stack overflow
Thank you once again!
-
using Record statistics for session/Interface inside the package
Oracle DB / ODI.
I have a package starting with Interface.
In the second step, I want to know how many records has been inserted/updated the first interface. Let that say those numbers will be used on the second interface.
How can I do? Is it possible to access this information inside the package?
Something similar to SQL % ROWCOUNT in ODI?Try this in variable refresh
Select to_number (< %="odiRef.getPrevStepLog("INSERT_COUNT")%">) + to_number (<%=odiRef.getPrevStepLog("UPDATE_COUNT")%>) of the double
-
pipeline function and type inside the package
Hi all
I'm sorry for the inconvenience, I tried to google my question before asking here...
The question is:
I can't compile type in the same package as my function in the pipeline?
I have an example of a function in the package, everything works fine.
SELECT using function statement:CREATE OR REPLACE PACKAGE ZOO.pkg_cl_risk_eval AS FUNCTION sample (p_date date, p_indicatorid number, p_ismodel number) return cl_risk_act pipelined; END; / CREATE OR REPLACE PACKAGE BODY pkg_cl_risk_eval is FUNCTION sample (p_date date, p_indicatorid number, p_ismodel number) return cl_risk_act pipelined IS v_obj cl_risk_type := cl_risk_type(NULL,NULL,NULL,NULL); BEGIN FOR e IN ( select trunc(sysdate) as adate, 0 as cid, 0 as indicatorid, case when p_ismodel = 0 then 0 else 1 end as value from dual ) LOOP v_obj.adate := e.adate; v_obj.cid := e.cid; v_obj.indicatorid := e.indicatorid; v_obj.value := e.value; PIPE ROW (v_obj); END LOOP; RETURN; end; end; /
I can't compile type in the same package as my function in the pipeline?select * from table(zoo.pkg_cl_risk_eval.sample(date '2011-09-30',4, 0))
Currently, it is outside the package:
As far as I can read from this source, it is impossible, but this information can be updated.DROP TYPE cl_risk_type FORCE; CREATE OR REPLACE TYPE cl_risk_type AS OBJECT ( adate date, cid number(10), indicatorid number(5), value number(5) ) / CREATE OR REPLACE TYPE cl_risk_act AS TABLE OF cl_risk_type /
http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:4447489221109
Oracle version: 11g
UPD:
I'm sorry, I'm not paying attention... It is possible as noted in the response to my similar question:
function in pipeline work in the package? (Oracle 11g)
Published by: marco on December 15, 2011 07:40As the following State messages, my post was wrong. I withdraw without reservation.
Published by: APC on December 15, 2011 15:30
-
How to use JavaScript to limit the number of boxes to check the user can select a PDF form?
How to use JavaScript to limit the number of boxes to check the user can select a PDF form?
Here's the working solution
Please rename all the boxes like chkBox0, chkBox1... .chkBox30 (must start with 0)
Value of exports of each checkbox must be "Yes" (default value is Yes)
Place this Code at the level of the Javascript Document
-Code JavaScript document-
var counter = 0; Checked the meter
-Count boxes checked again when the document is closed and reopened.
for (var i = 0; i)<= 30;="">=>
If (getField("chkBox"_+_i).value == 'Yes') {}
Counter += 1;
}
}
-The function of validation-
function validateCheckBox(name,value) {}
If (value == 'Yes' & meter)<>
Counter += 1;
} else if (value == 'Off') {}
counter = 1;
} else {}
getField ("name") .value = "Off";
App.Alert ("you can select only four checkboxes");
}
}
-End of Document Javascript-
Now put this line in the MouseUp event all checkboxes
Box - Code MouseUp event.
validateCheckBox (event.target.name, event.target.value);
//----------------------------------------------------------------------------------
Hope this will help
Kind regards
Post edited by: Mohammad Irfan
-
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
-
Tool: how to choose an image inside the image area that is out of reach
Tool: how to choose an image inside the image area that is out of reach?
See the photo below reference.
How to move the image inside a box that lies beyond the visible area? (The bottom box)
When you click the image, you can't get the contour or more unless the image area is expanded to include the hidden area.
Am I missing something? Thanks for the help.
Vannon
You can move the object back in the frame by clicking on the button "Content Center" to the right (this is located in your toolbar at the top).
Or you can use the arrows on your keyboard to move it as well.
-
How to use a function in a Where Clause?
Hello
I have a doubt. If MY_FUNCT is a function that returns a Boolean value, can I use in a where clause clause to write a query like this? :
Select...
table one
where the...
*...*
and MY_FUNC (a.field) = true
*...*
*;*
Thank you!
Published by: Mark1970 on 3.27 lug-2-2010But is it possible that the function does not return a Boolean value?
Yes (as sysdate, substr and instr etc.) you can also use your own function in a where clause clause, as long as it does not return a BOOLEAN value.
I mean how to use a function in a where clause clause?
Your own pseudocode seems a good example for me.
So, just give it a try. -
How to call a function inside a class?
Hello, I am starting a delivery service... This function is inside a class.
In this function, I am referring to another function inside the calss to call a Tween. It never happens 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 it. It must run the tween class. I use the delegate bad class?
My instructions are not clear or you misread the. It works very well with my suggestions as follows:
And thereby on the main timeline:
Import makeMovie;
var Mymovie = new makeMovie (this)
-
I got a license number for Adobe Master Collection from my school (Stevens Institute of Technology) and I can't understand how to use it to obtain the product. I created a user name and this is as far as I'm away. I need to download the product and I may not know where to start.
Ask someone to your school... You have a Cloud redemption code, or a number of series CS6?
If cloud, http://helpx.adobe.com/x-productkb/global/redemption-code-help.html Redemption Code and
http://www.Adobe.com/products/creativecloud/FAQ.html
http://helpx.adobe.com/creative-cloud/help/install-apps.html to install or uninstall
http://forums.Adobe.com/community/download_install_setup/creative_cloud_faq
What is http://helpx.adobe.com/creative-cloud/help/creative-cloud-desktop.html
To start https://helpx.adobe.com/creative-cloud.html the Cloud
If CS6, download to other downloads and enter your serial number when prompted
Once again, your 1 resource is your school
-
How to use JavaScript to change the named view
How to use JavaScript to change the named view
Do you mean to jump to a specific Destination named within a PDF file? SE so there
the method gotoNamedDest of the Document object.
-
How to use CSS to create the horizontal navigation bar in Dreamweaver CS6
How to use CSS to create the horizontal navigation bar in Dreamweaver CS6
One of the ways to do this is the following: Editor Tryit v1.9
You can also use floats to get something in the same direction.
-
How to report a bug in the package XMP Toolkit?
Hello
How to report a bug in the package XMP Toolkit?
Thomas
Hi Thomas,
Please let us know any bugs through this forum. We will file a bug in their own country. Unfortunately, there is currently no public bug for XMP tool.
Thank you
Jörg
-
How to call a function inside a canvas from the outside?
Hey,.
I created a HTML5 Canvas animation with animate CC and also added some bootstrap stuff to the HTML document by hand. To animate CC, on the main timeline, I added a function:
this.removeObject = function() {}
Console.log ("withdrawal of object");
// [...]
}
Outside the canvas element, I added a button. When you click on it it must call the function removeObject inside the canvas.
I tried to access by adding a "= window.parent.canvasTimeline;" Variable in the file CC animate, but it does not work.
Is it still possible?
It is of course possible. Just have your code Animate stash a reference to your function in the global scope.
globalMyAnimateRemoveObjectFunction = this.removeObject;
Then you can make globalMyAnimateRemoveObjectFunction() from anywhere in the page.
Maybe you are looking for
-
We have 3 email addresses and on one of them (home email), we are unable to send emails using a remote server. That is why the last time, we were away from home, we have a Gmail account. We also have an address to iCloud. We receive emails for all 3
-
Window pops up telling me that I have registored my gateway device
Window pops up telling me that I have registored my gateway device, I know because I registored TI. Appears again and again, me taking off full screen. How can I get rid of this pest?
-
using the same key on another computer
I thought that I can use the same key to windows vista to computers at least 3 is this correct?
-
Cannot control the Websphere application
Hi all I deployed JavaEE cartridge on one of my server and activated monitoring websphere, but I make very few mistakes. Please find the attached agent logs and let me know what other things I have to do yet. Please answer as soon as possible. -Shiva
-
Pavilion HP 3200 does not start
I have a HP Pavilion s3200n it tries to start, but will not start. I can hear it start but when I release the button it stops I suspect CPU. I have a set of recovery discs, but cannot get that far from having read disks.