Calling a dll that returns a handle
I am using the LV Call Library Function to call a reflective memory
board interface dll on a Windows 2000 system. The first call is to OPEN
with an argument of a pointer to a string containing the name of the
device. This opens the driver and returns a handle that is used in the
calls to all the other calls. Unfortunately, the return value in the
Call Library Function can't be set to handle.
If I set the return value to U32 (unsigned 32 bit int) it seems to work
since it returns the same value each time and it returns 0 (the error
value) if I give it the wrong device name. The problem is that when I
try to cast the returned value as a handle, all the other calls return 0
or error.
The board came with a command line in
terface program that allows me to
exercise the board so I know that everything is working except my
interface to the dll.
Ed Bogart
How are you "casting" this U32 value to dll handle?
Which are the settings in configuration of dll call dialog like "calling conventions" and how the called dll function prototype looks like?
Is your dll thread-safe?
How you calling the second call library functio node? (may be sample diagram or picture)
Sergey
Similar Messages
-
Calling a dll that has an unsigned char, unsigned char * in a function call
I have a dll that has the following function that I am trying to call from LabView
GetAvailableData( unsigned short * Num1, unsigned short * pList, unsigned short in, unsigned short * ip )
In this, the second parameter is an output. When I use call library function node, I use the second arg to create an indicator. When I run this program, I see the return value to be zero.
I use the following for arg2:
Name: arg2
Type: Numeric
Data type: 16bit Integer
Pass: Pointer to value
Any help is appreciated.dinks-
Just some janitorial work first: when posting try and keep the spaces between lines to a minimal. Empty spaces just means less memory somewhere. To your question, I think some clarification is needed. Tell me if this is right, you have a dll that you are calling into LabVIEW using Call Library Function node and then trying to get this unassigned character.
Yes. That is correct.
It returns 0 but it should be giving something else (what should it be returning?). Are you getting any errors running this or you are just not getting the expected value back? Thanks for the clairfication!!
Thanks for the response. I think there are lot of nitty gritty details when calling a c++ dll from LabView that I need to learn. The unsigned char problem is solved when I modified the output to Array in Labview.
I have issues using C++ functions that return a bool value.
The other problem is with C++ functions that return a HANDLE.
In the first case where the return value is bool, I assigned the return value in LabView to Signed 32 bit integer when I call this function, the return bool value is some large number always irrespective of the C++ bool value (true or false).
For the second case (return type HANDLE), I assume, I should specify the return value as signed 32 bit integer in the configure option of call library function node. I tried that and it returns the same value. The dll returns non zero if my hardware that I am interfacing with is found. If it doesn't find the hardware, the return HANDLE is 0. The Labview program returns the same value if I enable the hardware or disable the hardware.
I am following the Call DLL.vi example for using various data types in C++.
Really appreciate your help. -
DB Adapter Calling DB Procedure that returns a Record Type
I am trying to call a PL/SQL procedure that returns a Record Type and a VARCHAR2 and I'm getting this error:
<Faulthttp://schemas.xmlsoap.org/soap/envelope/>
<faultcode>env:Server</faultcode>
<faultstring>java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'MY_PROC.GET_ID' ORA-06550: line 1, column 7: PL/SQL: Statement ignored </faultstring> </Fault>
Is there something different I need to do to handle the Record Type OUT parameter?
Thanks.The adapter configuration wizard should take care of the Record Type for you. It should invoke JPublisher to create an equivalent Object type and a package containing a wrapper that will be called by the adapter runtime. The package also contains conversion functions for converting between your Record Type and the generated Object type. Maybe it would help if you posted the signature of your stored procedure (not the body).
-
How to call VC++ dll whiich return char[] data type value in powerbuilder
Hi Everyone,
I am using PowerBuilder 11.1 build 8123.
I am calling VC++ DLL in our PowerBuilder application which return char[] data type value.
I just declare Global External Function:-
Function char getOSSectionName() library "DocServClient.dll" alias for "getOSSectionName;Ansi"
And then call this function in window as:-
Char ls_section[1] = 'DOCAPPLICATIONS9X'
ls_section[1]=getOSSectionName()
When I check ls_section[1] value in messagebox it display a symbol (please check attached attached image.)
VC++ function and return variable declaration:-
__declspec(dllexport) char * __stdcall getOSSectionName()
char SectionName[_MAX_PATH];
Please let me know that my code is valid or not.
Please help..Hi,
Thanks to Everyone for your suggestions.
I am solved my problem to change VC++ function as :-
Int __declspec(dllexport) __stdcall getOSSectionName(char* SectionName)
instead of
__declspec(dllexport) char * __stdcall getOSSectionName()
and declare global function as:-
Function int getOSSectionName(Ref char ls_section[100]) library "DocServClient.dll" alias for "getOSSectionName;Ansi"
and call function in window as:-
int li_ret
char ls_section[100]
string ls_sec
li_ret=getOSSectionName(REF ls_section)
ls_sec=ls_section
Thanks,
Vikrant -
How to call a sp that returns multi_columns from another sp
Hi,
Can anybody help me to solve this problem? I called a sp which
returns ename, sal using a weak ref cursor from another sp. Is
it possible to do this? or I did something wrong? The error
messages are:
ERROR at line 1:
ORA-00904: invalid column name
ORA-06512: at "SCOTT.TESTPKG", line 14
ORA-06512: at line 1
below is my code:
create or replace package testpkg AS //12/19/01
TYPE sumCur IS REF CURSOR;
TYPE estType IS REF CURSOR;
function totalNo (
dno IN NUMBER)
RETURN estType;
procedure test(
sum_cv IN OUT NOCOPY sumCur);
END;
CREATE OR REPLACE PACKAGE BODY testpkg AS
function totalNo (
dno IN NUMBER)
RETURN estType IS est_cv estType;
BEGIN
OPEN est_cv FOR SELECT ename, sal FROM emp
where deptno = dno and job = 'MANAGER';
RETURN est_cv;
END totalno;
procedure test(
sum_cv IN OUT NOCOPY sumCur) AS
sql_statement VARCHAR2(100);
BEGIN
sql_statement :='SELECT dname, totalNo(deptno)
from dept ';
OPEN sum_cv FOR sql_statement ;
END test;
END;
ThanksThe error that you are getting is because totalNo(deptno) needs
to be testpkg.totalNo(deptno), but that is not the only error.
Maybe you can use something like this:
SQL> CREATE OR REPLACE PACKAGE testpkg
2 AS
3 TYPE sumcur IS REF CURSOR;
4 FUNCTION totalno
5 (dno IN NUMBER)
6 RETURN VARCHAR2;
7 PROCEDURE test
8 (sum_cv IN OUT sumcur);
9 END testpkg;
10 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY testpkg
2 AS
3 FUNCTION totalno
4 (dno IN NUMBER)
5 RETURN VARCHAR2
6 IS
7 est_cv VARCHAR2 (30);
8 BEGIN
9 SELECT ename || ' ' || TO_CHAR (sal)
10 INTO est_cv
11 FROM emp
12 WHERE deptno = dno
13 AND job = 'MANAGER';
14 RETURN est_cv;
15 END totalno;
16 PROCEDURE test
17 (sum_cv IN OUT sumcur)
18 AS
19 sql_statement VARCHAR2 (100);
20 BEGIN
21 sql_statement :=
22 ' SELECT dname, testpkg.totalno (deptno)'
23 || ' FROM dept';
24 OPEN sum_cv FOR sql_statement;
25 END test;
26 END testpkg;
27 /
Package body created.
SQL> VARIABLE g_ref REFCURSOR
SQL> EXEC testpkg.test (:g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
DNAME
TESTPKG.TOTALNO(DEPTNO)
ACCOUNTING
CLARK 2450
RESEARCH
JONES 2975
SALES
BLAKE 2850
DNAME
TESTPKG.TOTALNO(DEPTNO)
OPERATIONS -
Calling a method that returns values in a map - using JSTL
Hi I have a method within an object that returns a List for a particular category
public List<String> getFieldsInCategory(String categoryName){
return _categoryFieldsMap.get(categoryName); //This is a map that returns a list
}Trying to call the above function in jsp, the object is available as "document",
how do i pass a key to the above function to return a List.
<c:forEach items="${document.fieldsInCategory('ABSTRACT')}" var="temp">How do i get the list by passing a string key to my method,
please let me know how to go about this.
ThanksJSTL can not directly call methods that take parameters.
All it can do is access javabean properties - ie via the revealed get/set methods.
You can fudge it by having a seperate variable to set:
Map _categoryFieldsMap;
String category = null;
public void setCategory(String category){
this.category = category;
public String getCategory(String category){
return category;
public List<String> getFieldsInCategory(){
return _categoryFieldsMap.get(categoryName); //This is a map that returns a list
}You would then do it like this in your JSP:
<c:set target="document.category" value="ABSTRACT"/>
<c:forEach items="${document.fieldsInCategory}" var="temp">
...The other alternative is to return the entire map to the page.
EL accesses maps quite handily.
so given a method that returns the map:
public Map getCategoryFieldsMap(){
return _categoryFieldsMap;
then the expression: ${document.categoryFieldsMap.ABSTRACT} returns what you are after.
Hope this helps,
evnafets -
SOLVED: How can I use or call a function that returns %ROWTYPE?
Hi
edit: you can probably skip all this guff and go straight to the bottom...In the end this is probably just a question of how to use a function that returns a %rowtype. Thanks.
Currently reading Feuerstein's tome, 5th ed. I've downloaded and run the file genaa.sp, which is a code generator. Specifically, you feed it a table name and it generates code (package header and package body) that will create a cache of the specified table's contents.
So, I ran:
HR@XE> @"C:\Documents and Settings\Jason\My Documents\Work\SQL\OPP5.WEB.CODE\OPP5.WEB.CODE\genaa.sp"
749 /
Procedure created.
HR@XE> exec genaa('EMPLOYEES');which generated a nice bunch of code, viz:
create or replace package EMPLOYEES_cache is
function onerow ( EMPLOYEE_ID_in IN HR.EMPLOYEES.EMPLOYEE_ID%TYPE) return HR.EMPLOYEES%ROWTYPE;
function onerow_by_EMP_EMAIL_UK (EMAIL_in IN HR.EMPLOYEES.EMAIL%TYPE) return HR.EMPLOYEES%ROWTYPE;
procedure test;
end EMPLOYEES_cache;
create or replace package body EMPLOYEES_cache is
TYPE EMPLOYEES_aat IS TABLE OF HR.EMPLOYEES%ROWTYPE INDEX BY PLS_INTEGER;
EMP_EMP_ID_PK_aa EMPLOYEES_aat;
TYPE EMP_EMAIL_UK_aat IS TABLE OF HR.EMPLOYEES.EMPLOYEE_ID%TYPE INDEX BY HR.EMPLOYEES.EMAIL%TYPE;
EMP_EMAIL_UK_aa EMP_EMAIL_UK_aat;
function onerow ( EMPLOYEE_ID_in IN HR.EMPLOYEES.EMPLOYEE_ID%TYPE)
return HR.EMPLOYEES%ROWTYPE is
begin
return EMP_EMP_ID_PK_aa (EMPLOYEE_ID_in);
end;
function onerow_by_EMP_EMAIL_UK (EMAIL_in IN HR.EMPLOYEES.EMAIL%TYPE)
return HR.EMPLOYEES%ROWTYPE is
begin
return EMP_EMP_ID_PK_aa (EMP_EMAIL_UK_aa (EMAIL_in));
end;
procedure load_arrays is
begin
FOR rec IN (SELECT * FROM HR.EMPLOYEES)
LOOP
EMP_EMP_ID_PK_aa(rec.EMPLOYEE_ID) := rec;
EMP_EMAIL_UK_aa(rec.EMAIL) := rec.EMPLOYEE_ID;
end loop;
END load_arrays;
procedure test is
pky_rec HR.EMPLOYEES%ROWTYPE;
EMP_EMAIL_UK_aa_rec HR.EMPLOYEES%ROWTYPE;
begin
for rec in (select * from HR.EMPLOYEES) loop
pky_rec := onerow (rec.EMPLOYEE_ID);
EMP_EMAIL_UK_aa_rec := onerow_by_EMP_EMAIL_UK (rec.EMAIL);
if rec.EMPLOYEE_ID = EMP_EMAIL_UK_aa_rec.EMPLOYEE_ID then
dbms_output.put_line ('EMP_EMAIL_UK lookup OK');
else
dbms_output.put_line ('EMP_EMAIL_UK lookup NOT OK');
end if;
end loop;
end test;
BEGIN
load_arrays;
end EMPLOYEES_cache;
/which I have run successfully:
HR@XE> @"C:\Documents and Settings\Jason\My Documents\Work\SQL\EMPLOYEES_CACHE.sql"
Package created.
Package body created.I am now trying to use the functionality within the package.
I have figured out that the section
BEGIN
load_arrays;
end EMPLOYEES_cache;
/is the initialization section, and my understanding is that this is supposed to run when any of the package variables or functions are referenced. Is that correct?
With that in mind, I'm trying to call the onerow() function, but it's not working:
HR@XE> select onerow(100) from dual;
select onerow(100) from dual
ERROR at line 1:
ORA-00904: "ONEROW": invalid identifier
HR@XE> select employees_cache.onerow(100) from dual;
select employees_cache.onerow(100) from dual
ERROR at line 1:
ORA-06553: PLS-801: internal error [55018]
HR@XE> select table(employees_cache.onerow(100)) from dual;
select table(employees_cache.onerow(100)) from dual
ERROR at line 1:
ORA-00936: missing expressionHe provides the code genaa.sp, and a very brief description of what it does, but doesn't tell us how to run the generated code!
Now, I have just done some googling, and it seems that what I am trying to do isn't possible. Apparently %ROWTYPE is PL/SQL, and not understood by SQL, so you can't call onerow() from sql. Correct?
So I try wrapping the call in an exec:
HR@XE> exec select employees_cache.onerow(100) from dual;
BEGIN select employees_cache.onerow(100) from dual; END;
ERROR at line 1:
ORA-06550: line 1, column 30:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PLS-00428: an INTO clause is expected in this SELECT statement
HR@XE> exec select table(employees_cache.onerow(100)) from dual;
BEGIN select table(employees_cache.onerow(100)) from dual; END;
ERROR at line 1:
ORA-06550: line 1, column 14:
PL/SQL: ORA-00936: missing expression
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
HR@XE> exec employees_cache.onerow(100)
BEGIN employees_cache.onerow(100); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00221: 'ONEROW' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignoredNo joy.
Of course, now that I'm looking at it again, it seems that the way to go is indicated by the first error:
PLS-00428: an INTO clause is expected in this SELECT statement
So am I supposed to create a type of EMPLOYEES%ROWTYPE in a PL/SQL procedure, and the idea of this code, is that the first call to onerow() runs the initialiation code, which populates the cache, and all subsequent calls to onerow() (whether by my session or any other) will use the cache?
I've had a stab at this, but still, no joy:
create or replace procedure testcache is
emp employees%rowtype;
begin
select employees_cache.onerow(100) from dual into emp;
dbms_output.put_line('Emp id: ' || emp.employee_id);
end testcache;
show errors
HR@XE> @testcache.sql
Warning: Procedure created with compilation errors.
Errors for PROCEDURE TESTCACHE:
LINE/COL ERROR
4/9 PL/SQL: SQL Statement ignored
4/54 PL/SQL: ORA-00933: SQL command not properly ended
HR@XE>Have a feeling this should be really easy. Can anybody help?
Many thanks in advance.
Jason
Edited by: 942375 on 08-Feb-2013 11:45>
Ha, figured it out
>
Hopefully you also figured out that the example is just that: a technical example of how to use certain Oracle functionality. Unfortunately it is also an example of what you should NOT do in an actual application.
That code isn't scaleable, uses expensive PGA memory, has no limit on the amount of memory that might be used and, contrary to your belief will result in EVERY SESSION HAVING ITS OWN CACHE of exactly the same data if the session even touches that package.
Mr. Feuerstein is an expert in SQL and PL/SQL and his books cover virtually all of the functionality available. He also does an excellent job of providing examples to illustrate how that functionality can be combined and used. But the bulk of those examples are intended solely to illustrate the 'technical' aspects of the technology. They do not necessarily reflect best practices and they often do not address performance or other issues that need to be considered when actually using those techniques in a particular application. The examples show WHAT can be done but not necessarily WHEN or even IF a given technique should be used.
It is up to the reader to learn the advantages and disadvantages of each technicalogical piece and determine when and how to use them.
>
Now, I have just done some googling, and it seems that what I am trying to do isn't possible. Apparently %ROWTYPE is PL/SQL, and not understood by SQL, so you can't call onerow() from sql. Correct?
>
That is correct. To be used by SQL you would need to create SQL types using the CREATE TYPE syntax. Currently that syntax does not support anything similar to %ROWTYPE.
>
So am I supposed to create a type of EMPLOYEES%ROWTYPE in a PL/SQL procedure, and the idea of this code, is that the first call to onerow() runs the initialiation code, which populates the cache, and all subsequent calls to onerow() (whether by my session or any other) will use the cache?
>
NO! That is a common misconception. Each session has its own set of package variables. Any session that touches that package will cause the entire EMPLOYEES table to be queried and stored in a new associative array specifically for that session.
That duplicates the cache for each session using the package. So while there might be some marginal benefit for a single session to cache data like that the benefit usually disappears if multiple sessions are involved.
The main use case that I am aware of where such caching has benefit is during ETL processing of staged data when the processing of each record is too complex to be done in SQL and the records need to be BULK loaded and the data manipulated in a loop. Then using an associative array as a lookup table to quickly get a small amount of data can be effective. And if the ETL procedure is being processed in parallel (meaning different sessions) then for a small lookup array the additional memory use is tolerable.
Mitigating against that is the fact that:
1. Such frequently used data that you might store in the array is likely to be cached by Oracle in the buffer cache anyway
2. Newer versions of Oracle now have more than one cache
3. The SQL query needed to get the data from the table will use a bind variable that eliminates repeated hard parsing.
4. The cursor and the buffer caches ARE SHARED by multiple sessions globally.
So the short story is that there would rarely be a use case where ARRAYs like that would be preferred over accessing the data from the table. -
Function calling stored procedure that returns a cursor into a LOV
Hello,
Is it possible in HTML DB to implement a process that has a function that calls a stored procedure that returns a cursor, used to then populate a select list?
Or can I do a function call to a stored procedure in the 'List of values definition' box for the item itself that returns a cursor to populate the item's select list?Hi Vikas,
Actually, I just found another posting that shows how to do what I'm looking for:
Re: Filling a LOV with a cursor
Check it out. I posted another question in response to that discussion...maybe you could answer that? Thanks!
Laura -
Calling a procedure that returns a cursor inside a procedure
Hi,
I have two stored procedures. They both return a cursor as output variables. On the other hand I have another stored procedure that calls these procedures and return their results again an output variable. I know that this seems quite odd to be wanting to do something like this but how can I do that?You can make the hack generic. Make it execute any SQL as that schema that creates the ref cursor. E.g.
// as schema BILLY, open a huge security hole and grant access to USER1
SQL> create or replace procedure GetTableData( tableName varchar2, refCur out sys_refcursor ) authid definer is
2 dynamicSQL varchar2(32767);
3 begin
4 dynamicSQL := 'select * from '||tableName;
5 open refCur for dynamicSQL;
6 end;
7 /
Procedure created.
SQL>
SQL>
SQL> grant execute on GetTableData to USER1;
Grant succeeded.As USER1, you can now execute SQL (and even PL/SQL) as BILLY:
SQL> create or replace type TStrings is table of varchar2(4000);
2 /
Type created.
SQL> grant execute on TStrings to BILLY;
Grant succeeded.
SQL> --// execute this as the caller (which will be BILLY.GetTableData)
SQL> create or replace procedure ExecSQL( hackSQL varchar2 ) authid current_user is
2 pragma autonomous_transaction;
3 begin
4 execute immediate hackSQL;
5 commit;
6 end;
7 /
Procedure created.
SQL> --// wrap the above into something that BILLY.GetData can execute as a ref cursor
SQL> --// and return a meaningful message as to how successful the hack was
SQL> create or replace function PipeLineHack( hackSQL varchar2 ) return TStrings authid current_user pipelined is
2 begin
3 ExecSQL( hackSQL );
4 pipe row( 'SQL hack successful' );
5 exception when OTHERS then
6 pipe row( 'SQL hack faled with '||SQLERRM(SQLCODE) );
7 end;
8 /
Function created.
SQL>
SQL> grant execute on PipeLineHack to BILLY;
Grant succeeded.
SQL>
SQL> var c refcursor
SQL> --// expected used of the GetTableData() interface
SQL> --// we select from table BILLY.EMP
SQL> exec BILLY.GetTableData( 'EMP', :c );
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 1980/12/17 00:00:00 800 0 20
7499 ALLEN SALESMAN 7698 1981/02/20 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 1981/02/22 00:00:00 1250 500 30
7566 JONES MANAGER 7839 1981/04/02 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 1981/09/28 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 1981/05/01 00:00:00 2850 30
7782 CLARK MANAGER 7839 1981/06/09 00:00:00 2450 10
7788 SCOTT ANALYST 7566 1987/04/19 00:00:00 3000 20
7839 KING PRESIDENT 1981/11/17 00:00:00 5000 10
7844 TURNER SALESMAN 7698 1981/09/08 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 1987/05/23 00:00:00 1100 20
7900 JAMES CLERK 7698 1981/12/03 00:00:00 950 30
7902 FORD ANALYST 7566 1981/12/03 00:00:00 3000 20
7934 MILLER CLERK 7782 1982/01/23 00:00:00 1300 10
14 rows selected.
SQL>
SQL> --// getting that interface to run unexpected code - we
SQL> --// rename BILLY.EMP table to something else
SQL> exec BILLY.GetTableData( 'TABLE(USER1.PipeLineHack( ''alter table emp rename to emp_has_been_hacked''))', :c );
PL/SQL procedure successfully completed.
SQL> print c
COLUMN_VALUE
SQL hack successful
SQL> -
How to call a routine that returns a pointer using jni
hi this is ravi kiran,
i have a situation where i need to call a c-routine from my java program that returns a pointer.
how can i get the content of the pointer that the routine is returning.
plz help me
thanx in advanceReturn it as a java long.
When you need to use it again then pass it in as a long and cast it to a pointer.
If you need to free it then you should consider writing a finalize() method (one of the few times it is appropriate) and a destroy() method as well. -
Calling a method that returns an object Array
Hello.
During a JNICALL , I wish to call a method which returns an object array.
ie my java class has a method of the form
public MyObject[] getSomeObjects(String aString){
MyObject[] theObjects=new MyObject[10];
return theObjects
Is there an equivalent to (env)->CallObjectMethod(...
which returns a jobjectArray instead of a jobject, and if not could somebody suggest a way around this.
Thanks,
NeilI believe an array oj jobjects is also a jobject. You can then cast it to another class.
-
Call a procedure that returns a refcursor, use it in another proc's sql?
I have a procedure that returns a refcursor; how can I include that refcursor in a sql statement that's in another procedure, or view etc?
This is the kind of foolery I've tried so far (myproc1 returns a ref cursor):
create or replace procedure myproc2
rc ref cursor
AS
rc1 ref cursor;
begin
EXECUTE myproc1(rc1);
open rc for
select rc1.* from rc1;
end myproc2;lecaro wrote:
To reiterate, I was interested in consuming the refcursor output of one proc in another proc. I wanted to take what I regarded as the records returned by the first sproc and manipulate them using SQL in the second sproc.
Since I can't use that approach, what are some hopefully fairly straightforward solutions that might work?Something like:
create or replace
procedure p1(
p_stmt varchar2,
p_refcursor OUT sys_refcursor
is
begin
open p_refcursor for p_stmt;
end;
create or replace
procedure p2(
p_stmt varchar2
is
v_refcursor sys_refcursor;
v_var varchar2(30);
begin
p1(p_stmt,v_refcursor);
loop
fetch v_refcursor into v_var;
exit when v_refcursor%notfound;
dbms_output.put_line(v_var);
end loop;
end;
set serveroutput on
exec p2('select ename from emp where deptno = 20');
SQL> set serveroutput on
SQL> exec p2('select ename from emp where deptno = 20');
SMITH
JONES
SCOTT
ADAMS
FORD
PL/SQL procedure successfully completed.
SQL> SY. -
How do I call a SP that returns a sequence number from CMD
Hi , I have a requirement to call Sequence.NEXTVAL function from CMD . I believe I would have to call a SP to acheiev this I was also told that there is a generic mapplet for invoking SP from CMD Could somebody please point me to the right place Thanks. -Bhim
Using the Cloud / PowerCenter hybrid approach, one can cleanse address data by calling the AddressDoctor webservice. The attached sample code ( PowerCenter workflow XML ) leverages AddressDoctor's Batch Mode to cleanse individual address components ( Discrete ). The mapplet in the code can be uploaded into the Cloud platform and be used in a DSS or MCT task. Here is an example illustrating address data in a flat file being cleased and written to another flat file in a Cloud mapping. Note, in this mapping the AddressDoctor login credentials are sourced from a properties file via a lookup. The data flows from source -> expression(1) --> lookup(2) --> mapplet(3) --> target: (1) expression - The expression sets an output port to a default value equal to 1 for use in the lookup join condition. (2) lookup - The lookup gets the login credentials from a file on the secure agent host machine. Sample file: (3) mapplet - The mapplet, imported from the PowerCenter XML, calls the Address Doctor webservice and returns the process status codes, the original input data and a new cleansed data set. Note, the RecordID must be mapped and unique for each source row.
-
Call a function that returns a table
Hi all,
I create a partner link that calls a function from the database. That function returns a type defined in the database that is a table:
ceate or replace type tablela_de_ids is table of number
the XSD created is:
<schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/IGIF/WC01/PESQUISA_UT/" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/IGIF/WC01/PESQUISA_UT/">
<element name="InputParameters">
<complexType>
<sequence>
<element name="P_NIR" type="decimal" db:index="1" db:type="NUMBER" minOccurs="0" nillable="true"/>
<element name="P_NOME_COMPLETO" type="string" db:index="2" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
<element name="P_SEXO" type="string" db:index="3" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
<element name="P_DATA_NASC" type="dateTime" db:index="4" db:type="DATE" minOccurs="0" nillable="true"/>
<element name="P_NATURALIDADE" type="string" db:index="5" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
</sequence>
</complexType>
</element>
<element name="OutputParameters">
<complexType>
<sequence>
<element name="PESQUISA_UT" type="db:TABELA_DE_IDS" db:index="0" db:type="Array"
minOccurs="1" nillable="true"/>
</sequence>
</complexType>
</element>
<complexType name="TABELA_DE_IDS" >
<sequence>
<element name="PESQUISA_UT_ITEM" type="decimal" db:type="NUMBER" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
</sequence>
</complexType>
</schema>
I'm having a problem whit the output.
When the function returs only a number, it's correct...
<messages>
- <WC01_Pesquisa_Ut_InputVariable>
- <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="InputParameters">
- <InputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/IGIF/WC01/PESQUISA_UT/">
<P_NIR xmlns="">165968274</P_NIR>
<P_NOME_COMPLETO xmlns="">maria eduarda oliveira</P_NOME_COMPLETO>
<P_SEXO xmlns="">Feminino</P_SEXO>
<P_DATA_NASC xmlns="">1944-09-05</P_DATA_NASC>
<P_NATURALIDADE xmlns=""/>
</InputParameters>
</part>
</WC01_Pesquisa_Ut_InputVariable>
- <WC01_Pesquisa_Ut_OutputVariable>
- <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
- <db:OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/IGIF/WC01/PESQUISA_UT/">
- <PESQUISA_UT>
<PESQUISA_UT_ITEM>189442</PESQUISA_UT_ITEM>
</PESQUISA_UT>
</db:OutputParameters>
</part>
<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="response-headers">[]
</part>
</WC01_Pesquisa_Ut_OutputVariable>
</messages>
but when the function returns more than one, I can't see the result:
<messages>
- <WC01_Pesquisa_Ut_InputVariable>
- <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="InputParameters">
- <InputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/IGIF/WC01/PESQUISA_UT/">
<P_NIR xmlns="">123456789</P_NIR>
<P_NOME_COMPLETO xmlns="">ferreira</P_NOME_COMPLETO>
<P_SEXO xmlns="">Feminino</P_SEXO>
<P_DATA_NASC xmlns="">1944-09-05</P_DATA_NASC>
<P_NATURALIDADE xmlns=""/>
</InputParameters>
</part>
</WC01_Pesquisa_Ut_InputVariable>
- <WC01_Pesquisa_Ut_OutputVariable>
- <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
- <db:OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/IGIF/WC01/PESQUISA_UT/">
<PESQUISA_UT/>
</db:OutputParameters>
</part>
<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="response-headers">[]
</part>
</WC01_Pesquisa_Ut_OutputVariable>
</messages>
Any ideia?
Thanks in advance.
CarlaWhen you invoke the service from the Enterprise Manager, does it give output?
-
JavaFX : How to call java function that returns hashtable and manipulate
I have a requirement to {color:#0000ff}create a java object in JavaFX script code{color}. Then call a java function using the created java object. The java function returns hashtable. Then traverse through each element of hashtable. Finally I need to create a similar structure in JavaFX.
If you need to use a Java class that uses generics you need to take special steps. Since JavaFX does not support generics you need to create a java wrapper to hide the calls that use generics and call the wrapper class from FX.
Maybe you are looking for
-
Aperture keeps creating a new empty library in my Pictures folder
Hi, I am a noob with Aperture, so forgive me if this seems like a stupid question. I have searched through the manual, threads here and Apples help pages but have not found my problem described or my question addressed. First the problem: I have set
-
Parsing query and getting list of tables used
Hi All, I require to parse sql query (simple & complex as well) and to get the list of tables used in the query. And need to validate that, the list of tables against a whitelist to maintained in the file. I tried to write my own parser, sinc
-
Nokia 701 touch sensitive problem
I have with me 701 with the latest firmware version, i often have touch sensitive problem. Sometimes it get ok by just switch off the phone and sometime by removing battery (becoz then button too don't work). what should i do? Someone Plz help !
-
The blackberry stopped receiving email as of Dec 22. it does reeive Registration messages from blackberry. The browser still works. I contacted the provider and the network is functioning correctly. I have deleted the email setup several times an
-
Is there a fix for bug CSCsk86712 on Cisco IOS routers?
I have a Cisco 1941 router running IOS version 15.0 (1r) M16. I am trying to open a range of udp ports but I was told by Cisco TAC that the router won't do it because of this bug on the software. Any suggestions would be great.