Calling C function that has Void* pointer
Hi
I am trying to use some c functions in java using the JNI. This C function has 3 inputs, 2 integers and a void* pointer. I can import the 2 integers from java but dont know how to deal with the void* pointer.
I would be greatful if someone could help me with this problem.
Thanks
Derek
Hi,
i guess the void * points to some C thingy. If you got
the void * from C (via JNI), treat it as a long and cast it back in JNI
as andyba suggested. If it is more than this (e.g. a C++ object)
there is no general solution, but there are numerous special ones.
If you tell a little more concrete what your void * points to,
there might be more concrete suggestions.
To get an idea, study e.g. swig's java module. But be warned,
this is no simple topic.
http://swig.sourceforge.net
Have fun,
Klaus
Similar Messages
-
How to call a Function that will return me boolean value
Hi all ,
I am try to call a function that is included in my ApplictionModule the following is my method code
public boolean callUpdateDepartmentNameFunction(int deptNo,String newName)
boolean result=false;
System.out.println("first");
CallableStatement plsqlBlock =null;
System.out.println("sec");
String statement="BEGIN :3 = update_dname_func(:1,:2); END;";
System.out.println("third");
plsqlBlock=getDBTransaction().createCallableStatement(statement,0);
try{
System.out.println("forth");
plsqlBlock.registerOutParameter(3,OracleTypes.BOOLEAN);
plsqlBlock.setInt(1,deptNo);
plsqlBlock.setString(2,newName);
plsqlBlock.execute();
result=plsqlBlock.getBoolean(0);
catch(SQLException sqlException)
throw new SQLStmtException(CSMessageBundle.class,CSMessageBundle.EXC_SQL_EXECUTE_COMMAND,statement,sqlException);
finally
try{
plsqlBlock.close();
catch(SQLException e)
e.printStackTrace();
} return result;
while am runing my page is am getting error like
Error
1. JBO-29000: Unexpected exception caught: oracle.jbo.SQLStmtException, msg=JBO-27121: SQL error during statement execution. Statement: BEGIN :3 = update_dname_func(:1,:2); END;
2. JBO-27121: SQL error during statement execution. Statement: BEGIN :3 = update_dname_func(:1,:2); END;
3. Invalid column type
callUpdateDepartmentNameFunction_deptNO
callUpdateDepartmentNameFunction_newName
callUpdateDepartmentNameFunction
regards,
Prabeethsoy PHi,
http://download-uk.oracle.com/docs/html/B25947_01/bcadvgen005.htm#sm0297
has an example of how to call a stored procedure with out parameters. Please correct your code accordingly
Frank -
How to call a function which has a cursor
hey folks I have a function which has a cursor,,like this
CREATE OR REPLACE FUNCTION EMPCU RETURN VARCHAR
AS
CURSOR EMPC IS
SELECT LNAME,SALARY,SSN
FROM EMPLOYEE
WHERE DNO IN(4,5);
EMPV EMPC%ROWTYPE;
BEGIN
OPEN EMPC;
LOOP
FETCH EMPC INTO EMPV;
EXIT WHEN EMPC%NOTFOUND;
/*DBMS_OUTPUT.PUT_LINE(EMPV.LNAME||' '||EMPV.SALARY||' '||EMPV.SSN);*/
RETURN EMPV. LNAME ||' '|| EMPV.SALARY||' '||EMPV.SSN;
END LOOP;
CLOSE EMPC;
END EMPCU;
Above function created successfully. I called above function like this
DECLARE
ENAMESAL VARCHAR2(70);
BEGIN
ENAMESAL:=EMPCU();
DBMS_OUTPUT.PUT_LINE(ENAMESAL);
END;
Function is called and function is returning only one row instead of 7 rows. Actually cursor is supposed to return 7 rows but it is returning only one row. Is there any snytax to call a function which has a cursor. So experts please tell me where I have to make changes. I would be very thankful to youWell, you've told the function to RETURN within the loop, so after the first record in the loop, the function returns as you've instructed it.
You would need to change your function to accept a specific input from the EMP table and then do a look up for that specific record and return the values you wanted, and wrap the function call in a loop in your anonymous block.
Or you could just have the anonymous block like this....
BEGIN
FOR X IN
SELECT EMPV. LNAME ||' '|| EMPV.SALARY||' '||EMPV.SSN AS Line_Data
FROM EMPLOYEE
WHERE DNO IN(4,5)
LOOP
DBMS_OUTPUT.PUT_LINE(x.Line_Data);
END LOOP;
END;
/ -
Can a loaded SWF call a function that lives in the parent?
I'm building a pretty simple Flash site in AS3. There is a
main movie (main.swf) that simply loads different swfs via buttons
on a main nav bar. The user clicks on a MC in "main.swf" and a
function is called, loadMyContent("section1.swf"), is called and it
animates in nicely. Other buttons use the same function, loading
section2.swf, section3.swf, etc.
I've defined how "loadMyContent()" works in the the main
movie's document class file. It's all working fine when I just need
to load content from a user action from the buttons that live in
"main.swf". I want to call that same "loadContent" function from
within "section1.swf" and have "main.swf" run it's "loadContent"
fuction, but I can't seem to figure out how to make a child call a
function that lives in the parent.
Is there any way of having my child do this?
I have a suspicion I may have to define that "loadContent"
somewhere else, but I'm a little stumped now. I'm not really
familiar with design patterns yet, although I want to get an
understanding of them sometime soon. Can anyone offer some help
with my immediate need or suggest a route to a solution?
Thanks.kglad,
Thank you very much! That worked perfectly. My section1 FLA
is now compiling it's SWF without complaint.
In case someone else is following this, the exact code I
ended up using to cast "this.parent.parent" as a MovieClip is:
MovieClip(this.parent.parent).loadMyContent("section2.swf");
The discussion I think kglad is referencing is
this
discussion. If that's not it, just let me know. Again, kglad,
thank you! -
Latest update of Firefox is REALLY slow. Is it just all the extra functionality that has been added or is there a button I need to press to make it the same speed as it use to be? I'll have to start usin safari again as this isn't funny anymore
Can i retro grade back to the last version?uninstalled firefox ....deleted all files still remaining under mozilla firefox directory in program files ... to avoid having to reprogram all my settings, reisntall all addons as well .. I did not remove anything from mozilla firefox that is stored in either appdata or under the windows users directory (if any)
... the as suggested reinstalled the latest version of the firefox browser using the link you provided in the email ..; tested and several issues still remain present and unresolved ....
so please this is urgent or I will have to jump browsers and start using chrome .. because we work 14 hours a day 6 (sometimes 7) days a week, to get ready for the launch of our newest venture and we cannot lose that much days on browser related issues ... so please instead of putting me through week long step process .. of do this .. do that .. can you please actually look into the issue from your end .. I use firefox for so many, many years thta I deserve this kind of support .. thnx Robert -
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. -
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. -
How to call c functions that expects c structs from java program?
i need to call from my java program to c functions that get
c structs as a parameters in their prototype.
as you probablly know java is not working with structs (classes only), so my question is how can i do it , i mean call the c functions that gets structs as parameters form java????i believe your c function can accept a jobject and then inside your c function you have to translate that jobject into a c struct by using the jni methods.
the only reason your c function cant accept structs from java is because java does not have such structures. your c function can accept any data type that has been defined and a jobject has been defined.
if you have no control over the c functions that are being called, you need to write a wrapper function for those c function. the wrapper functions do the translation from jobject to a struct...then call the c other c functions. -
Calling a function which has a CLOB parameter via an anonymous block.
OK,
we are moving a lot of exports currently done by Crystal to just be done by stored procs.
So we have a load of existing, some extremely length SQL statements used for these exports.
IN the exports, we have meaningful column headings, so we have a 'lookup' file where all the column names are listed with the desired column name text listed against it.
So - to make our lives easier(i thought) , I have written a Oracle function to extract al;l of the column names as a list (see below).
It works fine except for when I am trying to pass in a SQL treatment that is longer than 4000 character.
What I want to be able to do is simply have an anonymous block that callls my function, I will be running this via SQL explorer.
Something like......
DECLARE
theSQL CLOB;
BEGFIN
theSQL := 'SELECT * FROM ORDERS WHERE 1=0';
SELECT GET_COLUNS_AS_LIST( theSQL, 0 ) FROM DUAL;
END;
However, when I run this I get the error................
PLS-00428: an INTO clause is expected in this SELECT statement
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
If I hard code the SQL like this, SELECT GET_COLUNS_AS_LIST( 'SELECT * FROM ORDERS WHERE 1=0', 0 ) FROM DUAL; all is well.
Also, I am going to need to be able to pass in SQL ststement longer that 4000 characters as weel so please bear that in mind.
I am not an Oracle guy, so I guess I am missing something fundamental - Please enlighten me with regards to this.
Any help extremely appreciated.
CREATE OR REPLACE FUNCTION GET_COLUNS_AS_LIST( P_SQL IN VARCHAR2, Add_Equals_Sign Number := 0)
RETURN CLOB
IS
fResult VARCHAR2(32000);
HNDL NUMBER;
d NUMBER;
colCount INTEGER;
i INTEGER;
rec_tab DBMS_SQL.DESC_TAB;
cCRLF VARCHAR(2) := CHR(13) || CHR(10);
LONG_SQL dbms_sql.varchar2s;
n INTEGER;
l INTEGER;
u INTEGER;
StartPos INTEGER;
BEGIN
--INITIIALISE RESULT
fResult := '';
HNDL := DBMS_SQL.OPEN_CURSOR;
l := Length( P_SQL );
u := ( l / 1000 ) + 1;
FOR n IN 1..u
LOOP
StartPos := ( n - 1 ) + 1;
LONG_SQL( n ) := SubStr( P_SQL, StartPos, 1000 );
END LOOP;
if HNDL <> 0 THEN
DBMS_SQL.PARSE ( c => HNDL,
statement => LONG_SQL,
lb => 1,
ub => u,
lfflg => false,
language_flag => DBMS_SQL.NATIVE );
--DBMS_SQL.PARSE( HNDL, P_SQL, DBMS_SQL.NATIVE);
d := DBMS_SQL.EXECUTE( HNDL );
DBMS_SQL.DESCRIBE_COLUMNS( HNDL, colCount, rec_tab);
FOR i in 1..colCount
LOOP
IF Add_Equals_Sign > 0 AND i > 1 THEN
fResult := ltrim( fResult || '=' || cCRLF || UPPER( rec_tab( i ).col_name ), cCRLF );
ELSE
fResult := ltrim( fResult || cCRLF || UPPER( rec_tab( i ).col_name ), cCRLF );
END IF;
END LOOP;
IF Add_Equals_Sign > 0 THEN
fResult := fResult ||'=';
END IF;
ELSE
fResult := '!!COULD NOT OPEN CURSOR!!';
fResult := P_SQL;
END IF;
RETURN fResult;
--Tidy Up
DBMS_SQL.CLOSE_CURSOR(HNDL);
Return 'EGG';
END;
--EXAMPLE USAGE
--Select GET_COLUNS_AS_LIST
--Select * from SALES_TYPE
--', 1) FROM DUAL;So I have ended up with this.
When I next get some time, I'd like to be able to strip out the table and simply output the results to an SQL Developer script window without having to go through the table.
Now this works - but if you see that I am doing something wrong - please point it out.
Many thanks,
Ant
CREATE OR REPLACE FUNCTION GET_COLUNS_AS_LIST( P_SQL IN CLOB, Add_Equals_Sign Number := 0)
RETURN VARCHAR2
IS
fResult VARCHAR2(32000);
HNDL NUMBER;
d NUMBER;
colCount INTEGER;
i INTEGER;
ChunkSize INTEGER;
rec_tab DBMS_SQL.DESC_TAB;
cCRLF VARCHAR(2) := CHR(13) || CHR(10);
LONG_SQL dbms_sql.varchar2s;
n INTEGER;
l INTEGER;
u INTEGER;
StartPos INTEGER;
BEGIN
--INITIIALISE RESULT
HNDL := 0;
ChunkSize := 4;
fResult := '';
--fResult := fResult|| 'A';
HNDL := DBMS_SQL.OPEN_CURSOR;
--l := Length( P_SQL );
l := dbms_lob.getLength( P_SQL );
--l := 50;
u := Round( l / ChunkSize ) + 1;
--fResult := fResult|| 'B';
FOR n IN 1..u
LOOP
StartPos := ( ( n - 1 ) * ChunkSize ) + 1;
IF StartPos = 0 THEN
StartPos := 1;
END IF;
--LONG_SQL( n ) := SubStr( P_SQL, StartPos, ChunkSize );
LONG_SQL( n ) := DBMS_LOB.SUBSTR( P_SQL, ChunkSize, StartPos );
END LOOP;
--fResult := fResult|| 'C';
if HNDL <> 0 THEN
DBMS_SQL.PARSE ( c => HNDL,
statement => LONG_SQL,
lb => 1,
ub => u,
lfflg => false,
language_flag => DBMS_SQL.NATIVE );
--DBMS_SQL.PARSE( HNDL, P_SQL, DBMS_SQL.NATIVE);
d := DBMS_SQL.EXECUTE( HNDL );
DBMS_SQL.DESCRIBE_COLUMNS( HNDL, colCount, rec_tab);
--fResult := fResult|| 'D';
FOR i in 1..colCount
LOOP
IF Add_Equals_Sign > 0 AND i > 1 THEN
fResult := ltrim( fResult || '=' || cCRLF || UPPER( rec_tab( i ).col_name ), cCRLF );
ELSE
fResult := ltrim( fResult || cCRLF || UPPER( rec_tab( i ).col_name ), cCRLF );
END IF;
END LOOP;
IF Add_Equals_Sign > 0 THEN
fResult := fResult ||'=';
END IF;
ELSE
fResult := '!!COULD NOT OPEN CURSOR!!';
END IF;
RETURN fResult;
--Tidy Up
IF HNDL <> 0 THEN
DBMS_SQL.CLOSE_CURSOR(HNDL);
END IF;
END;
-- !!!!HOW TO USE THIS FUNCTION!!!!
BEGIN
EXECUTE IMMEDIATE ('DROP TABLE RPT_COLNAME_LOOKUPS;');
COMMIT;
EXECUTE IMMEDIATE ('CREATE TABLE RPT_COLNAME_LOOKUPS( COLUMN_NAME CLOB );');
COMMIT;
EXCEPTION WHEN OTHERS THEN NULL;
END;
DECLARE
theSQL Clob;
myresult CLOB;
BEGIN
--CLEAR OUT PREVIOUS RWS
DELETE FROM RPT_COLNAME_LOOKUPS; COMMIT;
--ASSIGN THE SQL TO RUN IT FOR
theSQL := '
SELECT
EVENT.EVENT_ID AS COCK_SUCKER,
EVENT.EVENT_CODE, BLAH, BLAH, VERY LONG SQL STATEMENT';
--CALL THE FUNCTION PASSING IN THE SQL AND IF I WANT THE = OR NOT
SELECT GET_COLUNS_AS_LIST( theSQL, 1 ) INTO myresult FROM DUAL;
--INSERT THE RESULTS INTO A TABLE SO WE CAN GRAB THEM
INSERT INTO RPT_COLNAME_LOOKUPS SELECT myresult FROM DUAL;
COMMIT;
END;
--THEN LOOK AT THE COLUMNS NAMES IN THIS TABLE
--SELECT * FROM RPT_COLNAME_LOOKUPS;
--############################################################################# -
Calling a function that's inside another function
function test1():void
function test2():void {..}
How do I call test2 function (outside test1 function)? Is it possible?Hi,
yes it is possible.
Here is the code helps u
function foo():Function
var x:int = 40;
function rectArea(y:int):int // function closure defined
return x * y
return rectArea;
var myProduct:Function = foo();
var s = myProduct(4);
trace(s);
Saransoft -
Calling a function that outside a package in a package
Hi
i have a file in a package which must call a function which is located in the same directory as the main program file. but the package can not find the function. Is there anyway the class in the package can call the function whcih is in a different location. the function i want to call cant go into a package.
Any help would be grateful
thanksi was under the impression that calling a method ina
class with no package was not possible from withina
class that is part of a package... is this not the
case?
As of 1.4 there is no way to import the default
package class into a normal package and thus there is
no way to call it.
There are two solutions.
1. Add a package.
2. Add a wrapper class (with a package) that calls the desired class. Compile it in 1.3. Use the class/jars produced from that in your 1.4 system. -
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?
-
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. -
I entered the correct download code for "THE HOST" but instead got a copy of "SPRING BREAKERS"! All of the prompts identified it as "The Host" but the final product was "Spring Breakers"! I called a friend who has a copy of that movie and the download codes are not even remotely alike!! How can I correct this error? I 'd rather have SyFy that a bubblegum teenager flick!! HELP ME, PLEASE?!
Hello Old Dogg new tricks,
Thanks for using Apple Support Communities.
For more information on this, take a look at this article:
How to report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase
http://support.apple.com/kb/ht1933
Best of luck,
Mario -
Lines intersecting that has a point in a polygon
Hi Spatial Community,
I would like to get your expertise in trying to see how can we get this done via Oracle Spatial.
The requirement is to write a file
- passed intersection of line that have a point within a polygon
- failed intersections( doe snot have any line intersecting) that have a point within a polygon
Any clues is much appreciated.
Edited by: CrackerJack on Feb 25, 2013 12:46 PMComments before have been pretty much on the money perhaps I might just add
Using the cola_markets example from the manual...
-- Return the topological intersection of two geometries.
SELECT SDO_GEOM.SDO_INTERSECTION(c_a.shape, c_c.shape, 0.005)
FROM cola_markets c_a, cola_markets c_c
WHERE c_a.name = 'cola_a' AND c_c.name = 'cola_c';
SDO_GEOM.SDO_INTERSECTION(C_A.SHAPE,C_C.SHAPE,0.005)(SDO_GTYPE, SDO_SRID, SDO_PO
SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARR
AY(4, 5, 3, 3, 5, 3, 5, 5, 4, 5))
So that finds the ones that DO interact
To do the DISJOINT: The boundaries and interiors do not intersect.
Use SDO_ANYINTERACT as someone else also suggested
The expression SDO_ANYINTERACT(geometry1,geometry2) = 'TRUE' evaluates to TRUE for object pairs that have the ANYINTERACT topological relationship, and FALSE otherwise.
The False version which your will need
SQL> SELECT c.mkt_id, c.name
FROM cola_markets c
WHERE SDO_ANYINTERACT(c.shape,
SDO_GEOMETRY(2003, NULL, NULL,
SDO_ELEM_INFO_ARRAY(1,1003,3),
SDO_ORDINATE_ARRAY(4,6, 8,8))
) != 'TRUE';
2 3 4 5 6 7
MKT_ID NAME
3 cola_c
5 cola_d5
And for completeness the reverse
SQL> SELECT c.mkt_id, c.name
FROM cola_markets c
WHERE SDO_ANYINTERACT(c.shape,
SDO_GEOMETRY(2003, NULL, NULL,
SDO_ELEM_INFO_ARRAY(1,1003,3),
SDO_ORDINATE_ARRAY(4,6, 8,8))
) = 'TRUE';
2 3 4 5 6 7
MKT_ID NAME
1 cola_a
2 cola_b
4 cola_d
Cheers
Rich
Maybe you are looking for
-
I have an iPhone 3 8gig with iOS 4.2.1 can i upgrade it to iOS 4 or 5
Hi there, I have an iPhone 3 8gig with an operating system of 4.2.1 but want to up grade it. When I'm connected to iTunes it gives me the option to upgrade but it always says that it's up to date. I rang apple supprot and they advised me that it wa
-
I updated from 10.6.8 to Maverick 10.9.2 and all of my apps scroll bars do not work correctly as in mail, safari, etc... Anything that can be done? Also, the mail interface is completely different from 10.6.8...is there a way to change back to the lo
-
How do I connect a Samsung SGH-D407 with the I phone
Is this possible? It is discovering the devices but not connecting. Please help I'd like to get the photos off my Samsung but don't have any other way of doing so.
-
App panel doesn't show installed apps.
I had to reinstall Creative Cloud and it doesn't recognize all my already downloaded apps. The OPM.db fix mentioned here: http://helpx.adobe.com/creative-cloud/kb/apps-panel-reflect-creative-cloud.html didn't work. Trying to avoid having to uninstall
-
Lost permission/ownership on ocr&voting device after reboot
Hi all I have an issue on setting up a 10.2.0.3 crs+rac on OEL 5 64 bit. My configuration is as follows: - 2 node OEL 5 64 bit - storage on netapp (FCP) - 2 hba per node (qlogic driver qla2400) - dm-multipath I was able to install and upgrade the crs