How to call PL/SQL function and pass parameter to ODI variable?
Can I call PL/SQL function and assign a return value to an ODI variable? Also can I assign ODI variable to IN paramter and assign OUT parameter to ODI variable? What ODI doc has that information?
Thanks
Hi,
Refer this http://odiexperts.com/how-to-use-plsql-procedures-and-functions-in-odi
Thanks,
Sutirtha
Similar Messages
-
How to debug PL/SQL functions? Passing parameter and debugger error
Hi,
How to debug a PL/SQL function in JDeveloper? There are two problems with it:
1) Don't see how it's possible to pass parameters required by function call (in the dialog opening after Debug -> Debug FUNCTION_NAME)
2) In a function returning table_name%ROWTYPE (and having a record declaration for table_name%ROWTYPE), debug gives error:
PLS-00103: Encountered symbol "/" when expecting one of ... in line
v_Return PL/SQL RECORD;
Debugging procedures works as expected.
Found a similar question without answer here:
Debugging PL/SQL with parametersCheck
http://www.oracle.com/technology/obe/obe9051jdev/plsqlobe/obeplsql.htm#t2
Frank -
How to call a SQL function from an XSL expression
Hi
In R12, in Payroll Deposit adivce/Check writer, We need to sort the earnings tag <AC_Earnings> in to two different categories as regular and other earnings. In the DB and form level of element defintiion we have a DFF which differentiates between the two kinds of earnings. But the seeded XML that is gerneated by the check writer does not have this field.
The seeded template displays all the earnings in one column. How can we achieve this in the template without modifying the seeded XML.
The one approach i have is to write a function and based on the return value sort the data. For this I need to know :
1) How to call a SQL function from an XSL expression that is allowed in BI template.
If anyone ahs faced similar requirements please share your approach.
Thanks
SrimathiThank u..
but i'd seen that link wen i searched in google..
Is it possible without using any 3rd party JARs and all?
and more importantly plz tell me what should be preferred way to call a javascript function?
Do it using addLoadEvent() or Windows.Load etc
OR
Call it thru Xsl? (I donno how to do dis)
Thanks in Advance..
Edited by: ranjjose on Jun 3, 2008 8:21 AM -
How to call pl/sql function from element values
EBS 11.5.10.2
XMLP 5.6.3
Hello,
I noticed that the output of the rdf-to-data template conversion process makes use of an undocumented feature of data templates, and I would like to get input from experts as to which situations this feature is usable.
The closest thing I can find in the documentation is a sample in the user guide. There is a "General Ledger Journals Data Template Example" that has a <dataStructure> section that contains <element> nodes which are NOT children of a <group> node. I can't find any explanation of this in the user guide.
I've noticed from converted templates that in these un-grouped elements you can make calls to PL/SQL functions in the "value" attribute, like this:
<dataStructure>
<group name="G_LINES" source="Q_MAIN">
<element name="Line_Num" value="Line_Num"/>
</group>
<element name="C_CALCULATED_VALUE" dataType="number" value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
</dataStructure>Has anyone had any success being able to call PL/SQL functions from grouped elements? Whenever I try, it doesn't seem to work.
When I try something like this:
<dataStructure>
<group name="G_LINES" source="Q_MAIN">
<element name="Line_Num" value="Line_Num"/>
<element name="some_calculation" value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
<element name="some_calculation_b" value="XX_CUSTOMPROCS.SOME_FUNCTION_B(:Line_Num)"/>
</group>
<element name="C_CALCULATED_VALUE" dataType="number" value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
</dataStructure>The <SOME_CALCULATION/> and <SOME_CALCULATION_B/> nodes come out empty in the output data xml file, but <C_CALCULATED_VALUE> would have a value as desired.ah - perfect. That makes sense. Thank you for the response!
But what about when we need to pass parameters to those functions whos values are the results of aggregate element values?
This happens a lot in the converted data templates, where pl/sql package functions are meant to replace formula columns from the original Oracle Report. Take this example from the conversion of ARXAGMW.rdf (Aging Report, 7 Buckets):
(note the function call in the value of "Set_Percent_Inv_Inv" is using aggregate results from subgroups)
<group name="G_INV_INV" dataType="varchar2" source="Q_Invoice">
<element name="Total_Inv_Inv_Amt" function="sum" dataType="number" value="G_Invoice.C_Amt_Due_Rem_Inv"/>
<element name="Total_Inv_Inv_B0" function="sum" dataType="number" value="G_Invoice.C_Inv_B0"/>
<element name="Total_Inv_Inv_B1" function="sum" dataType="number" value="G_Invoice.C_Inv_B1"/>
<element name="Total_Inv_Inv_B2" function="sum" dataType="number" value="G_Invoice.C_Inv_B2"/>
<element name="Total_Inv_Inv_B3" function="sum" dataType="number" value="G_Invoice.C_Inv_B3"/>
<element name="Total_Inv_Inv_B4" function="sum" dataType="number" value="G_Invoice.C_Inv_B4"/>
<element name="Total_Inv_Inv_B5" function="sum" dataType="number" value="G_Invoice.C_Inv_B5"/>
<element name="Total_Inv_Inv_B6" function="sum" dataType="number" value="G_Invoice.C_Inv_B6"/>
<element name="Set_Percent_Inv_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.set_percent_inv_invformula(:Total_Inv_Inv_Amt, :Total_Inv_Inv_B0, :Total_Inv_Inv_B1, :Total_Inv_Inv_B2, :Total_Inv_Inv_B3, :Total_Inv_Inv_B4, :Total_Inv_Inv_B5, :Total_Inv_Inv_B6)"/>
<element name="Sum_Percent_B0_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B0_Inv_p"/>
<element name="Sum_Percent_B1_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B1_Inv_p"/>
<element name="Sum_Percent_B2_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B2_Inv_p"/>
<element name="Sum_Percent_B3_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B3_Inv_p"/>
<element name="Sum_Percent_B4_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B4_Inv_p"/>
<element name="Sum_Percent_B5_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B5_Inv_p"/>
<element name="Sum_Percent_B6_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B6_Inv_p"/>
<group name="G_Cust_Inv" dataType="varchar2" source="Q_Invoice">
<group name="G_Site_Inv" dataType="varchar2" source="Q_Invoice">
<group name="G_1" dataType="varchar2" source="Q_Invoice">
<group name="G_Invoice" dataType="varchar2" source="Q_Invoice">
<element name="C_Amt_Due_Rem_Inv" dataType="number" value="C_Amt_Due_Rem_Inv"/>
<element name="C_Inv_B0" dataType="number" value="C_Inv_B0"/>
<element name="C_Inv_B1" dataType="number" value="C_Inv_B1"/>
<element name="C_Inv_B2" dataType="number" value="C_Inv_B2"/>
<element name="C_Inv_B3" dataType="number" value="C_Inv_B3"/>
<element name="C_Inv_B4" dataType="number" value="C_Inv_B4"/>
<element name="C_Inv_B5" dataType="number" value="C_Inv_B5"/>
<element name="C_Inv_B6" dataType="number" value="C_Inv_B6"/>
</group>
</group>
</group>
</group>
</group>
...All of these groups and sub-groups are based on one single query, so I am not sure how I would move the function call into the query without changing the results of the function.
In the example above, elements Sum_Percent_B0_Inv through Sum_Percent_B6_Inv grab the results of the calculation done in set_percent_inv_invformula. Here is the essence of that function:
sum_percent_b0_inv := ROUND ((total_inv_inv_b0 / total_inv_inv_amt) * 100, 2);
sum_percent_b1_inv := ROUND ((total_inv_inv_b1 / total_inv_inv_amt) * 100, 2);
sum_percent_b2_inv := ROUND ((total_inv_inv_b2 / total_inv_inv_amt) * 100, 2);
sum_percent_b3_inv := ROUND ((total_inv_inv_b3 / total_inv_inv_amt) * 100, 2);
sum_percent_b4_inv := ROUND ((total_inv_inv_b4 / total_inv_inv_amt) * 100, 2);
sum_percent_b5_inv := ROUND ((total_inv_inv_b5 / total_inv_inv_amt) * 100, 2);
sum_percent_b6_inv := ROUND ((total_inv_inv_b6 / total_inv_inv_amt) * 100, 2);The only solution I can think of is to have separate queries, one for each subgroup, that do the "sum" in sql; but that seems terribly inefficient. -
Calling PL/SQL Functions And Open Oracle Reports From ADF Application
Hi all,
My company will convert some projects from Oracle forms to Oracle ADF so, we need to call the PL/SQL functions and open the Oracle Reports (which are already exist) from ADF Application.
Thank You..
Jack.NHi Jack.N,
calling PL/SQL Functions -----> http://sameh-nassar.blogspot.com/2010/01/create-plsql-function-and-call-it-from.html
Open Oracle Reports ---------> http://radio-weblogs.com/0137094/2008/06/15.html
You will find The Integration between ADF and other systems in ---> http://wiki.oracle.com/page/ADF+Integration
Sameh Nassar -
How to call PL/SQL function in processRequest
Hi,
I am trying to execute a function called xxhr_trg_evaluation_pkg.xx_get_class_desc(1);
how i can execute the above function inside the processRequest and pass the return value into a String variable.
Thanks in advance
Regards....AshrafAshraf,
The following code will help you how to call function or procedure in processRequest.
processRequest Code:
public void processRequest(OAPageContext pageContext, OAWebBean webBean){
OAApplicationModule oaam = pageContext.getApplicationModule(webBean);
OADBTransaction dbtrans;
OADBTransaction txn = (OADBTransaction)oaam.getOADBTransaction();
//statement which have similar execute statement like pl/sql in toad
CallableStatement cs =txn.createCallableStatement("begin :1:=xxhr_trg_evaluation_pkg.xx_get_class_desc(:2);end;",0);
//variable going to hold the return value
String outputVal="";
//pass input value to the callable statement
try{
cs.setString(2,1+"");
catch(Exception e){
try{
cs.execute();
outputVal=cs.getString(1);
catch(Exception e){
try{
cs.close();
catch(Exception e){
//if have done any update/insert/etc means do the commit from here also else you haven't given commit in the function by using the following syntax
dbtrans.commit();
Thanks,
SAN -
Call External C++ function and pass XML
Hi,
I need to call external C++ function from Oracle and pass to it XML file from Oracle table? Can you give short guide how to do it?
RegardsYour question sounds like is about using an Oracle database (or other application), and not about C++ programming or the using the C++ compiler. You are more likely to find a helpful answer in an Oracle database (or other application) forum.
-
How to call PL/SQL function inside column in entity
Hello,
How can I do next:
- Crete entity from existing table in database, but one column in the table gets value from function. Function is written in oracle PL/SQL language and it is located inside some package on database.
Application should run LCDS3 and tomcat.
All help is appricitatedAnil,
I'm using LCDS3, and here is what I trying to do (for example):
- I have on Oracle DB table REGION, with columns: Code, State, Population.
- I want to create entity that contains same columns as table REGION (Code, State, Population) and to have addition column RegionName witch get value from PL/SQL function (loacated in package "common" on DB) "common.fgetRegionName(Code)".
Can you explain me how to create that entity.
Thanks
Almir -
How to call PL/SQL function from php
I have one function define in package,like below
>>
create or replace package body Intg$Label_DB as
Future constant date := to_date ('21990101', 'YYYYMMDD');
Max_Annotation_Len integer := 3995;
function Get_Tagged_Label (Product_Name varchar2,Branch_Name varchar2, Platform_Name varchar2, Schema_Name varchar2) return varchar2 is
Series_Id integer := Get_Series (Product_Name,Branch_Name,Platform_Name);
Schema_Id integer := Get_Schema (Schema_Name);
Dep_Label_Id integer;
Next_Dep_Label_Id integer;
Result_Id integer;
Result Intg$Labels.Name%type;
begin
select SLT.Dep_Label_Id, SLT.Next_Dep_Label_Id into Dep_Label_Id, Next_Dep_Label_Id
from Intg$Series_Label_Tags SLT
where SLT.Series_Id = Get_Tagged_Label.Series_Id and SLT.Schema_Id = Get_Tagged_Label.Schema_Id;
Result_Id := Next_Dep_Label_Id;
if Result_Id = -1 then
Result_Id := Dep_Label_Id;
end if;
select L.Name into Result from Intg$Labels L where L.Id = Result_Id;
return Result;
exception
when NO_DATA_FOUND then
return '';
end Get_Tagged_Label;
>>
i want to call Get_Tagged_Label() from php and print the output,I tried below code but seems i am missing lots of things here.Any help will be appreciate.
$sql = 'BEGIN INTG$Label_DB.Get_Tagged_Labell(:Product_Name,:Branch_name,:Platform_Name,:message,:message_1,:message_2); END;';
$stmt = oci_parse($conn,$sql) or die ('Can not parse query') ;
// Bind the input parameter
oci_bind_by_name($stmt,':Product_Name',$name,32);
oci_bind_by_name($stmt,':Branch_name',$branch,32);
oci_bind_by_name($stmt,':Platform_Name',$pt,32);
// Bind the output parameter
oci_bind_by_name($stmt,':message',$message,32);
oci_bind_by_name($stmt,':message_1',$message_1,32);
oci_bind_by_name($stmt,':message_2',$message_2,32);
// Assign a value to the input
$name = 'PCBPEL';
$branch ='MAIN';
$pt ='GENERIC';
oci_execute($stmt);
Thanks
HridyeshWhat errors are you getting?
It's always helpful to know the version of PHP and the database.
When calling a function, you'll need a bind variable to hold the return value, and make sure the number of parameters match:
$sql = 'BEGIN :rv := INTG$Label_DB.Get_Tagged_Labell(:Product_Name,:Branch_name,:Platform_Name,:message); END;';
This new variable will need to bound with oci_bind_by_name()
Have you looked at my free Underground PHP and Oracle Manual at http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf ? Or any one of the other fine PHP-Oracle books available? -
How to call PL/SQL function from ODBC
Greetings (and thanks for reading),
I am using Oracle 9i (9.2.0.4) database, running on SUN [sparc] Solaris 9. I have created the following types:
create or replace type NAME_VAL_TYP is object
(NAME varchar2(30)
,VALUE varchar2(30))
create or replace type PARMS_VARRAY_TYP is varray(10) of
NAME_VAL_TYP
/and the following PL/SQL function:
function F0 (P_PARAMS PARMS_VARRAY_TYP) return numberHow do I call this function from ODBC?
Thanks (in advance),
Avi.Sorry, this is not mapped in the ODBC driver--none of the object types are. The spec doesn't really account for them.
-
How to call PL/SQL function from JSP ?
We have the JSP application developed using the JDeveloper 3.0. I am trying to call the PL/SQL DB function. I'm trying to use the method of ApplicationModule:
.getTransaction().executeCommand(sCommand)
The problem is that I can not get the function result back to JSP. The executeCommand() does not seem to accept any host variables.
What to do ? Did anyone manage to get the feedback from DB ?
Here is the code in the JSP page:
<%! String res=" ";%>
<jsp:useBean id="rsn"
class="oracle.jbo.html.databeans.TRSRowSetNavigator"
scope="request" >
<%
rsn.initialize(application,session, request,response,
out,"theIMO_trs_bc4J_Bc4JModule.AuctionsListView");
rsn.setReleaseApplicationResources(true);
// this is the ID to be copied
String copy_id = request.getParameter(TRS.LOOK_UP_PK_FIELD);
if( copy_id != null) {
// call the PL/SQL procedure to create copy of this auction
String sCommand = "DECLARE a NUMBER; BEGIN :res:=Copy_Auction("
copy_id"); END;";
rsn.getRowSet().getApplicationModule().getTransaction().executeCommand(sCommand);
rsn.getRowSet().getApplicationModule().getTransaction().commit();
I receive the following error:
Error Message: JBO-27121: SQL error during statement execution. Statement: DECLARE a NUMBER; BEGIN :res:=Copy_Auction(45); END;
JBO Error:JBO-27121: SQL error during statement execution. Statement: DECLARE a NUMBER; BEGIN :res:=Copy_Auction(45); END;: ORA-01008: not all variables bound
What criteria has the host variable meet to be used in the executeCommand(sCommand) method ?
Thanks,
Michael
nullI could be wrong there, but I have experienced similar problem on tru64 unix, with sticky bit not in place for the following files: $ORACLE_HOME/bin/oracle and $ORACLE_HOME/bin/oracleO. Once you restore those files via tar command (this is what happened to me), the sticky bit disappears, and you have to re-introduce it by issuing unix command: chmod 1777 on those files.
What it does for you - it allows you to execute the sql statements as an oracle user & group!
Otherwise, if this bit is lost, whenever you try to connect to sqlplus via user / password it hits you back with:
ORA-01034 ORACLE not available
ORA-27121 unable to determine size of shared memory segment
Compaq Tru64 UNIX Error: 13:Permission denied
This should not be a problem if you try and execute the same sql statements using listener (connecting to the server by using @ statement).
I could be late in response to you, but maybe not for other people. -
How to call pl/sql function from oaf
Dear Friends,
I am trying to call a function from oaf page .but iam getting error like
java.sql.SQLException: ORA-01861: literal does not match format string
ORA-06512: at line 1
THis is my function ,,callable statement
FUNCTION CAR_LOAN_VALIDATION(P_PERSON_ID IN NUMBER
,P_DEDUCTION_START_DATE IN DATE
,P_DEDUCTION_END_DATE IN DATE
,P_LOAN_VALUE IN NUMBER
RETURN VARCHAR2
IS
l_message VARCHAR2(100);
l_contract_type VARCHAR2(50);
l_loan_eligible_date DATE;
l_grade VARCHAR2(15);
l_old_loan_end_date DATE;
l_max_loan_end_date DATE;
l_remaining_amount NUMBER;
l_eligible_amt NUMBER;
BEGIN
BEGIN
SELECT --papf.person_id,
(SELECT meaning
FROM hr_lookups
WHERE lookup_type = 'ADTC_CONTRACT_TYPE'
AND lookup_code = attribute3) contract_type,
ADD_MONTHS (papf.original_date_of_hire, 11) loan_eligible_date,
DECODE (paaf.ass_attribute2,
'Chairman', 'Chairman',
SUBSTR (ass_attribute2, INSTR (ass_attribute2, '.', 1, 1) + 1,
3)
) grade,
(SELECT nvl(MAX (deduction_end_date),null)
FROM xxadtc_car_loan_request
WHERE person_id = p_person_id) old_loan_end_date,
to_date(ADD_MONTHS (p_deduction_start_date, 47)) max_loan_end_date
--to_date(ADD_MONTHS (sysdate, 47)) max_loan_end_date
INTO l_contract_type
,l_loan_eligible_date
,l_grade
,l_old_loan_end_date
,l_max_loan_end_date
FROM per_all_people_f papf, per_all_assignments_f paaf
WHERE SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
AND papf.business_group_id = 81
AND papf.person_id = paaf.person_id
AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND papf.person_id =P_PERSON_ID;
EXCEPTION
WHEN others THEN
DBMS_OUTPUT.PUT_LINE('Error ');
END;
-- get Previous Car loan amount --
BEGIN
SELECT to_number(prrv.result_value)
INTO l_remaining_amount
FROM per_all_people_f papf,
per_all_assignments_f paaf,
pay_assignment_actions pac,
pay_run_results prr,
pay_run_result_values prrv,
pay_element_types_f petf,
pay_input_values_f pivf,
pay_element_classifications pec,
pay_payroll_actions ppa,
per_time_periods ptp
WHERE SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
AND papf.person_id = paaf.person_id
AND papf.business_group_id = 81
AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND paaf.assignment_id = pac.assignment_id
AND pac.assignment_action_id = prr.assignment_action_id
AND prr.run_result_id = prrv.run_result_id
AND prr.element_type_id = petf.element_type_id
AND SYSDATE BETWEEN petf.effective_start_date AND petf.effective_end_date
AND prrv.input_value_id = pivf.input_value_id
AND SYSDATE BETWEEN pivf.effective_start_date AND pivf.effective_end_date
AND pivf.NAME = 'Remaining Amount'
AND petf.classification_id = pec.classification_id
AND pac.payroll_action_id = ppa.payroll_action_id
AND ppa.time_period_id = ptp.time_period_id
AND TO_CHAR (ptp.pay_advice_date, 'Mon-YYYY') =
TO_CHAR (SYSDATE, 'Mon-YYYY')
AND petf.element_name = 'Motar Ahlami Loan'
--and employee_number='10185'
AND papf.person_id = p_person_id;
EXCEPTION
WHEN no_data_found THEN
--DBMS_OUTPUT.PUT_LINE('ERROR: No data!');
l_remaining_amount:=0;
WHEN others THEN
DBMS_OUTPUT.PUT_LINE('Error ');
END;
select GET_CAR_LOAN_ELIGI_AMT(P_PERSON_ID)
into l_eligible_amt
from dual;
IF l_contract_type NOT IN ('Permanent') THEN
l_message := 'Contract Type Is not valid';
END IF;
IF l_loan_eligible_date < SYSDATE THEN
l_message:= 'Date of Join is less then one year';
END IF;
IF l_grade IN ('US','00','AUS','EM') THEN
l_message:= 'Your are not Eligible Grade';
END IF;
IF l_old_loan_end_date < SYSDATE THEN
l_message:= 'Previous Loan Duration is not completed';
END IF;
IF l_max_loan_end_date > P_DEDUCTION_END_DATE THEN
l_message:= 'Maxinum number of monthly payment of 48 month';
END IF;
IF l_remaining_amount >0 THEN
l_message:= 'Previous Car Loan amount is pending till';
END IF;
IF l_eligible_amt < p_loan_value THEN
l_message:= 'Please check Eligible Amount ';
END IF;
RETURN nvl(l_message,'S');
EXCEPTION
WHEN NO_DATA_FOUND
THEN
RETURN 'Error';
END CAR_LOAN_VALIDATION;
END XX_CAR_LOAN_REQUEST_PKG;
CALLABLE STATEMENT CODE ---CO CODE
if(pageContext.getParameter("Submit")!=null) {
OAViewObject vo2 = (OAViewObject)am.findViewObject("XxadtcCarLoanRequestEOVO1");
if(vo1!=null){
vo1.getCurrentRow().setAttribute("LoanStatus","Pending Approval");
int xxpersonId = pageContext.getEmployeeId();
String xxDeductionStartDate = vo2.getCurrentRow().getAttribute("DeductionStartDate").toString();//pageContext.getParameter("DeductionStartDate").toString();
// SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy/mm/dd");
// Date convertedDate1 = dateFormat1.parse("xxDeductionStartDate");
String xxDeductionEndDate = vo2.getCurrentRow().getAttribute("DeductionEndDate").toString();//pageContext.getParameter("DeductionEndDate").toString();
// SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy/mm/dd");
// Date convertedDate2 = dateFormat2.parse("xxDeductionEndDate");
String xxLoanValue = vo2.getCurrentRow().getAttribute("LoanValue").toString();//pageContext.getParameter("LoanValue").toString();
int iLoanValue = Integer.parseInt(xxLoanValue);
System.out.println("Entered into submit loop");
System.out.println("xxpersonId id is:"+xxpersonId);
System.out.println("xxDeductionStartDate id is:"+xxDeductionStartDate);
System.out.println("xxDeductionEndDate id is:"+xxDeductionEndDate);
System.out.println("xxLoanValue id is:"+xxLoanValue);
OADBTransaction txn = am.getOADBTransaction();
String sql ="BEGIN :1 :=XXADTC_CAR_LOAN_REQUEST_PKG.CAR_LOAN_VALIDATION(:2,:3,:4,:5); END;";
CallableStatement cs = txn.createCallableStatement(sql,1);
String outputval = null;// int outputval = 0;
try {
System.out.println("Entered in try loop of callable funtion validation");
cs.setInt(2,xxpersonId);
System.out.println("cs setInt(2,xxpersonId);is executed");
cs.setString(3,xxDeductionStartDate);
System.out.println("cs.setString(3,xxDeductionStartDate is executed);");
cs.setString(4,xxDeductionEndDate);
System.out.println("cs.setString(4,xxDeductionEndDate is executed);");
// cs.setDate(3,xxDeductionStartDate);
// cs.setDate(4,xxDeductionEndDate);
cs.setInt(5,iLoanValue);
cs.registerOutParameter(1,Types.VARCHAR);// cs.registerOutParameter(1,Types.NUMERIC);
cs.execute();
outputval = cs.getString(1);// txn.commit();
System.out.println(outputval);
txn.commit();
if(outputval.equals("S"))
am.invokeMethod("apply");
else
throw new OAException("Organization name is:"+outputval,OAException.INFORMATION);
txn.commit();
catch(Exception sqle){
try {
cs.close();
catch (Exception e)
throw OAException.wrapperException(e);
throw OAException.wrapperException(sqle);
Please help .where is the error is.
please help
let me know for any clarification.
Thanks
Aravinda.Hi Arvinda,
Refer Below code.
// In Controller
java.sql.Date DeductionSDate; //declare variable
//In PFR
String xxDeductionStartDate = vo2.getCurrentRow().getAttribute("DeductionStartDate");
OADBTransaction txn = am.getOADBTransaction();
if(xxDeductionStartDate!=null)
java.sql.Date startDate= txn.getOANLSServices().stringToDate(xxDeductionStartDate);
DeductionSDate = startDate;
Set this to cs.setDate(3,DeductionSDate);
Thanks,
Dilip -
How to call a Stored Function with OUT parameter of %rowType from Java
Hi everyone,
I'm getting crazy trying to make this work.
I have a function (not developed by me) in Oracle 10g declared in this way:
type tab_RLSSP is table of TB_RLSSP_STOSTPRPAR_CL%ROWTYPE index by binary_integer;
FUNCTION DBF_PERL_LISTA_PRATICHE (
p_id_va IN NUMBER,
p_seq_partita IN NUMBER,
p_trattamento IN CHAR,
lrec_RLSSP OUT tab_RLSSP ) RETURN NUMBER;
And here is the code snipplet of my java method:
sql="{? = call "+SCHEMA+PACKAGE+"."+FUNCTION_LIST+"(?,?,?,?)}";
cs=connection.prepareCall(sql);
cs.registerOutParameter(1, OracleTypes.NUMBER);
cs.setLong(2,idVATitolare);
cs.setLong(3,seqPartita);
cs.setString(4,trattamento);// Caso Decesso
cs.registerOutParameter(5, OracleTypes.OTHER);
cs.executeQuery();
result = (ResultSet) cs.getObject(5);
if (result.next())
listaPratiche.add(readPraticaPartita(result));
The result (exception thrown at executeQuery with statement generated as
SQL : {? = call PEDBA.DBK_PERL_RATEI_SUPPLETIVI.DBF_PERL_LISTA_PRATICHE(?,?,?,?)}:
java.sql.SQLException: ORA-06550: line 1, column 13:
PLS-00306: wrong number or types of arguments in call to 'DBF_PERL_LISTA_PRATICHE'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Changing to :
sql="{call ? := "+SCHEMA+PACKAGE+"."+FUNCTION_LISTA+"(?,?,?,?)}";
leading to
SQL : {call ? := call PEDBA.DBK_PERL_RATEI_SUPPLETIVI.DBF_PERL_LISTA_PRATICHE(?,?,?,?)}
don't change anything.
What's wrong? Any suggestion?
Edited by: 957158 on 5-set-2012 9.06>
Taking for granted that it works, I wonder what's different, probably the output is defined as Cursor...
>
You mean because of this line?
cs.registerOutParameter(5,OracleTypes.CURSOR);You can either use a cursor or use a function that returns a SQL type instead of the PL/SQL type.
Here is sample code using a cursor
CREATE OR REPLACE TYPE SCOTT.local_type IS OBJECT (
empno NUMBER(4),
ename VARCHAR2(10));
CREATE OR REPLACE TYPE SCOTT.local_tab_type IS TABLE OF local_type;
CREATE OR REPLACE PACKAGE SCOTT.test_refcursor_pkg
AS
TYPE my_ref_cursor IS REF CURSOR;
-- add more cursors as OUT parameters
PROCEDURE test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor);
END test_refcursor_pkg;
CREATE OR REPLACE PACKAGE BODY SCOTT.test_refcursor_pkg
AS
PROCEDURE test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor)
AS
l_recs local_tab_type;
BEGIN
-- Get the records to modify individually.
SELECT local_type(empno, ename) BULK COLLECT INTO l_recs
FROM EMP;
-- Perform some complex calculation for each row.
FOR i IN l_recs.FIRST .. l_recs.LAST
LOOP
DBMS_OUTPUT.PUT_LINE(l_recs(i).ename);
END LOOP;
-- Put the modified records back into the ref cursor for output.
OPEN p_ref_cur_out FOR
SELECT * from TABLE(l_recs);
-- open more ref cursors here before returning
END test_proc;
END;
SET SERVEROUTPUT ON SIZE 1000000
DECLARE
l_cursor test_refcursor_pkg.my_ref_cursor;
l_ename emp.ename%TYPE;
l_empno emp.empno%TYPE;
BEGIN
test_refcursor_pkg.test_proc (l_cursor);
LOOP
FETCH l_cursor
INTO l_empno, l_ename;
EXIT WHEN l_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(l_ename || ' | ' || l_empno);
END LOOP;
CLOSE l_cursor;
END;
/ -
How to call pl/sql procedure/function from XML
Hi,
I have a requirement to call pl/sql function/procedure from the RTF template. How can I do this?Hi,
I have got the same requirement. We need to call the store PL/SQL procedure from the XML template to generate the fixedwidth files. Could you tell me if you are able to call PL/SQL procedure from XML template?
Thanks,
Ram -
How to call a sql server stored procedure from oracle
Hi all,
Please anybody tell me how to call a sql server stored procedure from oracle.
I've made an hsodbc connection and i can do insert, update, fetch data in sql server from oracle. But calling SP gives error. when I tried an SP at oracle that has line like
"dbo"."CreateReceipt"@hsa
where CreateReceipt is the SP of sql server and hsa is the DSN, it gives the error that "dbo"."CreateReceipt" should be declared.
my database version is 10g
Please help me how can i call it... I need to pass some parameters too to the SP
thanking youhi,
thank you for the response.
when i call the sp using DBMS_HS_PASSTHROUGH, without parameters it works successfully, but with parameters it gives the following error
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Generic Connectivity Using ODBC][Microsoft][ODBC SQL Server Driver]Invalid parameter number[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index (SQL State: S1093; SQL Code: 0)
my code is,
declare
c INTEGER;
nr INTEGER;
begin
c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@hsa;
DBMS_HS_PASSTHROUGH.PARSE@hsa(c, 'Create_Receipt(?,?)');
DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,1,'abc');
DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,2,'xyz');
nr:=DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@hsa(c);
DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@hsa(c);
end;
Create_Receipt is the sp which requires two parameters.
please give me a solution
thanking you
sreejith
Maybe you are looking for
-
Mail . I want to delete multiple mails ( not simply a thread of mails , but a larger selection) from the "Sent " file , but it looks like you can only do it one at a time .....is that correct , or am I missing something ? Message was edited by: alanf
-
How do i set a homepage in safari on ipad
I clicked on the left arrow at the top as suggested but all I got was instructions for firefox. I am using explorer
-
Ipad screen crack need actual cost, ipad screen crack need actual cost
can some one tell me what is actual price of exchanging my cracked screen ipad ???
-
Cancelling Inspection Lots - In Process Lots 03 origin
Hi, I have recently deployed the QM module of ECC 6 to interact with a LIMS system via QM-IDI interface as part of an overall ECC 6 implementation. I generate inspection lots in the following scenarios: 1. Goods Receipt from Purchase Orders 2. In pro
-
Seeburger destDelimiter parameter.
Hi All, In AS2 Sender Channel for Module Key BIC we provide Parameter name as destDelimiter. It says -- This should be 6 characters which represent the following separators from the EDI or flat file. subfield, field, decimal, quoting, fieldgroup, seg