Calling a SQL function which has Out parameters
Hello people,I don't know if it's feasible, but here's my scenrio at hand. I have a database function that accepts a few parameters AND OUTPUT parameters. I want one Out to display in my select statement parameters. Is this possible?
Thank you
No you can not use a function with out parameters in sql statements.
If possible do the function of this return value, use it in select. (imean instead of the parameter, OUT out which parameter through the BACK)
G.
Tags: Database
Similar Questions
-
Calling a SQL function to send all page
In an APEX application, is it possible to call a SQL function so that the application be submitted instead of 'action SQL INSERT'. This function takes 2 parameters user entering the page of the application.
Send page has essentially two text fields and a "submit" button
Version and Patch Info
The SQl function has 2 parameters like this, start_new_env (oracleversion IN VARCHAR2, opatchinfo IN CLOB)
Any help will be much appreciated.
Thank you
Published by: Rajesh on November 17, 2009 08:49Please mark it as answered and mark it as correct...
Thank you -
I need to call the following function in a C DLL:
__declspec (dllexport) int MSIL_EnumSpectrometers (SPECTROMETER_ID * spectrometers);
where the only parameter is a pointer to:
typedef struct
{
tank model [32];
series char [32];
Channel int;
} SPECTROMETER_ID;Before LabVIEW 2011 I would use a CIN allocate the memory and call the function, but in LabVIEW 2011, the INC has been deleted and I have to use a library function node call instead. When I go to set the parameter, it seems that I need to set the type to "Adapt to the Type" and data for 'Pointer to data in table' Format, then pass an initialized array of SPECTROMETER_ID with the many elements he so the DLL can fill the table with data. (See the attached picture.) When I do that, however, it blocks LabVIEW desktop. I guess it is because the DLL is corrupting the memory space of LabVIEW, but I don't see why, because I'm basically passing in a void pointer to an array initialized in the right size. Note that the first node of NSI returns the number of elements required in the table. Anyone have any idea what I'm doing wrong here?
In LabVIEW, when a table is in a cluster - cluster don't detain actually table but sort of a pointer that points to the table. If you need the cluster to contain 32 to 32 Add to the cluster. See the VI attached to how it's supposed to be done.
-
Calling a procedure with IN and OUT parameters
Hello
I usually call my procedures using the following
declare the variable msg_erreur varchar2 (50)
exec simple_msg('ABC,'ABC','ABC',:error_msg);
CREATE OR REPLACE PROCEDURE SIMPLE_MSG)
ID IN VARCHAR2,
URL IN VARCHAR2,
THE LIST IN VARCHAR2,
MSG_ERREUR OUT VARCHAR2
*************************************************************
Now my question is, I try to call a proc that has IN OUT parameters. Can someone guide me on how to call the d.a. thanks
CREATE OR REPLACE PROCEDURE SIMPLE_MSG)
ID IN VARCHAR2,
URL IN VARCHAR2,
THE LIST IN VARCHAR2,
NAME IN VARCHAR OUT,
MSG_ERREUR OUT VARCHAR2Hello
OUTSIDE of the parameters are passed as OUT was: you must pass a variable.
If you set the IN OUT parameter before calling the procedure, and then either
(a) use the separate EXEC command:EXEC :name := 'Original name'; EXEC simple_msg ('ABC', 'ABC', 'ABC', :name, :error_msg);
or
(b) use a PL/SQL anonymous block, like this:
BEGIN :name := 'Original name'; simple_msg ('ABC', 'ABC', 'ABC', :name, :error_msg); END; /
The parameter can be either a variable binding (as illustrated above), or a local variable (which may only be used in the block).
-
How to call PL/SQL function processRequest
Hello
I'm trying to run a function called xxhr_trg_evaluation_pkg.xx_get_class_desc (1);
How can I run the above inside the processRequest function and pass the value returned in a variable string.
Thanks in advance
Kind regards... AshrafAshraf,
The following code will help you how to call the function or procedure in processRequest.
processRequest Code:
{} public processRequest Sub (pageContext OAPageContext, OAWebBean webBean)
Oaam = pageContext.getApplicationModule (webBean) OAApplicationModule;
OADBTransaction dbtrans;
TXN OADBTransaction = (OADBTransaction) oaam.getOADBTransaction ();statement that even execute the statement as pl/sql in Toad
= Txn.createCallableStatement cs CallableStatement ("start: 1: = xxhr_trg_evaluation_pkg.xx_get_class_desc (: 2); end;", 0);variable will contain the return value
String outputVal ="";pass the value of the entry 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) {}
}
Did all the insert/update/etc means do validation of here too but you did not engage in the service by using the following syntax
dbtrans.Commit ();}
Thank you
SAN -
Problem when calling a return function of SQL BOOLEAN in package type
Hi all
I'm having a problem when you try to call a SQL function in a package with the return BOOLEAN type
The SQL function signature is
####
CREATE OR REPLACE PACKAGE RMSOWNER. ORDER_ATTRIB_SQL *.
FUNCTION GET_PO_TYPE_DESC (O_error_message IN OUT VARCHAR2,
I_PO_TYPE IN VARCHAR2,
O_PO_TYPE_DESC IN OUT VARCHAR2)
RETURN A BOOLEAN VALUE;
####
Here is my java code
####
+ Cs3 CallableStatement = conn.prepareCall ("{?}") = call ORDER_ATTRIB_SQL. GET_PO_TYPE_DESC(?,?,?)} ");" +
+ CS3.registerOutParameter (1, java.sql.Types.BOOLEAN) +;
+ CS3.registerOutParameter (2, java.sql.Types.VARCHAR) +;
+ CS3.registerOutParameter (4, java.sql.Types.VARCHAR) +;
+ CS3. SetString (2, ""); +
+ CS3. SetString (3, "ST"); +
+ CS3. SetString (4, ""); +
+ ResultSet rs3 = cs3.executeQuery (); +
####
I get the following exception, I tried to change the (registerOutParameter) boolean sql type bit, but I've always found this exception.
But when I call all other functions with a return type other than boolean, they work perfectly well.
Please can someone help me solve this problem, I don't know if its something to do with classes of JDBC providers?
#####
+ java.sql.SQLException: ORA-06550: line 1, column 13: +.
+ PLS-00382: expression is of the wrong type.
+ ORA-06550: line 1, column 7: +.
+ PL/SQL: statement ignored +.
+ oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) +.
+ oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) +.
+ oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288) +.
+ oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743) +.
+ oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215) +.
+ oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:954) +.
+ oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168) +.
+ oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316) +.
+ oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3422) +.
+ oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394) +.
#####Looks like it's a Limitation of the jdbc drivers. Please visit the following link:
http://www-Camden.Rutgers.edu/help/documentation/Oracle/Java.815/a64684/typesup1.htmHere is an excerpt from above:
==========================================================
PL/SQL BOOLEAN, RECORD and the Types of TABLES of packingOracle JDBC drivers support the argument of appeal or return values of PL/SQL TABLE types (now known as indexed arrays by), REGISTRATION or BOOLEAN.
To work around the problem, you can create wrapper procedures that manage data like types supported by JDBC. For example, to wrap a stored procedure that uses PL/SQL Boolean values, you can create a stored procedure that takes a character or a number of JDBC and passes to the original procedure as BOOLEAN or, for an output parameter, accepts a BOOLEAN of the original procedure argument and pass it as a TANK or a NUMBER to JDBC. Similarly, to wrap a stored procedure that uses PL/SQL records, you can create a stored procedure that maintains a record in its individual components (such as CHAR and NUMBER). To wrap a stored procedure that uses PL/SQL tables, you can divide the data into components or perhaps use Oracle collection types.
-
PL/SQL function to calculate the non-working days
Hello
I have the following pl/sql function which generates a number of days between two selected dates (i.e. excluding weekends). However, I also need to exclude specific holidays - day of Christmas etc. These holiday dates are stored in a table in our database (11 GR 2) called "HOLIDAY".
How can I integrate the holidays which is held in the table of holidays in the following query to exclude these dates as well? I know how to write a separate funtion pl/sql for a number of days between two dates using SELECT... BUT I can't work out how to bring together them in a single query.
Could someone show me how with the pl/sql / dates below please?
Example of HOLIDAY table below.
Thank you!
TP
create or replace function WORKING_DAYS (pi_start_date in date, pi_end_date in date) return integer is v_start_date date :=pi_start_date; v_end_date date:=pi_end_date; v_count integer:=0; begin while v_start_date <= v_end_date loop if to_char(v_start_date,'D') not in ('6','7') then v_count := v_count+1; end if; v_start_date:=v_start_date+1; end loop; return v_count; end;
(select '10-Apr-2013' as NWD from dual union all select '06-May-2013' from dual union all select '27-May-2013' from dual union all select '26-Aug-2013' from dual union all select '26-Dec-2013' from dual union all select '25-Dec-2013' from dual union all select '01-Jan-2014' from dual union all select '18-Apr-2014' from dual union all select '21-Apr-2014' from dual union all select '05-May-2014' from dual union all select '26-May-2014' from dual union all select '25-Aug-2014' from dual union all select '25-Dec-2014' from dual union all select '26-Dec-2014' from dual) HOLIDAYS
Hello
the link is on MOSC, not OTN... Here's a copy:
This function calculates the number of days between two dates, ignoring weekends and holidays (if requested and if the holidays are stored in a table)
I give an example of table 'public_holiday' with sample data, but users must ensure that their table contains the relevant data (all holidays within the maximum range of use of the service)
CREATE TABLE public_holiday (calendar_day, DATE, text VARCHAR2 (30));
FUNCTION to CREATE or REPLACE nb_days (p_date_from IN DATE
p_date_to DATE by DEFAULT TRUNC (sysdate)
, p_public_holidays in CHAR DEFAULT 'Y '.
) RETURN NUMBER
DEFINE AUTHID
AS
/*********************************************************************/
/ * Author: Bruno Vroman * /.
/ * Created: 23-AUG-2012 * /.
/ * Last updated: 23-AUG-2012 * /.
/ * Object: to calculate the number of days between 2 dates, to the exclusion of * /.
/ * Saturday and Sunday, but also "holidays" If the * /.
/ * argument 'p_public_holidays' = 'Y ' * /.
/ * Support: p_date_from<= p_date_to ="">=>
/ * component ' hour min dry "ignored (just counting days) * /.
/* First step: */
/ * the calendar days between 2 days * /.
/ Remove 2 days for each "week" and 0 or 1 extra day * /.
/ * function to a condition "complex" mix day of first week * /.
/ * and the number of days when full remaining weeks are removed * /.
/ * (set up once for all, for example if there is 3 days and the * /)
(/ * first day is a Thursday, there is 1 "Sat/Sun" to subtract) * /.
/ * Second step: If 'p_public_holidays' = 'Y': other * /.
/ * days, do not count holidays. */
/ Holiday everyday are defined in a table "public_holiday" * /.
/ * Note: there may be holidays defined on Saturday/Sunday. */
/*********************************************************************/
l_result NUMBER;
l_from DATE;
l_to DATE;
l_case tank (4);
BEGIN
l_from: = TRUNC (p_date_from);
l_to: = TRUNC (p_date_to);
l_case: = TO_CHAR (l_from, 'Dy', 'NLS_DATE_LANGUAGE = English').
To_char (MOD (l_to - l_from + 1, 7));
l_result: = l_to - l_from + 1
-TRUNC ((l_to-l_from + 1) / 7) * 2
-CASE
WHEN l_case IN ('Mon6', 'Tue5', 'Wed4', 'Thu3', 'Fri2'
, "Sat1", "Sun1", "Sun2', 'Sun3", "Sun4".
, "Sun5', 'Sun6.
)
THEN 1
WHEN l_case IN ('Tue6', 'Wed5', 'Wed6', 'Thu4', "Thu5"
, 'Thu6', 'Fri3', 'Fri4', 'Fri5', 'Fri6 '.
, "Sat2", "Sat3', 'Sat4', 'Sat5", "Sat6.
)
THEN 2
0 OTHERWISE
END
;
IF SUPERIOR (p_public_holidays) = "Y".
THEN
SELECT l_result - COUNT (*)
IN l_result
OF public_holiday p
WHERE p.calendar_day > = l_from
AND p.calendar_day<=>=>
AND SUBSTR (TO_CHAR (p.calendar_day
, "Dy".
'NLS_DATE_LANGUAGE = English'
)
, 1, 1 ) != 'S'
;
END IF;
RETURN l_result;
EXCEPTION
WHILE OTHERS
THEN
DBMS_OUTPUT. Put_line (' CTF nb_days (' |))
To_char (p_date_from, "MON-DD-YYYY"). ', ' ||
To_char (p_date_to, "MON-DD-YYYY"). ', ' ||
p_public_holidays | ' ) : ' || SQLERRM
);
LIFT;
END nb_days;
/
REM
REM example:
REM A) fill out the 'public_holidays '.
REM
TRUNCATE TABLE public_holiday;
INSERT INTO public_holiday VALUES (DATE ' 2012-01-01', ' new year (a Sunday)');
INSERT INTO public_holiday VALUES (DATE '' 2012-01-03, "for example");
REM (insert other days...)
COMMIT;
Call the function for some pairs of dates of REM B)
REM nb1: remove only Sat/Sun
REM nb2: also remove holidays
REM
ALTER SESSION SET nls_date_format ='Dy DD-MON-YY';
WITH some_dates AS
(SELECT DATE ' 2011-12-29'd dual FROM
UNION ALL SELECT DATE ' 2012-01-08' FROM dual
UNION ALL SELECT DATE ' 2012-01-10' FROM dual
)
SELECT d1.d 'FROM '.
, d2.d ' to THE '.
, nb_days (d1.d, d2.d, ' don't) nb1
, nb_days (d1.d, d2.d, 'Y') nb2
OF some_dates d1
some_dates d2
WHERE d1.d<=>=>
ORDER BY nb1, nb2, d1.d
;
GO TO NB1 NB2
------------- ------------- ---- ----
Monday, January 8, 12 Monday, January 8, 12 0 0
Friday, December 29, 11 Friday, December 29, 11 1 1
Wednesday, January 10, 12 Wednesday, January 10, 12 1 1
Monday, January 8, 12 Wednesday, January 10, 12 2 2
Friday, December 29, 11 Monday, January 8, 12 7 6
Friday, December 29, 11 Wednesday, January 10, 12 9 8
Hope that this could be useful, but note that this code has not been completely tested, so check and test before you trust it (in the case of any questions, please post a comment)
Bruno Vroman.
Best regards
Bruno
-
Hello
In a query XQuery is posssible to call a function or procedure SQL (PL / SQL)?
Here is an example of what I had accomplished:
SELECT THE PRD. XMLCOLUMN of
XMLTABLE (' for $i in ora: view("P_iXXX")/LINE)
$j in ora: view("P_jXXX")/LINE.
where
($i / NSU_xxx = $j/NSU_xxx)
return
(
< NCL >
{
$i / NSU_xxx,
H3. CALL the SQL function? as sql_xxx
for $k in ora: view("P_kxxx")/ROW
($vk/COD_RMP_VPM = "PRD")
Return()
}
< / NCL >
() "PATH of XMLType 'XMLCOLUMN' COLUMNS 'resultsqlfunction' INTEGER PATH 'xsql_xxx' INTEGER ACCESS to 'NSU_xxx' path 'NSU_xxx', '.') as the PRD;
Thanks in advance for your answers
FrançoisWho today replaces "ora: see?
On 11.2, ora expansion feature: view() is deprecated in favor of the fn:collection("oradb:/") method:
http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb_xquery.htm#BABECFFD
My DBA database have installed Oracle XML DB to use the XMLType and XMLTable, I thought that these features among other things speed up the creation of XML.
What are the benefits of using XQuery and XMLTable and XMLQUERY functions?
Which version of the database you use?
Please read: http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb_xquery.htm#CBAGCBGJ
Is there another method to expedite the creation of XML?
Publication of SQL/XML functions are probably the best way to create custom relational data XML documents.
The basic functionality of XQuery is not to the RDBMS query tables or views, although Oracle provides extensions to do.
Most of the time, I use XQuery (via XMLTable and XMLQuery) to do exactly the opposite, i.e. to extract XML data in a relational form, or the transformation of XML fragments.If your actual requests are slow - even if you need to define what that means and that you are pregnant - then maybe the SQL/XML functions are not the real problem.
In a "Where clause" as I turn, I have several "outer join". Here is an example.
where
PPM. NSU_PPM = w.NSU_PPM and FRNS. NSU_FRN (+) IS FCO. NSU_FRN and FCO. NSU_FCO (+) IS PPM. NSU_FCO
and T2O. NSQ_T2O (+) IS PPM. NSQ_T2O
and T51. NSQ_T51 (+) IS PPM. NSQ_T51
and TWU. NSU_STT (+) IS PPM. NSU_STT
and T01. NSQ_T01 (+) IS PPM. NSQ_T01
and vpm.cod_rmp_vpm (+) = "PRA".
and vpm.num_vsn_vpm (+) = PPM.vsn_sup
and w.nsu_ppm = A.nsu_ppm (+)
and W.NSU_SOO = A_HEADER. NSU_SOO and A_HEADER. NOR_SOM = 0Yes, it's exactly what I was talking about.
Transposing the logic for XQuery 1.0 is not the approach more simple (to say the least), because there is no direct support OUTER JOIN.
XQuery 3.0 provides the functionality, but it is not yet here in the database.My suggestion would be to stick to the publication of SQL/XML functions.
If you have a specific question about the performance, we (as the members of the forum) will be happy to help you.
Provides the steps necessary to reproduce the problem, including some examples of data.Kind regards
Marc.
-
Call the library function does not find the DLL in the directory where are my LLBs
I'm using LabVIEW 8.6. I have a set of screws in several LLBs. All LLBs located in a directory. Most of my screws is wrappers for the functions in a DLL. I was told to put my DLL in the directory where are the LLBs, and apparently this is how the previous programmer has worked (using an earlier version of LabView).
In the configuration of the library call, I've specified
.dll without path. (This is how we want our screws are an API that will integrate other programmers, so I don't know where they put things and I can't use absolute paths). When I insert the VIs in LabVIEW, LabVIEW can not find the DLL and wonder of spotted. It's just that here in the directory with the LLBs and when I double click on it, everything works fine. However my absolute path to the DLL now appears in the library to call configuration, and we don't want that.
Does anyone know how to make this work? I guess the location of the screw (or LLBs, in this case) should be the current directory and thus Windows search there for the DLL. However, it seems that this is not the case (in the least, in the latest version of LabVIEW).
Thank you.
Batya
Well someone using your library should not have to dig into your screws and do it all on his own. Instead your library must wrap that and hide disorders it altogether.
The cluster of error has been added when the dynamic path option has been added. It is not useful hide this error output, so it's always there. As well as the dynamic path, there was the improved error handling added the CLN. One of them is that the level of verification when calling function errors (exception handling) can be specified. I guess that some of these options may generate an error code instead of bring up a dialog box, as they did before and that the output of error code can be useful even in the case of static calls.
As to what you want to do, I would have long managed that with a DLL that has essentially the same functions as your other wrapper DLLs and an initiliasation function that returns a pointer to a structure of functional distribution based on the actual DLL you want to call. Quite like what an object-oriented function dispatch table is. Then, when your interface initilising you call initialize function and specify the device interface/type that you want to use and after that all other functions take a pointer extra function parameter expedition as the first parameter, in addition to the parameters of the real function. This dispatch function pointer would be just a pointer to a structure that contains the table of function for this interface pointers and the sake of LabVIEW would simply be an integer of size pointer.
The wrapper function then checks the pointer structure validity send feature and call the actual function with the remaining parameters. It is a C programming and may require a planning and desigining the different interfaces to facilitate this kind of technique of the expedition, but it will certainly pay to long-term and make your library even can be used in previous versions of LabVIEW, so that VB etc. without delicate dynamic loading in the level high, programming environment.
Rolf Kalbermatter
-
How can I call a function with parameter out of sql
Hello world
I'm calling a Sql statement function and I get this error ORA-06572: XX function has arguments.
can you offer any solution on this workaround.
Thank youHello
Sorry, you cannot call functions with OUT arguments (or arguments, but I'll just say in the future) SQL statements.
This is one of the reasons why many people avoid having arguments in functions.
THE arguments are never optional. If the function expected of them, you must pass to them.Depending on your needs, you can write a Wrapper function that has no arguments.
For example, if you want to call this function:fun1 ( in_out_str IN OUT VARCHAR2 , in_num IN NUMBER ) RETURN NUMBER ...
you don't need really the value changed to in_out_str, then you can write a function like this:
fun1_wrapper ( in_str IN VARCHAR2 , in_num IN NUMBER ) RETURN NUMBER IS in_str2 VARCHAR2 (32767) := in_str; BEGIN RETURN fun1 ( in_str2 , in_num ); END fun1_wrapper;
You can use fun1_wrapper in a SQL statement, even if you cannot use fun1 in the same statement.
Published by: Frank Kulash on February 27, 2013 09:42
-
Created under object types.
(1) CREATE OR REPLACE TYPE INVENTORY_ITEM_ID_TAB IN THE TABLE OF THE NUMBER;
--
(2) CREATE OR REPLACE TYPE ITEM_TYPE_REC AS OBJECT (ITEM_ID ISSUE
, ITEM_VALUE VARCHAR2 (4000)
);
--
(3) CREATE OR REPLACE ITEM_TYPE_TAB AS TABLE ITEM_TYPE_REC;
The function code
FUNCTION XXqp_get_pts_model)
p_item_id_tab IN INVENTORY_ITEM_ID_TAB)
RETURN ITEM_TYPE_TAB
IS
l_ITEM_TYPE_TAB ITEM_TYPE_TAB: = ITEM_TYPE_TAB();
ln_org_id NUMBER;
BEGIN
L_ITEM_TYPE_TAB. DELETE;
l_ITEM_TYPE_TAB. EXTEND;
LN_ORG_ID: = FND_PROFILE. VALUE ("QP_ORGANIZATION_ID");
SELECT ITEM_TYPE_REC (EGO. INVENTORY_ITEM_ID,
C_EXT_ATTR10)
LOOSE COLLECTION l_ITEM_TYPE_TAB
To ego_mtl_sy_items_ext_b ego.
ego_fnd_dsc_flx_ctx_ext ag,
fnd_descr_flex_column_usages atr
WHERE ego.attr_group_id = ag.attr_group_id
AND ag.descriptive_flex_context_code = atr.descriptive_flex_context_code
AND ag.application_id = atr.application_id
AND ag.descriptive_flex_context_code = 'XXEGO_PRICE_INFO. '
AND atr.end_user_column_name = 'XXEGO_PLAN_TO_SELL. '
AND IN ego.inventory_item_id
(SELECT
(SELECT inventory_item_id
OF MTL_SYSTEM_ITEMS_B
WHERE segment1 = A.item_name
AND organization_id = ln_org_id
) inventory_item_id
OF geqp_apl_pricelist_sku_tbl A
)
AND ego.organization_id = ln_org_id;
RETURN l_ITEM_TYPE_TAB;
end XXqp_get_pts_mode;
Below the code works fine BUT when calling function in pl/sql dynamic mode it does not underneath.
---------------------------
Labour Code
---------------------------
DECLARE
CURSOR c1 IS SELECT (SELECT inventory_item_id
OF mtl_system_items_b
WHERE segment1 = A.item_name
AND organization_id = 83
) INVENTORY_ITEM_ID
of XXqp_apl_pricelist_sku_tbl;
L_INVENTORY_ITEM_ID_TAB INVENTORY_ITEM_ID_TAB: = INVENTORY_ITEM_ID_TAB();
L_ITEM_TYPE_TAB ITEM_TYPE_TAB: = ITEM_TYPE_TAB();
LV_CHAR VARCHAR2 (1000);
LV_QRY VARCHAR2 (1000);
BEGIN
--
l_inventory_item_id_tab. DELETE;
OPEN c1;
LOOP
C1 FETCH BULK COLLECT INTO L_INVENTORY_ITEM_ID_TAB;
OUTPUT WHEN c1% NOTFOUND;
END LOOP;
CLOSE C1;
SELECT XXQP_APL_ELIG_TCA_DEV_PKG. XXQP_GET_PTS_MODEL (L_INVENTORY_ITEM_ID_TAB)
IN L_ITEM_TYPE_TAB
FROM DUAL;
--
FOR j IN 1.l_ITEM_TYPE_TAB. COUNTY
LOOP
DBMS_OUTPUT. PUT_LINE (L_ITEM_TYPE_TAB (J). ITEM_VALUE);
END LOOP;
END;
---------------------------
Code does not
---------------------------
DECLARE
CURSOR c1 IS SELECT (SELECT inventory_item_id
OF mtl_system_items_b
WHERE segment1 = A.item_name
AND organization_id = 83
) INVENTORY_ITEM_ID
of GEqp_apl_pricelist_sku_tbl;
LV_QRY VARCHAR2 (1500);
L_INVENTORY_ITEM_ID_TAB INVENTORY_ITEM_ID_TAB: = INVENTORY_ITEM_ID_TAB();
l_ITEM_TYPE_TAB ITEM_TYPE_TAB: = ITEM_TYPE_TAB();
BEGIN
l_inventory_item_id_tab. DELETE;
OPEN c1;
LOOP
C1 FETCH BULK COLLECT INTO L_INVENTORY_ITEM_ID_TAB;
OUTPUT WHEN c1% NOTFOUND;
END LOOP;
CLOSE C1;
LV_QRY: = ' START: 1: = XXQP_APL_ELIG_TCA_DEV_PKG. XXQP_GET_PTS_MODEL(:2); END;';
DBMS_OUTPUT. Put_line ('-> lv_qry' |) LV_QRY);
IMMEDIATE EXECUTION in USING LV_QRY IN l_INVENTORY_ITEM_ID_TAB, OUT l_ITEM_TYPE_TAB;
END;
Kindly help me out here in the execution of the function from PL/SQL runtime which is having IN OUT type of table.
Kind regards
Devendra
Wrong code
IMMEDIATE EXECUTION in USING LV_QRY IN l_INVENTORY_ITEM_ID_TAB, OUT l_ITEM_TYPE_TAB ;
When I use the code below, able to perform the function without any error.
EXECUTE LV_QRY IMMEDIATELY WITH THE HELP OF THE L_ITEM_TYPE_TAB, IN L_INVENTORY_ITEM_ID_TAB;
Thank you all for your help in fixing the code.
-
BEEP 10 g call a PL SQL function
Hello..
It's really breaking the feet... googled a lot but always back to square start.
... Well guys want to help me...
I need to call a function from PL SQL BI editor passing 3 parameters.
that means this feature is... it feeds a table.
And the editor of BI report is read from the populated table...
Kindly help me out here... How can I start...
PL SQL function is a stand-alone... It is not under any procedure/package...
If you could give me some small excerpts of what to write in the style of data... that would be great... and Yes, indeed, this is the old version of the BEEP... 30%>
Total Questions: 11 (10 open)
>
Why can't anyone help you?>
He throws me an error
Variable binding does not existany work arounds guy?
>
soand in z_report_sys_op_test_pkg.z_report_sys_op_test get the necessary value
>
substr (: Store, 0, InStr(:Store,'-') - 1). -
Return more than an OUT parameter of the stored procedure called in sql
I searched for it, but maybe that I did a good job. I would return two parameters of a stored procedure that is called from an sql query. Something like
When the results of the query will return 2 columns. It is guaranteed in my design in order to return only a single record.select my_proc(in_param) from dual
Is this possible?
The version of Oracle that I use is:Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi PL/SQL Release 10.2.0.2.0 - Production "CORE 10.2.0.2.0 Production" TNS for Linux: Version 10.2.0.2.0 - Production NLSRTL Version 10.2.0.2.0 - Production
Is this possible?
Laughing out loud
You can not call a stored SQL procedure. Only functions can be called from SQL. -
A c from pl/sql function call
Hello
I'm testing a simple case to call a C function from a pl/sql block.
Here's my test case (came to
:)TST.c:
#include < ctype.h >
#include < stdio.h >
int upcase (char * istr, char * ostr)
{
int i = 0;
While (ISTR)
{
OSTR [i] = toupper (istr [i]);
i ++ ;
}
return 0;
}
// compile
gcc -fPIC -c tst.c
// create shared object
ld -shared -o libtest.so tst.o
file libtest.so
libtest.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped
// wrapper library and function
SQL> create or replace library libtest as '/home/oracle/libtest.so';
/
Library created.create or replace function upcase (instr in varchar2, outstr out varchar2) return directory is
external
libtest library
name 'upcase '.
C language
call the standard C
settings)
string InStr,
outStr string
);
/
Listener.ora:
LISTENER =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = server1) (Port = 1521))
(ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PRD_DGMGRL)
(ORACLE_HOME = home/app/product/11.2.0/jko)
(SID_NAME = PRD)
)
(SID_DESC =
(ORACLE_HOME = home/app/product/11.2.0/jko)
(SID_NAME = PLSExtProc)
(= Extproc PROGRAM)
(ENVS = "EXTPROC_DLLS = ANY")
)
)
LOG_DIRECTORY_LISTENER = / home/app/network/log
CONNECT_TIMEOUT_LISTENER = 10
TRACE_DIRECTORY_LISTENER = / home/app/network/trc
STARTUP_WAIT_TIME_LISTENER = 0
USE_PLUG_AND_PLAY_LISTENER = OFF
ADMIN_RESTRICTIONS_LISTENER = WE
LOG_FILE_LISTENER = listener.log
TRACE_LEVEL_LISTENER = OFF
tnsnames.ora:
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC))
(CONNECT_DATA = (SID = plsextproc))
)
declare
str1 varchar2 (20);
VARCHAR2 (20) str2;
Directory of RC;
Start
str1: = "Hello World";
RC: = upcase (str1, str2);
dbms_output.put_line (' rc ='|) RC: ' instr =' | str1 |' outstr =' | str2);
end;
/
declare
str1 varchar2 (20);
VARCHAR2 (20) str2;
Directory of RC;
Start
str1: = "Hello World";
RC: = upcase (str1, str2);
dbms_output.put_line (' rc ='|) RC: ' instr =' | str1 |' outstr =' | str2);
end;
/
ERROR on line 1:
ORA-28576: interruption of the RPC connection to the external procedure agent
ORA-06512: at "SYS." UPCASE', line 1
ORA-06512: at line 7
How I did wrong?
Thanks a lot for your help
jko
The error means generally that your external procedure (process c in this case), failed or crashed.
The details of the Oracle error:
28576, 00000, "loss of the RPC connection to the external procedure agent."
* Cause: A fatal error occurred either a RPC network connection.
agent extproc or the invoked 3GL after disclosure
was created successfully.
* Action: First check the 3GL code you are calling; the most likely
This error is an abnormal termination of the
called 'C' routine. If this is not the case, look for
network problems. Correct the problem if you find. If all the
components appear normal, but the problem persists, the
problem could be an internal logic error in the transfer of the CPP
code. Contact your customer support representative.Probably the dynamic loader used by the kernel to resolve external dependencies than physical of the executable failed?
Mike Board solves the problem? IMO, it should...
-
How to call the pl/sql function in application of the ADF
Hi Experts,
I need to call the pl/sql function in application of ADF, I have logic written in my AM
Method:
public String reportStoredProcedure (locationID customerID, number,
String tailNum) {}
CallableStatement st = null;
String v_sanctioned = null;
If (locationID! = null & & customerID! = null & & tailNum! = null) {}
System.out.println (locationID + "" + customerID + "" + tailNum);
Tail string = "TAIL";
String result = "N";
try {}
String stmt =
"start XXWFS_SANCTIONS_PKG. CHECK_SANCTION(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11); end; « ;
St = getDBTransaction () .createCallableStatement (stmt, 0);
st.setNull (1, Types.VARCHAR);
st.setNull (2, Types.NUMERIC);
st.setObject (3, customerID);
st.setNull (4, Types.NUMERIC);
st.setNull (5, Types.NUMERIC);
st.setObject (6, locationID);
st.setNull (7, Types.NUMERIC);
st.setNull (8, Types.NUMERIC);
st.setObject (9, tail);
st.setObject (10, tailNum);
st.setObject (11, result);
St.Execute ();
System.out.println ("v_sanctioned in AM:" + v_sanctioned);
} catch (Exception e) {}
e.printStackTrace ();
return "N";
} {Finally
If (st! = null)
try {}
St.Close ();
} catch (Exception e1) {}
E1. PrintStackTrace();
return "N";
}
}
} else {}
System.out.println ("v_sanctioned is null");
v_sanctioned = "N";
}
Return v_sanctioned;
}
Error:
java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in the call to 'CHECK_SANCTION '.
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1035)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:191)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:950)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1224)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3386)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3487)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:3858)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1374)
at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:99)
at model.view.CardAMImpl.reportStoredProcedure(CardAMImpl.java:182)
at com.emboss.bean.ReadyToPrint.invokeVSanctioned(ReadyToPrint.java:485)
at com.emboss.bean.ReadyToPrint.PrintingCards(ReadyToPrint.java:434)
at com.emboss.bean.ReadyToPrint.printCards(ReadyToPrint.java:204)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1259)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:97)
to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:90)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:309)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:94)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:91)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run (StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:94)
at java.security.AccessController.doPrivileged (Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:159)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.doIt (WebAppServletContext.java:3684)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3650)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Can someone help me how to call...Call it in function, not as a procedure you do
try { String stmt = "begin :1 := XXWFS_SANCTIONS_PKG.CHECK_SANCTION(:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12); end;"; st = getDBTransaction().createCallableStatement(stmt, 0); st.registerOutParameter(1, Types.VARCHAR); st.setNull(2, Types.VARCHAR); st.setNull(3, Types.NUMERIC); st.setObject(4, customerID); st.setNull(5, Types.NUMERIC); st.setNull(6, Types.NUMERIC); st.setObject(7, locationID); st.setNull(8, Types.NUMERIC); st.setNull(9, Types.NUMERIC); st.setObject(10, tail); st.setObject(11, tailNum); st.setObject(12, result); st.execute();
= st.getString(1);
Maybe you are looking for
-
Why my favorites icon disappeared and why my bookmarks menu suddenly on the left side?
Recently, Firefox updated to 23.0.1 (beta?) and once the browser upward, I noticed that my bookmark icon (the star) had disappeared. I solved the problem easily by assigning up to where it was originally. Now my problem is that when I click the icon,
-
Cannot get Toshiba smart 40RL958B TV shows Toshiba Satellite C55 on WiDi
I have a Toshiba newly bought c55 Windows 10 satellite and also a Toshiba 40RL958B smart tv and I have tried to connect wireless on widi without success, I easily connected using an hdmi cable but I need the option of widi.
-
Sleekbook 15 (D8X43U): Pavilion Sleekbook 15 WiFi unrecognized after opening case
I recently had to open the case and make a few disassembly to upgrade my memory. After reassembling the computer, my WiFi card is no longer recognized. When I go to Device Manager - network adapters I even see the device in the list. I wonder if I mi
-
version of the Flash plugin is missing how download this__
Since I have updated I can no longer play games. It keeps flashing lack the flash plugin, I don't know where to go to download it. I installed Adobe player and everything it came with, but I'm stuck on the plugin, I'm new to computers.
-
original title: save my info on 4 cd before sending computer laptop out for repair, now cannot charge information. Can you help me? HP suggested that I backuo my files to cd before you send my laptop back for repair. Now am unable to reload the fi