How to call Java function which returns byteArray
context I have a class say
public class ByteArray{
public byte[] getByteArray(String str){
return str.getBytes();
}Consider i have object of ByteArray (some how) in native C code. I want to call getByteArray("Test") and obtain a byteArray. what is the C JNI function can i use?
hy
CREATE OR REPLACE FUNCTION GET_SAL1(NN in NUMBER)
RETURN BOOLEAN
IS
BEGIN
INSERT INTO STD(ENO) VALUES(NN);
RETURN TRUE;
EXCEPTION
WHEN OTHERS THEN
RETURN false;
END;
you can call :
if GET_SAL1(NN) then
else
error
end if;
I hope i understand
Regards
Similar Messages
-
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.
-
How to call java function from PL/sql in oracle applications
I am trying to call a java function from plsql procedure. Can any one explain how to call java function, and in which directory I have to store my java function in oracle applications. Do I need to register that java function from Application developer.
Thanks
Kranthihttp://www.oracle.com/technology/tech/java/jsp/index.html
Good Luck,
Avi. -
How to call java function in javascript
Hello Everyone,
Can anyone tell me solution that:
How to call java function in javascript?
Thanks,
VIDsYou can't since Java is running on the server and javascript is running in the browser long after the Java side of things has finished executing. Assuming you're not talking about an applet here.
But you can make calls back to the server through Ajax. All you need is something like a servlet on the receiving end which you can invoke through Ajax; from that point you can execute any Java code you want. -
How to call java function with parameter from javascript in adf mobile?
how to call java function with parameter from javascript in adf mobile?
The ADF Mobile Container Utilities API may be used from JavaScript or Java.
Application Container APIs - 11g Release 2 (11.1.2.4.0) -
Error while calling the function which returns SQL Query!!!
Hi,
I have a Function which returns SQL query. I am calling this function in my APEX report region source.
The query is dynamic SQL and its size varies based on the dynamic "where clause" condition.
But I am not able to execute this function.It gives me the following error in APEX region source.
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Even in SQL* Plus or SQL developer also same error .
The length of my query is more than 4000. I tried changing the variable size which holds my query in the function.
Earlier it was
l_query varchar2(4000)
Now I changed to
l_query varchar2(32767).
Still it is throwing the same error.
Can anybody help me to resolve this.???
Thanks
AlakaHi Varad,
I am already using 32k of varchar2. Then also it is not working.
It is giving the same error. I think there is something to do with buffer size.
My query size is not more than 4200. Even if i give 32k of varchar2 also buffer is able to hold only 3997 size of the query only.
Error is
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Tried CLOB also. It is not working.
Any other solution for this.
Thanks
Alaka -
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;
/ -
How to call java function in Oracle forms?
Hi I am having Oracle 9i with 10g Developer Suite.
I am new to Oracle forms..
I had one function in java getDatas()..
How can I call this function in Oracle Forms..
Pls help
ThanksThanks Francois,
I want to display values from my java code in the Forms..
For that purpose only i am installing 10g Developer Suite..
The below is java code..
public class DBTest {
public static String callDB(int id,String name){
String ss="Hai";
Connection con=null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("url","id","pwd");
Statement st=con.createStatement();
System.out.println("Connected...");
int r=st.executeUpdate("Insert into FORM_TEST VALUES('"+id+"','"+name+"')");
if(r==1){
ss="Inserted Sucessfully";
else{
ss="Insertion Failed";
}catch(final Exception e){
System.out.println(e);
return ss;
public static void main(String[] args) {
int empid=102;
String empname="Gilbert";
String resultStr=callDB(empid,empname);
System.out.println(resultStr);
I want to dispaly Inserted or Insertion Failed in Oracle Forms..
As per Gerd Volberg suggestion, i had placed DBTest.jar in
E:\DevSuite\forms\java\DBTest.jar
and in formsweb.cfg the below jar is added..
archive_jini=frmall_jinit.jar,DBTest.jar
But in Fomrs Builder-->Program-->Import Java Classes-->Oracle
org,ice,com and subnodes are available.
But my jar is not available..
Is my way is coorect?
Pls provide soln..
Thanks -
How to call oracle Function which has If else condition in Data Template
Hi,
currently I am working on creating Data Template which uses a Oracle Function which I need to make use in my data template. But I have some confusions on using the same. Could anybody please help me in this regard.
I have a function like this,
function invoice_query (p_facility_id facility.facility_id%TYPE,
p_wave_nbr pick_directive.wave_nbr%TYPE,
p_container_id unit_pick_group_detail.container_id%TYPE,
p_distro_nbr unit_pick_group_detail.distro_nbr%TYPE) return invoice_refcur IS
refcur invoice_refcur;
begin
IF p_wave_nbr IS NOT NULL THEN
OPEN refcur FOR SELECT t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
SYSDATE,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
min(t2.pick_order),
NULL,
t2.wave_nbr
FROM stock_order t1,
pick_directive t2,
unit_pick_group_detail t3
WHERE t1.facility_id = t2.facility_id
AND t1.facility_id = t3.facility_id
AND t2.facility_id = t3.facility_id
AND t1.distro_nbr = t2.distro_nbr
AND t1.distro_nbr = t3.distro_nbr
AND t2.distro_nbr = t3.distro_nbr
AND t1.facility_id = p_facility_id
AND t2.wave_nbr = p_wave_nbr
AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
AND t2.pick_type = 'U'
AND t3.group_id in (SELECT t4.group_id
FROM unit_pick_group t4
WHERE t4.facility_id = p_facility_id
AND t4.wave_nbr = p_wave_nbr)
GROUP BY t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
t2.wave_nbr
ORDER BY MIN(t3.group_id), MAX(t3.slot);
elsif p_container_id is not null then
OPEN refcur FOR SELECT distinct t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
SYSDATE,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
NULL,
t2.dest_id,
null
FROM stock_order t1,
unit_pick_group_detail t2
WHERE t1.facility_id = t2.facility_id
and t1.distro_nbr = t2.distro_nbr
and t1.facility_id = p_facility_id
AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
AND t2.container_id = p_container_id;
else
open refcur for SELECT distinct t1.distro_nbr,
t1.cust_order_nbr,
t1.pick_not_before_date,
SYSDATE,
t1.ship_address_description,
t1.ship_address1,
t1.ship_address2,
t1.ship_address3,
t1.ship_address4,
t1.ship_address5,
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
t1.ship_country_code,
t1.bill_address_description,
t1.bill_address1,
t1.bill_address2,
t1.bill_address3,
t1.bill_address4,
t1.bill_address5,
t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
t1.bill_country_code,
NULL,
NULL,
t3.wave_nbr
FROM stock_order t1,
unit_pick_group_detail t2,
unit_pick_group t3
WHERE t1.facility_id = t2.facility_id
and t2.facility_id = t3.facility_id
and t1.distro_nbr = t2.distro_nbr
and t2.group_id = t3.group_id
and t1.facility_id = p_facility_id
AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
AND t2.distro_nbr = p_distro_nbr;
END IF;
return refcur;
end;
I have created data template like following,
<sqlStatement name="Q_INVOICE">
<![CDATA[
SELECT Pack_Slip_R.invoice_query(:P_FACILITY_ID,:P_WAVE_NBR,:P_CONTAINER_ID,:P_DISTRO_NBR) from dual
]]>
</sqlStatement>
But how does I create a element for the "t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip" column in the oracle function. I normally create an element like following,
<group name="G_INVOICE" source="Q_INVOICE">
<element name="CUST_ORDER_NBR" value="cust_order_nbr"/>
<element name=":dest_id" value="dest_id"/>
</Group>
But how do i create element if a column name is kind of dynamic. Please help. I cannot Rename/change the Column in SQL Query. Please let me know If I could handle this whole logic in BI Publsiher.
Regards,
Ashoka BLtry useing alias
t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip as <COLUMN_ALIAS> -
How to call a function, which name is stored in table?
Dear members,
I have a function with return number, and store its name in a table.
now I want to select this function name from table and run it and return the value to a variable in my form.
here is my code in when-button-pressed trigger.
DECLARE
v_value number;
V_FUNC VARCHAR2(100);
V_PARAM VARCHAR2(100);
begin
select FUNCTION_NAME, PARAM
INTO V_FUNC, V_PARAM
from function_table
where id =1;
message('V_FUNC='||V_FUNC); pause;
v_value := v_func||';'; --run_tb_function;
:text01 := v_value;
end;this code gives the following error:
ora-06502
regards:
Edited by: user2040934 on Feb 2, 2013 9:47 AMBelow is the modified code:
DECLARE
v_value number;
V_FUNC VARCHAR2(100);
V_PARAM VARCHAR2(100);
v_cmd varchar2(1000);
begin
select FUNCTION_NAME, PARAM
INTO V_FUNC, V_PARAM
from function_table
where id =1;
-- create a valuetable with one column vval varchar2 type
v_cmd := 'declare val varchar2(100); Begin val := '||v_func||'; delete from valuetable; insert into valuetable(vval) values (v); commit; end;';
forms_ddl(v_cmd);
begin
select vval into :text01 from valuetable where rownum = 1;
exception
when no_data_found then
-- do your action....
null;
end;
end;
Edited by: user5213229 on Feb 2, 2013 4:33 PM -
Unit test, how to test a function which returns a PL/SQL table.
I've got the following type definition:
create or replace type method_tbl as table of varchar2(255);
/I've got the following function
function abc(p_param1 in varchar2) return method_tbl;When I create a unit test for this I am not able to specify what the table should contain on return of the function, all I can see is an empty table. Which is off course one of the unit tests. But I also want to test where the table that is returned contains a number of rows.
Is there something that I'm missing?
Typically the function is called like this:
select * from table(abc('a'));Thanks,
Ronald>
When I create a unit test for this I am not able to specify what the table should contain on return of the function, all I can see is an empty table. Which is off course one of the unit tests. But I also want to test where the table that is returned contains a number of rows.
Is there something that I'm missing?
>
You will have to create a collection that represents the result set and then compare that to the actual result set.
Assuming tables A and B you would typically have to do
1. SELECT * FROM A MINUS SELECT * FROM B -- what is in A that is NOT in B
2. SELECT * FROM B MINUS SELECT * FROM A -- what is in B that is NOT in A
You could combine those two queries into one with a UNION ALL but since the results are tables and the comparison is more complex it is common to write a function to determine the comparison result.
Here is sample code that shows how to create an expected result collection.
DECLARE
expectedItemList sys.OdciVarchar2List;
functionItemList sys.OdciVarchar2List;
newItemList sys.OdciVarchar2List;
expectedCount INTEGER;
countFunctionItemList INTEGER;
BEGIN
expectedItemList := sys.OdciVarchar2List('car','apple','orange','banana','kiwi');
expectedCount := 5; -- or query to count them
functionItemList := sys.OdciVarchar2List('car','apple','orange','peanut');
-- use your function to get the records
-- select * from myFunctino BULK COLLECT INTO functionItemList
IF functionItemList.count != expectedCount THEN
DBMS_OUTPUT.PUT_LINE('Count is ' || functionItemList.count || ' but should be ' || expectedCount);
END IF;
END;
Count is 4 but should be 5If the collections are the same type you can use the MULTISET operators.
See Solomon's reply in this thread for how to use the MULTISET operators on collections.
PLS-00306: wrong number or type of argument in call to 'MULTISET_UNION_ALL'
See MultisetOperators in the SQL Reference doc
http://docs.oracle.com/cd/B13789_01/server.101/b10759/operators006.htm
>
Multiset operators combine the results of two nested tables into a single nested table. -
Problems with PL/SQL Calling Java Function that returns String []
Hi,
I have written the following code. It's not compiling OK.
DECLARE
TYPE Tokens_Type IS VARYING ARRAY(20) OF VARCHAR2(20);
s1 Tokens_Type DEFAULT NULL;
SQL_STR VARCHAR2(2000) DEFAULT NULL;
BEGIN
SQL_STR := 'CREATE OR REPLACE FUNCTION Schema1.SPLIT_STR (S2 VARCHAR2(20)) ' ||
'RETURN s1 ' ||
'AS LANGUAGE JAVA ' ||
'NAME ''String_Mani.split_it (String) return java.lang.String []''';
EXECUTE IMMEDIATE SQL_STR;
END;
What's the problem with this?You cannot create a function with a locally defined return type. As soon as this script is executed, Oracle no longer knows what the TOKEN_TYPE type is any more, so the function will be invalid.
You need to use a collection type defined at the database level or defined in a package - somewhere where it will persist. -
Calling Java Function with Return as String []
Hi,
I have written the following code. It's not compiling OK.
DECLARE
TYPE Tokens_Type IS VARYING ARRAY(20) OF VARCHAR2(20);
s1 Tokens_Type DEFAULT NULL;
SQL_STR VARCHAR2(2000) DEFAULT NULL;
BEGIN
SQL_STR := 'CREATE OR REPLACE FUNCTION Schema1.SPLIT_STR (S2 VARCHAR2(20)) ' ||
'RETURN s1 ' ||
'AS LANGUAGE JAVA ' ||
'NAME ''String_Mani.split_it (String) return java.lang.String []''';
EXECUTE IMMEDIATE SQL_STR;
END;
What's the problem with this?Hi,
I have written the following code. It's not compiling OK.
DECLARE
TYPE Tokens_Type IS VARYING ARRAY(20) OF VARCHAR2(20);
s1 Tokens_Type DEFAULT NULL;
SQL_STR VARCHAR2(2000) DEFAULT NULL;
BEGIN
SQL_STR := 'CREATE OR REPLACE FUNCTION Schema1.SPLIT_STR (S2 VARCHAR2(20)) ' ||
'RETURN s1 ' ||
'AS LANGUAGE JAVA ' ||
'NAME ''String_Mani.split_it (String) return java.lang.String []''';
EXECUTE IMMEDIATE SQL_STR;
END;
What's the problem with this? -
How to call java function through Web Service
Hello Experts,
I want to call a method through Java Web Service in my abap code. Is it possible ? If so, plz guide me.
Requirement: In SD module user enters the PAN, on after entering PAN in want to validate it on NSDL. For that a Web Service has already been deployed on a Web Server. and that the deployed Web Service I want to call in abap code.Hi,
check this link
Re: Call to WS from one backend to other backend
regards
afzal -
How to call a procedure which returns out parameter in form personalization
Dear All,
I have one procedure which is having 2 parameter in and one parameter out .
The question is how to get the parameter out in from personalization in a local or global variable?
ThanksYes.
You can use the "forms_ddl" builtin
See the following examples. Make sure you include the single quotes as well as the = sign in the begining.
See http://phenix.blog.163.com/blog/static/8397219320096213953151/
http://oracle.anilpassi.com/forms-personalizations.html
Sandeep Gandhi
Maybe you are looking for
-
Iphoto 08 and iphoto 09 sharing a single album on a external drive
Hello all, I have a mac mini with iphoto 08 on it as well as a Drobo external storage device that houses all my photos video and movies - I just purchased a new 24" imac that came with iphoto 09 - Can I share the iphoto album that resides on the drob
-
Iphone 5 keeps switching to silent on its own
My Iphone 5 is stuck on silent mode, or more accurately it keeps switching to silent on its own. The problem started about 2 days ago, after upgrading to iOS 7.1 last week. The phone keeps switching in and out of silent mode (without the button being
-
Bug in Photoshop Action Player affecting some Adjustment Layers steps
I skipped CS4 and when I installed CS5 I discovered a nasty bug had been introduced is Photoshop's Action facility most likely in CS 4. Action that add adjustment Layers clipped to the current layer that step is recorded Make adjustment layer with Cl
-
dear all , i have copied a table and activated and used it in a program and transported both program along with tables to quality . i got error RC = 8.(some domains and data elements not activated). i have again checked and activated
-
Trying to download video from camcorder
what do i do when my camcorder video does not pop up on screen? My camera is saying USB is connected but the computer is not reading it