Dial the stored function return array
Hi allI have a function as follows:
create or replace TYPE string_table IS the TABLE OF VARCHAR2 (2000);
create or replace TYPE ARRAYTYPE is VARRAY (20) OF VARCHAR2 (30);
create or replace FUNCTION getEmpArray (s varchar2, varchar2, st string_table t) RETURN ARRAYTYPE AS
ARRAYTYPE l_data: = ARRAYTYPE();
BEGIN
l_data.extend; l_data (l_data. (Count): = s; l_data.extend; l_data (l_data. (Count): = t; l_data.extend; l_data (l_data. (Count): = St (1); L_data RETURN;
END;
I want to call this function from StoredFunctionCall
Code:
Fun StoredFunctionCall = new StoredFunctionCall();
fun.setProcedureName ("getEmpArray".toUpperCase ());
Object [] arr = new Object() {"aa", "Valentine", "bbb"};
ArrayDescriptor = arrDescriptor
ArrayDescriptor.createDescriptor ("string_table".toUpperCase (),
connection);
ARRAY arrayToPass = new ARRAY (arrDescriptor, arr);
fun.addUnamedArgumentValue ("a");
fun.addUnamedArgumentValue ("b");
fun.addUnamedArgumentValue (arrayToPass);
fun.setResult ("FUNCTION_RESULT"); to get result by this name
List of vector < DatabaseRecord > = session.executeSelectingCall (fun);
But the Exception
PLS-00382: expression is of the wrong type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error code: 6550
Call: START? : = GETEMPARRAY (?,?,?); END;
link = > [= > FUNCTION_RESULT, a, b, oracle.sql.ARRAY@21fbc01]
Please help me
Published by: fbg on 26/04/2010 21:52
A few questions,
1 JDBC does not support the type of TABLE PLSQL, you must use a type VARRAY, or wrap the TABLE function call in a function that takes a VARRAY.
TopLink also has support for PLSQL types in his PLSQLStoredProcedureCall class, but no support is currently available for StoredFunctions.
You can pass the VARRAY type for the argument of the TABLE.
2. your function returns a VARRAY, so you must set the type in the result of StoredFunctionCall.
We are currently the API to set a table for the result type, so you must directly access first parameter of the call or use a StoredProcedureCall (and convert your function of a procedure).
You can also investigate a cursor of returning from a procedure stored instead of the varray.
You can also directly access the JDBC connection and make the call using JDBC code.
Feel free to connect these issues EclipseLink.
---
James: www.eclipselink.org
Tags: Fusion Middleware
Similar Questions
-
How the two function return values
Dear all,
Please explain, how the two values of function return?
give a simple example.
OK, a few examples...
First example, using a type of structured on the database object:
SQL > create or replace type tMyValues as an object (yr number, number, number of dy mn)
2.Type of creation.
SQL > create or replace function getMyValues return tMyValues is
2 number of y: = extraction (year sysdate);
number of 3 m: = extraction (sysdate months);
number of 4 d: = extract (day of sysdate);
5. start
6 return new tMyValues(y,m,d);
7 end;
8.The function is created.
SQL > set serverout on
SQL > declare
2 myValues tMyValues;
3. start
4 myValues: = getMyValues();
5 dbms_output.put_line (' year: ' | myValues.yr);
6 dbms_output.put_line (' month: ' | myValues.mn);
7 dbms_output.put_line (' date: ' | myValues.dy);
8 end;
9.
Year: 2015
Month: 4
Day: 1PL/SQL procedure successfully completed.
Second example, using an associative array within PL/SQL:
SQL > set serverout on
SQL > declare
2 type tMyValues is table of the index number to varchar2 (10);
3 myValues tMyValues;
4
5 function getMyValues return tMyValues is
6 retValues tMyValues;
7. start
8 retValues ('Year'): = extraction (year sysdate);
9 retValues ('Month'): = extraction (sysdate months);
10 retValues ('Day'): = extract (day of sysdate);
11 return retValues;
12 end;
13. begin
14 myValues: = getMyValues();
15 dbms_output.put_line (' year: ' | myValues ('Year'));
16 dbms_output.put_line (' month: ' | myValues ('Month'));
17 dbms_output.put_line (' date: ' | myValues ('Day'));
18 end;
19.
Year: 2015
Month: 4
Day: 1PL/SQL procedure successfully completed.
For the pipeline functions, see the example I wrote on the link provided by ReemaPuri (answer No. 3) that I don't need to re - write what I did before.
-
Hello
OS: Windows xp
Oracle: 10.2.0.1
Please below, cut and paste from sqplus session:
My question is how this user is able to create the function, still is not having any default tablespace and quota zero on system tablespace. In which tbs has retained this function and if sys has set a zero quota on the tablespace default then why he demonstrated 'USERS' as default tablespace? How and why oracle that it allow to create and save the function without any quota?Enter user-name: sys/*** as sysdba Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL> create user test identified by test 2 quota 0 on system; User created. SQL> grant connect to test; Grant succeeded. SQL> grant create procedure to test; Grant succeeded. SQL> ALTER USER TEST QUOTA 0 ON USERS; User altered. SQL> select username,default_tablespace from dba_users where username='TEST'; USERNAME DEFAULT_TABLESPACE ------------------------------ ------------------------------ TEST USERS SQL> connect test/test; Connected. SQL> create or replace function mysysdate return date 2 is 3 begin 4 return sysdate+10; 5 end; 6 / Function created. SQL> select sysdate,mysysdate from dual; SYSDATE MYSYSDATE --------- --------- 08-DEC-09 18-DEC-09 SQL> connect sys/*** as sysdba Connected. SQL> select object_name from dba_objects where owner='TEST'; OBJECT_NAME -------------------------------------------------------------------------------- MYSYSDATE SQL> select segment_name,tablespace_name from dba_segments where owner='TEST'; no rows selected SQL>
kindly tell me how and why it works.
concerning
NishaIt's strange thread, it is much misconception or at least misunderstanding.
As already said, but ignored somehow, all the code function/procedure/package/relax/view /... are stored in the SYSTEM tablespace, regardless of the default tablespace and the quota of the user logged in with to create these objects. These objects have no (lines of code) segment, a segment is a use/allocation of space, that's why you have not any mention of these objects in xxx_segments or xxx_extents.
So, it's not a problem with the database or quota | user default tablespace (who manage the use of the space), but attached to the grant, you must create/procedure/package/trigger/view /...Nicolas.
-
Need to call the stored function
How can I call a stored function that accept the Date paramterasn return String paramtere
I use Jdeveloper p4
ADF BC + JSFUser,
You import java.util.Date - should be java.sql.Date.
John
-
Before then, the shift functions return type?
I can not stress which is the return type of these functions? numeric value or Member?
And if they come back that a member would be this fomula be valid (I have to take the average of March and June):
avgppl = @avgrange ("HRsummary"-> "territory", @list (@currmbr ("YearTotal"), @shift (@currmbr ("YearTotal"),-3)))
Thanks in advance!Hello
All the mentioned functions (Prior, Next, and shift) returns the values and non-members.
Concerning
-SM -
The callback functions control array?
My apologies for my basic question.
I'm experimenting with control arrays and so far able to collect data in controls of a string that is contained in the tables of controls. Works well. Of course, none of these controls need callback functions.
Now, I need a few momentary controls in a control array as well. So my question is, should I use a single callback for all button controls function in this unique table? And if so, how can I do to determine which element in the control array called the function? Reading the forums, it seems as if the use of the data parameter of the callback could happen to me.
I just wanted to ask before we get off the track. Thank you!
Yes, callbackData can be useful in such a situation, but if you can limit to switch to array index to distinguish what to do the recall of your button might be something on this line:
int CVICALLBACK BtnAttayCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int handle, index; switch (event) { case EVENT_COMMIT: handle = GetCtrlArrayFromResourceID (panel, control); GetCtrlArrayIndex (handle, panel, control, &index); switch (index) { // Your code here } } return 0; }
(No CVI install here so I can't test it: check the code, but it should work reasonably)
-
Error when the stored procedure returns a cursor in c pro
Hello
I tried to make things work, explained to the
[2537153 m]
He runs a stored procedure from pro c which returns a cursor.
But when I compllie to c pro I get following error. My name of the procedure's TEST.
If I change the output to an int value parameter. It compiles okay.
PLS-S-00306, wrong number or types of arguments in the call to 'TEST '.
Error on line 34, column 5 in file E:\C\Test\tt.pc
TEST(:test_cursor);
+.... 1 +.
PLS-S-00000, ignored statement
A semantic error on line 33, column 1, folder E:\C\Test\tt.pc:
BEGIN
+ 1 +
PCC-S-02346, PL/SQL found semantic errors
Can make a point about what could be the error?
I work from oracle 8i client. that connects to oracle 9.0.1.
Operating system is win 2000 sp4
Oh yes - differs from the code snippet I posted your with the declaration of the host cursor variable. A difference in the case. Is how important it?
( it's been almost 10 years since I've coded last in Pro * C, so be careful with these questions! ) ;-) )
-
Grep search only on the current page, return array "search everything".
Hello
Is there a way to grep search only the current page, or any page chosen in my paper (myDocument.pages [i])?
I can only manage to search for in the document.
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "Chapter (\d+)";
myDocument.findGrep)
Also, is there a way to return the content to find? In this case, I want the $1 this research...
var a = myDocument.findGrep (). ?
Thank you
Christopher
the error is because you have not initialized the tabular myRet variable.
Another problem is the use of textframes.everyItem (), because that returns a different object.
and another is what happens if a textframe is empty you will get an error on the meaning of "object has no text for find/replace.
Here is the fixed code:
var myRet=[] var myDocument=app.activeDocument; var tf = myDocument.pages[0].textFrames.everyItem().getElements(), tf1 = myDocument.pages[0].textFrames.count(); app.findGrepPreferences = app.changeGrepPreferences = null; app.findGrepPreferences.findWhat = "Chapter"; for (var i = 0; i < tf1; i++){ if (tf[i].characters.length){ myRet=myRet.concat(tf[i].findGrep()); } } alert(myRet)
-
Date of the change in default when returned by the IIF function
Hello
Please can someone explain why the $vdate is displayed as a decimal number in the following code. It seems that the IIF() function returns a value by default and not what I put
Thank you.
< cfset vNow = DateFormat (Now (), ' mm/dd/yyyy') >
< cfoutput >
vNow = #vNow # < br / >
< / cfoutput >
< cfset $vdate = iif (true, vNow, "") >
< cfoutput >
$vdate = #vDate # < br / >
In the format $vdate = #DateFormat(vDate,"mm/dd/yyyy") # #TimeFormat(vDate, "hh:mm:ss") #.
< / cfoutput >
Too bad. I had to apply rated (IN ()) for the parameter of the IIR as well and it works:
-
FIRST analytical functions returns the null line
The following query returns a null line when there is no such thing as a line for the predicate. Is it a bug or expected behaviour. If so what is the meaning of the null row, is it not logical?
SELECT NVL (max (ah.fyr_end_dt) KEEP (DENSE_RANK FIRST ORDER BY ah.as_of_dt DESC), ' RETURNED NULL')
Of account_history ah
WHERE
Ah.acct_id = 999
AND trunc (ah.as_of_dt) < = 31 December 08 '
;Hello
user4900730 wrote:
Moreover, in my example how I distinguish the case where a line really exists, but the column is null when there is no such thing as a line and the FIRST function returns the same value null? Hopefullly I should be able to do it in a single SQL and know the difference?COUNT (*) > 0, but COUNT (col_x) = 0, then there is a line, but col_x happened to be null.
For example, the following query shows that there is 1 row in the group with the lowest name ("ADAMS"), but the column comm in all ranks of this group is null:
SELECT COUNT (*) KEEP (DENSE_RANK FIRST ORDER BY ename) AS total_cnt , COUNT (comm) KEEP (DENSE_RANK FIRST ORDER BY ename) AS comm_cnt FROM scott.emp ;
Output:
TOTAL_CNT COMM_CNT ---------- ---------- 1 0
The employee whose highest name ("WARD") has a number in the comm column.
-
BB10 simulator: questions about the clock function
I don't know, but I have the notion that under the Simulator for BB10 the clock() function returns a value of timer resolution of the host and not the right pair
And since
#define CLOCKS_PER_SEC 1000000
during the conversion of the clock in seconds it will be least bad results under windows. Because Windows there
#define CLOCKS_PER_SEC 1000
I want to keep constant 60 FPS and I have a code like:
const int FRAMES_PER_SECOND = 60;
const int SKIP_TICKS = 1000 / FRAMES_PER_SECOND;int GetTickCount (void)
{
Return MathUtils::dti ((double) clock () / CLOCKS_PER_SEC);
}and the game loop is:
int t_prev = GetTickCount();
mbGameRunning = true;
While (mbGameRunning)
{
int t = GetTickCount();If ((t-t_prev) > SKIP_TICKS)
Tick();Draw();
EventLoop();
t_prev = t;
}Am I missing something?
The clock() function only increments while your program is managed by the operating system. When the operating system switches to another task, "clock" your program stops running.
You must use:
clock_gettime(), which is the system clock that is still running.
-
I have a question about the order of execution. In the WHILE loop, I have two things to measure, period and tension using the DAQmx READ functions for voltage and the meter. In the end, I want to collect these data as points almost simultaneously as possible, as a pair and then send them together to another piece of code (not shown here) which them will result in some sort of command for an engine. It would be run, and then I want to perceive the tension and the period at a time later and do the same thing.
(1.) I'm a little confused on what the meter of the READ function is back because it's a table. What is a picture of? I thought that it was up to the value of the individual periods between rising edges. The output of the counter 1 DBL d's a table. How many elements in this table, and what determines the size of this table? Are the elements of the array the individual delays between the edges? How many values are stored in the array by executing? We take the AVERAGE of the last 15 items, but do not know if we are throwing some of the data or what. How to understand the composition of this painting? How can I change the composition of this painting? Is it possible to measure only one period at a time, for example the time between TWO edges?
2.) Will this WHILE loop execute as it gathers tension and a "period table ' (remains to be understood by me) by TIME running in a loop? In particular, we want that the value of the tension associated with the value of the AVERAGE of the period "array", so we can use two data items to create orders of next control every time that the two values are reported. The structure for the delivery of vi will be attached data in pairs like this? I understand that one of the READING functions run not before the other function of READING in the WHILE loop. I want that the period "means" and "strain (Volt) collected at the same pace. This vi will he?
Thank you
Dave
Hi David,
I suggest including the DAQmx Start Task function. If it does not start before the loop, it starts the loop and work very well, but it is not as fast and efficient. In the model of task status, task wiill go to run the checked each iteration of the loop and then back the time checked running when it restarts.
The status of the task model: http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/taskstatemodel/
Kind regards
Jason D
Technical sales engineer
National Instruments
-
How to return the function 2D array
Hello
is it possible to return the function 2D array? I have this but returns undefined, all tests within the work however, service
I'll call the function:
imageThumbsFineArtArr = calculateThumbWidths (numOfSeriesFineArt, numOfImagesFineArtArr, "thumbImageFineArt");
Thanks for any help
with regard to 2. Yes it is undefined after statement 1. and it shows the correct numbers after 3.
I already solved the problem, it may not be clean but it works, function does not return anything and I'm changing table imageThumbsFineArtArr inside the function as a global variable and each Member of the group i, j separately...
Thanks again,
Zbynek -
You can have two stored functions with the same name?
Hi all
You can have two stored functions with the same name?
My version of DB - connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Thank you.
You can have the same name as long as they are within a package and with different parameters
create or replace package test_pkg
as
function my_func (p1 in number)
return number;
function my_func (at number p1, p2)
return number;
end test_pkg;
/
create or replace package body test_pkg
as
function my_func (p1 in number)
Return number
as
Start
return 0;
end;
function my_func (at number p1, p2)
Return number
as
Start
return 0;
end;
end test_pkg;
/
-
How to configure the settings of sql stored function
Hello
I use jdeveloper 11.1.2.3.0
I have the below sql stored function
I would like to know how exactlly I should call this function of my AppModuleImpl.function get_data(p_id in number, p_date in date, p_msg out varchar) return number is ....... end get_data;
I tried several ways to set the parameters, but I'm getting java.sql.SQLException: Error invalid column index.
Could you give me the correct code for this case?
Thank you very much!check the docs [url http://docs.oracle.com/cd/E16162_01/web.1112/e16182/bcadvgen.htm#insertedID6] calling stored procedures and functions
Maybe you are looking for
-
I have a fully customized Numbers spreadsheet (which is a budget) and each row has a formula. I need to present the budget with only the lines that are used for an overview of the customer. How can I quickly select all unused lines and save only the
-
Tecra Z50-A-11 q - slow start after the installation of Win 8.1
Today, I installed Windows 8.1 CD. Also, I followed the instructions and had a old BIOS in the UEFI.The installation has been successful, but now the BIOS starts slowly. After almost a minute to look at the Toshiba logo, Windows 8 starts. I can't fin
-
I can constant maniuplate outdoors to separate while loops?
What I want to do is subtract the constants incrementing in while loops 1 & 2. I removed the meat of the code, as it would get in the way of the question. Basically, a value is read (outside the structure of the case) each time, iI want to increment
-
How can I self study for the certification of MTA?
-
How to get the code produced for my Windows XP disc if I have the drive?
Acquisition of Product Code Windows XP How to get the code produced for my Windows XP disc if I have the drive? I signed the BONE when I bought it all first, but have no way of knowing if this is the way to receive a copy of the product key.